summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2012-11-17 02:55:47 +0000
committerneel <neel@FreeBSD.org>2012-11-17 02:55:47 +0000
commit0e18e1b9de7bacfe2cdccb09738c895dfaf0cbf8 (patch)
tree2bd9bddaae9e43ae0279e8ef5ed4b4d93aa41eff
parent1a164db277254c1198a5923050a4e403737937c3 (diff)
parent40d9982013b20f7e4359382de92b451264e2233b (diff)
downloadFreeBSD-src-0e18e1b9de7bacfe2cdccb09738c895dfaf0cbf8.zip
FreeBSD-src-0e18e1b9de7bacfe2cdccb09738c895dfaf0cbf8.tar.gz
IFC @ r243164
-rw-r--r--ObsoleteFiles.inc6
-rw-r--r--bin/df/df.1111
-rw-r--r--bin/df/df.c46
-rw-r--r--bin/mv/mv.c2
-rw-r--r--bin/sh/input.c1
-rw-r--r--bin/sh/input.h1
-rw-r--r--cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 (renamed from cddl/contrib/opensolaris/cmd/zpool/zpool-features.5)2
-rw-r--r--cddl/contrib/opensolaris/cmd/zpool/zpool.812
-rw-r--r--cddl/contrib/opensolaris/cmd/zpool/zpool_main.c6
-rw-r--r--cddl/sbin/zpool/Makefile2
-rw-r--r--contrib/atf/FREEBSD-Xlist8
-rw-r--r--contrib/atf/FREEBSD-upgrade28
-rw-r--r--contrib/atf/atf-c/macros.h2
-rw-r--r--contrib/atf/atf-run/requirements_test.cpp3
-rw-r--r--contrib/atf/atf-sh/atf_check_test.sh4
-rw-r--r--contrib/atf/doc/atf-test-case.42
-rw-r--r--contrib/bmake/ChangeLog25
-rw-r--r--contrib/bmake/FILES1
-rw-r--r--contrib/bmake/Makefile.in6
-rw-r--r--contrib/bmake/cond.c37
-rw-r--r--contrib/bmake/make.c10
-rw-r--r--contrib/bmake/unit-tests/Makefile.in6
-rw-r--r--contrib/bmake/unit-tests/order20
-rw-r--r--contrib/bmake/unit-tests/test.exp3
-rw-r--r--contrib/gdb/gdb/frame.c17
-rw-r--r--contrib/libc++/include/__config12
-rw-r--r--contrib/libc++/include/__functional_base6
-rw-r--r--contrib/libc++/include/__functional_base_036
-rw-r--r--contrib/libc++/include/__locale12
-rw-r--r--contrib/libc++/include/__mutex_base6
-rw-r--r--contrib/libc++/include/algorithm66
-rw-r--r--contrib/libc++/include/cmath2
-rw-r--r--contrib/libc++/include/complex2
-rw-r--r--contrib/libc++/include/condition_variable12
-rw-r--r--contrib/libc++/include/cstddef6
-rw-r--r--contrib/libc++/include/ext/__hash2
-rw-r--r--contrib/libc++/include/future2
-rw-r--r--contrib/libc++/include/ios2
-rw-r--r--contrib/libc++/include/istream10
-rw-r--r--contrib/libc++/include/iterator2
-rw-r--r--contrib/libc++/include/locale72
-rw-r--r--contrib/libc++/include/memory30
-rw-r--r--contrib/libc++/include/ostream4
-rw-r--r--contrib/libc++/include/random96
-rw-r--r--contrib/libc++/include/streambuf8
-rw-r--r--contrib/libc++/include/string12
-rw-r--r--contrib/libc++/include/system_error2
-rw-r--r--contrib/libc++/include/tuple2
-rw-r--r--contrib/libc++/include/type_traits24
-rw-r--r--contrib/libc++/include/utility4
-rw-r--r--contrib/libc++/include/valarray6
-rw-r--r--contrib/libc++/include/vector2
-rw-r--r--contrib/libc++/src/memory.cpp6
-rw-r--r--contrib/tzdata/africa28
-rw-r--r--contrib/tzdata/asia10
-rw-r--r--contrib/tzdata/australasia2
-rw-r--r--contrib/tzdata/europe2
-rw-r--r--contrib/tzdata/northamerica2
-rw-r--r--contrib/tzdata/southamerica2
-rw-r--r--crypto/heimdal/lib/sl/slc-lex.l2
-rw-r--r--etc/Makefile6
-rwxr-xr-xetc/rc.d/jail3
-rw-r--r--games/fortune/datfiles/fortunes4
-rw-r--r--games/fortune/fortune/fortune.c2
-rw-r--r--include/xlocale/_ctype.h2
-rw-r--r--lib/libc/gen/Makefile.inc2
-rw-r--r--lib/libc/gen/Symbol.map1
-rw-r--r--lib/libc/gen/getbsize.338
-rw-r--r--lib/libc/gen/waitid.c65
-rw-r--r--lib/libc/include/namespace.h1
-rw-r--r--lib/libc/include/un-namespace.h1
-rw-r--r--lib/libc/net/getnetent.35
-rw-r--r--lib/libc/net/getprotoent.35
-rw-r--r--lib/libc/net/getservent.35
-rw-r--r--lib/libc/sys/Makefile.inc3
-rw-r--r--lib/libc/sys/Symbol.map3
-rw-r--r--lib/libc/sys/rtprio.212
-rw-r--r--lib/libc/sys/sendfile.22
-rw-r--r--lib/libc/sys/wait.2311
-rw-r--r--lib/libfetch/http.c8
-rw-r--r--sbin/fsck_ffs/suj.c18
-rw-r--r--sbin/route/route.c49
-rw-r--r--sbin/umount/umount.c13
-rw-r--r--share/man/man4/lagg.46
-rw-r--r--share/man/man4/ng_UI.46
-rw-r--r--share/man/man4/ng_async.434
-rw-r--r--share/man/man4/ng_atmllc.42
-rw-r--r--share/man/man4/ng_bluetooth.42
-rw-r--r--share/man/man4/ng_bpf.414
-rw-r--r--share/man/man4/ng_bridge.416
-rw-r--r--share/man/man4/ng_bt3c.422
-rw-r--r--share/man/man4/ng_btsocket.412
-rw-r--r--share/man/man4/ng_car.442
-rw-r--r--share/man/man4/ng_ccatm.430
-rw-r--r--share/man/man4/ng_cisco.424
-rw-r--r--share/man/man4/ng_deflate.412
-rw-r--r--share/man/man4/ng_eiface.46
-rw-r--r--share/man/man4/ng_etf.412
-rw-r--r--share/man/man4/ng_ether.424
-rw-r--r--share/man/man4/ng_fec.412
-rw-r--r--share/man/man4/ng_frame_relay.46
-rw-r--r--share/man/man4/ng_gif.46
-rw-r--r--share/man/man4/ng_gif_demux.416
-rw-r--r--share/man/man4/ng_h4.46
-rw-r--r--share/man/man4/ng_hci.416
-rw-r--r--share/man/man4/ng_hole.48
-rw-r--r--share/man/man4/ng_hub.42
-rw-r--r--share/man/man4/ng_iface.426
-rw-r--r--share/man/man4/ng_ksocket.416
-rw-r--r--share/man/man4/ng_l2cap.414
-rw-r--r--share/man/man4/ng_l2tp.443
-rw-r--r--share/man/man4/ng_lmi.418
-rw-r--r--share/man/man4/ng_mppc.47
-rw-r--r--share/man/man4/ng_nat.426
-rw-r--r--share/man/man4/ng_netflow.42
-rw-r--r--share/man/man4/ng_one2many.415
-rw-r--r--share/man/man4/ng_patch.414
-rw-r--r--share/man/man4/ng_ppp.449
-rw-r--r--share/man/man4/ng_pppoe.430
-rw-r--r--share/man/man4/ng_pptpgre.425
-rw-r--r--share/man/man4/ng_pred1.412
-rw-r--r--share/man/man4/ng_rfc1490.416
-rw-r--r--share/man/man4/ng_source.48
-rw-r--r--share/man/man4/ng_split.48
-rw-r--r--share/man/man4/ng_sppp.44
-rw-r--r--share/man/man4/ng_sscfu.414
-rw-r--r--share/man/man4/ng_sscop.418
-rw-r--r--share/man/man4/ng_tag.416
-rw-r--r--share/man/man4/ng_tcpmss.410
-rw-r--r--share/man/man4/ng_tee.414
-rw-r--r--share/man/man4/ng_tty.44
-rw-r--r--share/man/man4/ng_ubt.416
-rw-r--r--share/man/man4/ng_uni.416
-rw-r--r--share/man/man4/ng_vjc.418
-rw-r--r--share/man/man4/ng_vlan.410
-rw-r--r--share/man/man4/unix.4108
-rw-r--r--share/man/man7/environ.711
-rw-r--r--share/man/man7/tuning.7289
-rw-r--r--share/man/man9/firmware.96
-rw-r--r--share/man/man9/malloc.915
-rw-r--r--share/man/man9/mbuf.957
-rw-r--r--share/man/man9/mi_switch.92
-rw-r--r--share/man/man9/pfil.94
-rw-r--r--share/misc/flowers6
-rw-r--r--share/termcap/termcap.src2
-rw-r--r--sys/amd64/amd64/minidump_machdep.c1
-rw-r--r--sys/amd64/amd64/uma_machdep.c8
-rw-r--r--sys/arm/arm/busdma_machdep-v6.c1
-rw-r--r--sys/arm/arm/cpufunc.c5
-rw-r--r--sys/arm/arm/cpufunc_asm_armv7.S22
-rw-r--r--sys/arm/arm/pmap-v6.c8
-rw-r--r--sys/arm/arm/pmap.c1
-rw-r--r--sys/arm/arm/vm_machdep.c7
-rw-r--r--sys/boot/forth/menu-commands.4th163
-rw-r--r--sys/boot/forth/menu.4th420
-rw-r--r--sys/boot/i386/common/edd.h10
-rw-r--r--sys/bsm/audit_kevents.h1
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/sys/procset.h4
-rw-r--r--sys/compat/freebsd32/freebsd32.h5
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c36
-rw-r--r--sys/compat/freebsd32/freebsd32_proto.h12
-rw-r--r--sys/compat/freebsd32/freebsd32_syscall.h5
-rw-r--r--sys/compat/freebsd32/freebsd32_syscalls.c3
-rw-r--r--sys/compat/freebsd32/freebsd32_sysent.c3
-rw-r--r--sys/compat/freebsd32/freebsd32_systrace_args.c42
-rw-r--r--sys/compat/freebsd32/syscalls.master5
-rw-r--r--sys/conf/files149
-rw-r--r--sys/contrib/octeon-sdk/octeon-pci-console.c8
-rw-r--r--sys/dev/adb/adb_mouse.c4
-rw-r--r--sys/dev/agp/agp.c1
-rw-r--r--sys/dev/agp/agp_ali.c2
-rw-r--r--sys/dev/agp/agp_amd.c2
-rw-r--r--sys/dev/agp/agp_amd64.c2
-rw-r--r--sys/dev/agp/agp_apple.c2
-rw-r--r--sys/dev/agp/agp_ati.c2
-rw-r--r--sys/dev/agp/agp_i810.c2
-rw-r--r--sys/dev/agp/agp_intel.c2
-rw-r--r--sys/dev/agp/agp_nvidia.c2
-rw-r--r--sys/dev/agp/agp_sis.c2
-rw-r--r--sys/dev/agp/agp_via.c2
-rw-r--r--sys/dev/aic7xxx/aicasm/aicasm_gram.y2
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416desc.h3
-rw-r--r--sys/dev/ath/if_ath.c14
-rw-r--r--sys/dev/ath/if_ath_alq.c26
-rw-r--r--sys/dev/ath/if_ath_alq.h27
-rw-r--r--sys/dev/ath/if_ath_rx.c13
-rw-r--r--sys/dev/ath/if_ath_sysctl.c4
-rw-r--r--sys/dev/ath/if_ath_tx.c75
-rw-r--r--sys/dev/ath/if_ath_tx.h7
-rw-r--r--sys/dev/ath/if_ath_tx_edma.c54
-rw-r--r--sys/dev/cxgbe/tom/t4_listen.c4
-rw-r--r--sys/dev/iicbus/iic.c6
-rw-r--r--sys/dev/mfi/mfi_syspd.c4
-rw-r--r--sys/dev/sio/sio_isa.c1
-rw-r--r--sys/dev/sound/pcm/channel.c2
-rw-r--r--sys/dev/sound/pcm/feeder_matrix.c2
-rw-r--r--sys/dev/sound/pcm/matrix.h22
-rw-r--r--sys/dev/sound/pcm/matrix_map.h105
-rw-r--r--sys/dev/uart/uart_bus_isa.c1
-rw-r--r--sys/fs/devfs/devfs_devs.c2
-rw-r--r--sys/fs/nfsclient/nfs_clport.c25
-rw-r--r--sys/fs/smbfs/smbfs_node.c28
-rw-r--r--sys/fs/smbfs/smbfs_vnops.c33
-rw-r--r--sys/ia64/ia64/uma_machdep.c8
-rw-r--r--sys/kern/init_sysent.c5
-rw-r--r--sys/kern/kern_exit.c308
-rw-r--r--sys/kern/kern_ktr.c112
-rw-r--r--sys/kern/kern_proc.c73
-rw-r--r--sys/kern/kern_prot.c4
-rw-r--r--sys/kern/kern_racct.c52
-rw-r--r--sys/kern/sched_ule.c4
-rw-r--r--sys/kern/subr_lock.c29
-rw-r--r--sys/kern/subr_smp.c50
-rw-r--r--sys/kern/sys_procdesc.c2
-rw-r--r--sys/kern/syscalls.c3
-rw-r--r--sys/kern/syscalls.master7
-rw-r--r--sys/kern/systrace_args.c44
-rw-r--r--sys/kern/uipc_usrreq.c3
-rw-r--r--sys/mips/cavium/files.octeon12
-rw-r--r--sys/mips/cavium/octeon_pci_console.c122
-rw-r--r--sys/mips/conf/OCTEON114
-rw-r--r--sys/mips/include/pmap.h1
-rw-r--r--sys/mips/mips/pmap.c3
-rw-r--r--sys/mips/mips/uma_machdep.c9
-rw-r--r--sys/modules/agp/Makefile2
-rw-r--r--sys/netinet/sctp_constants.h2
-rw-r--r--sys/netinet/sctp_indata.c30
-rw-r--r--sys/netinet/sctp_input.c1
-rw-r--r--sys/netinet/sctp_output.c10
-rw-r--r--sys/netinet/sctp_pcb.c16
-rw-r--r--sys/netinet/sctp_timer.c2
-rw-r--r--sys/netinet/sctputil.c3
-rw-r--r--sys/netinet6/icmp6.c4
-rw-r--r--sys/netinet6/in6_src.c4
-rw-r--r--sys/netinet6/ip6_input.c4
-rw-r--r--sys/netinet6/nd6.c12
-rw-r--r--sys/netinet6/nd6_rtr.c12
-rw-r--r--sys/netinet6/scope6.c40
-rw-r--r--sys/powerpc/aim/mmu_oea64.c9
-rw-r--r--sys/powerpc/aim/slb.c8
-rw-r--r--sys/powerpc/aim/uma_machdep.c8
-rw-r--r--sys/sparc64/include/ktr.h1
-rw-r--r--sys/sparc64/sparc64/pmap.c1
-rw-r--r--sys/sparc64/sparc64/vm_machdep.c9
-rw-r--r--sys/sys/ktr.h2
-rw-r--r--sys/sys/lock.h11
-rw-r--r--sys/sys/param.h2
-rw-r--r--sys/sys/proc.h4
-rw-r--r--sys/sys/resource.h7
-rw-r--r--sys/sys/smp.h4
-rw-r--r--sys/sys/syscall.h5
-rw-r--r--sys/sys/syscall.mk5
-rw-r--r--sys/sys/syscallsubr.h16
-rw-r--r--sys/sys/sysproto.h16
-rw-r--r--sys/sys/vmmeter.h4
-rw-r--r--sys/sys/wait.h52
-rw-r--r--sys/ufs/ffs/ffs_softdep.c139
-rw-r--r--sys/vm/device_pager.c1
-rw-r--r--sys/vm/sg_pager.c1
-rw-r--r--sys/vm/vm_fault.c2
-rw-r--r--sys/vm/vm_kern.c26
-rw-r--r--sys/vm/vm_page.c183
-rw-r--r--sys/vm/vm_page.h74
-rw-r--r--sys/vm/vm_pageout.c173
-rw-r--r--sys/vm/vm_phys.h1
-rw-r--r--tools/build/mk/OptionalObsoleteFiles.inc1
-rw-r--r--usr.bin/bc/bc.y2
-rw-r--r--usr.bin/bmake/Makefile4
-rw-r--r--usr.bin/bmake/Makefile.inc4
-rw-r--r--usr.bin/bmake/unit-tests/Makefile6
-rw-r--r--usr.bin/chpass/chpass.c7
-rw-r--r--usr.bin/fetch/fetch.c36
-rw-r--r--usr.bin/ktrdump/ktrdump.c6
-rw-r--r--usr.bin/ministat/ministat.17
-rw-r--r--usr.bin/ministat/ministat.c11
-rw-r--r--usr.bin/mkcsmapper/Makefile.inc8
-rw-r--r--usr.bin/ssh-copy-id/ssh-copy-id.13
-rwxr-xr-xusr.sbin/bsdconfig/bsdconfig55
-rwxr-xr-xusr.sbin/bsdconfig/console/console2
-rwxr-xr-xusr.sbin/bsdconfig/console/font2
-rwxr-xr-xusr.sbin/bsdconfig/console/keymap2
-rwxr-xr-xusr.sbin/bsdconfig/console/repeat2
-rwxr-xr-xusr.sbin/bsdconfig/console/saver2
-rwxr-xr-xusr.sbin/bsdconfig/console/screenmap2
-rwxr-xr-xusr.sbin/bsdconfig/console/ttys2
-rwxr-xr-xusr.sbin/bsdconfig/diskmgmt/diskmgmt2
-rwxr-xr-xusr.sbin/bsdconfig/docsinstall/docsinstall2
-rwxr-xr-xusr.sbin/bsdconfig/dot/dot2
-rwxr-xr-xusr.sbin/bsdconfig/mouse/disable2
-rwxr-xr-xusr.sbin/bsdconfig/mouse/enable2
-rwxr-xr-xusr.sbin/bsdconfig/mouse/flags2
-rwxr-xr-xusr.sbin/bsdconfig/mouse/mouse2
-rwxr-xr-xusr.sbin/bsdconfig/mouse/port2
-rwxr-xr-xusr.sbin/bsdconfig/mouse/type2
-rwxr-xr-xusr.sbin/bsdconfig/networking/defaultrouter2
-rwxr-xr-xusr.sbin/bsdconfig/networking/devices2
-rwxr-xr-xusr.sbin/bsdconfig/networking/hostname2
-rwxr-xr-xusr.sbin/bsdconfig/networking/nameservers2
-rwxr-xr-xusr.sbin/bsdconfig/networking/networking2
-rwxr-xr-xusr.sbin/bsdconfig/password/password2
-rwxr-xr-xusr.sbin/bsdconfig/security/kern_securelevel2
-rwxr-xr-xusr.sbin/bsdconfig/security/security2
-rw-r--r--usr.sbin/bsdconfig/share/common.subr180
-rwxr-xr-xusr.sbin/bsdconfig/startup/misc2
-rwxr-xr-xusr.sbin/bsdconfig/startup/rcadd2
-rwxr-xr-xusr.sbin/bsdconfig/startup/rcconf2
-rwxr-xr-xusr.sbin/bsdconfig/startup/rcdelete2
-rwxr-xr-xusr.sbin/bsdconfig/startup/rcedit2
-rwxr-xr-xusr.sbin/bsdconfig/startup/rcvar2
-rwxr-xr-xusr.sbin/bsdconfig/startup/startup2
-rwxr-xr-xusr.sbin/bsdconfig/timezone/timezone2
-rwxr-xr-xusr.sbin/bsdconfig/ttys/ttys2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/groupadd2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/groupdel2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/groupedit2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/groupinput2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/useradd2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/userdel2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/useredit2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/userinput2
-rwxr-xr-xusr.sbin/bsdconfig/usermgmt/usermgmt2
-rw-r--r--usr.sbin/chkgrp/chkgrp.87
-rw-r--r--usr.sbin/chkgrp/chkgrp.c66
-rw-r--r--usr.sbin/ndiscvt/ndiscvt.c2
324 files changed, 3876 insertions, 2467 deletions
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 3ec0cca..c519a2d 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -38,6 +38,12 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20121114: zpool-features manual page moved from section 5 to 7
+OLD_FILES+=usr/share/man/man5/zpool-features.5.gz
+# 20121022: remove harp, hfa and idt man page
+OLD_FILES+=share/man/man4/harp.4
+OLD_FILES+=share/man/man4/hfa.4
+OLD_FILES+=share/man/man4/idt.4
# 20121022: VFS_LOCK_GIANT elimination
OLD_FILES+=usr/share/man/man9/VFS_LOCK_GIANT.9.gz
OLD_FILES+=usr/share/man/man9/VFS_UNLOCK_GIANT.9.gz
diff --git a/bin/df/df.1 b/bin/df/df.1
index 3c60b26..f107ad3 100644
--- a/bin/df/df.1
+++ b/bin/df/df.1
@@ -29,7 +29,7 @@
.\" @(#)df.1 8.3 (Berkeley) 5/8/95
.\" $FreeBSD$
.\"
-.Dd March 3, 2012
+.Dd November 16, 2012
.Dt DF 1
.Os
.Sh NAME
@@ -50,7 +50,8 @@ displays statistics about the amount of free disk space on the specified
or on the file system of which
.Ar file
is a part.
-Values are displayed in 512-byte per block counts.
+By default block counts are displayed with an assumed block size of
+512 bytes.
If neither a file or a file system operand is specified,
statistics for all mounted file systems are displayed
(subject to the
@@ -65,48 +66,54 @@ Show all mount points, including those that were mounted with the
flag.
This is implied for file systems specified on the command line.
.It Fl b
-Use 512-byte blocks rather than the default.
-Note that
-this overrides the
+Explicitly use 512 byte blocks, overriding any
.Ev BLOCKSIZE
specification from the environment.
+This is the same as the
+.Fl P
+option.
+The
+.Fl k
+option overrides this option.
.It Fl c
Display a grand total.
.It Fl g
-Use 1073741824-byte (1-Gbyte) blocks rather than the default.
-Note that
-this overrides the
+Use 1073741824 byte (1 Gibibyte) blocks rather than the default.
+This overrides any
.Ev BLOCKSIZE
specification from the environment.
.It Fl H
.Dq Human-readable
output.
-Use unit suffixes: Byte, Kilobyte, Megabyte,
-Gigabyte, Terabyte and Petabyte in order to reduce the number of
-digits to four or fewer using base 10 for sizes.
+Use unit suffixes: Byte, Kibibyte, Mebibyte, Gibibyte, Tebibyte and
+Pebibyte (based on powers of 1024) in order to reduce the number of
+digits to four or fewer.
.It Fl h
.Dq Human-readable
output.
Use unit suffixes: Byte, Kilobyte, Megabyte,
-Gigabyte, Terabyte and Petabyte in order to reduce the number of
-digits to four or fewer using base 2 for sizes.
-Inodes statistics, if enabled with
-.Fl i ,
-are always printed in base 10.
+Gigabyte, Terabyte and Petabyte (based on powers of 1000) in order to
+reduce the number of
+digits to four or fewer.
.It Fl i
-Include statistics on the number of free inodes.
+Include statistics on the number of free and used inodes.
+In conjunction with the
+.Fl h
+or
+.Fl H
+options, the number of inodes is scaled by powers of 1000.
.It Fl k
-Use 1024-byte (1-Kbyte) blocks rather than the default.
-Note that
-this overrides the
+Use 1024 byte (1 Kibibyte) blocks rather than the default.
+This overrides the
+.Fl P
+option and any
.Ev BLOCKSIZE
specification from the environment.
.It Fl l
Only display information about locally-mounted file systems.
.It Fl m
-Use 1048576-byte (1-Mbyte) blocks rather than the default.
-Note that
-this overrides the
+Use 1048576 byte (1 Mebibyte) blocks rather than the default.
+This overrides any
.Ev BLOCKSIZE
specification from the environment.
.It Fl n
@@ -119,10 +126,15 @@ When this option is specified,
will not request new statistics from the file systems, but will respond
with the possibly stale statistics that were previously obtained.
.It Fl P
-Use POSIX compliant output of 512-byte blocks rather than the default.
-Note that this overrides the
+Explicitly use 512 byte blocks, overriding any
.Ev BLOCKSIZE
specification from the environment.
+This is the same as the
+.Fl b
+option.
+The
+.Fl k
+option overrides this option.
.It Fl t
Only print out statistics for file systems of the specified types.
More than one type may be specified in a comma separated list.
@@ -148,26 +160,53 @@ command can be used to find out the types of file systems
that are available on the system.
.It Fl T
Include file system type.
+.It Fl ,
+(Comma) Print sizes grouped and separated by thousands using the
+non-monetary separator returned by
+.Xr localeconv 3 ,
+typically a comma or period.
+If no locale is set, or the locale does not have a non-monetary separator, this
+option has no effect.
.El
.Sh ENVIRONMENT
.Bl -tag -width BLOCKSIZE
.It Ev BLOCKSIZE
-If the environment variable
-.Ev BLOCKSIZE
-is set, the block counts will be displayed in units of that size block.
+Specifies the units in which to report block counts.
+This uses
+.Xr getbsize 3 ,
+which allows units of bytes or numbers scaled with the letters
+.Em k
+(for multiples of 1024 bytes),
+.Em m
+(for multiples of 1048576 bytes) or
+.Em g
+(for gibibytes).
+The allowed range is 512 bytes to 1 GB.
+If the value is outside, it will be set to the appropriate limit.
.El
.Sh SEE ALSO
.Xr lsvfs 1 ,
-.Xr pstat 1 ,
.Xr quota 1 ,
-.Xr swapinfo 1 ,
.Xr fstatfs 2 ,
.Xr getfsstat 2 ,
.Xr statfs 2 ,
+.Xr getbsize 3 ,
.Xr getmntinfo 3 ,
+.Xr localeconv 3 ,
.Xr fstab 5 ,
.Xr mount 8 ,
-.Xr quot 8
+.Xr quot 8 .
+.Sh STANDARDS
+With the exception of most options,
+the
+.Nm
+utility conforms to
+.St -p1003.1-2004 ,
+which defines only the
+.Fl k , P
+and
+.Fl t
+options.
.Sh HISTORY
A
.Nm
@@ -180,3 +219,13 @@ flag is ignored if a file or file system is specified.
Also, if a mount
point is not accessible by the user, it is possible that the file system
information could be stale.
+.Pp
+The
+.Fl b
+and
+.Fl P
+options are identical.
+The former comes from the BSD tradition, and the latter is required
+for
+.St -p1003.1-2004
+conformity.
diff --git a/bin/df/df.c b/bin/df/df.c
index f865b8f1..3058da0 100644
--- a/bin/df/df.c
+++ b/bin/df/df.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <ufs/ufs/ufsmount.h>
#include <err.h>
#include <libutil.h>
+#include <locale.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -95,6 +96,7 @@ imax(int a, int b)
}
static int aflag = 0, cflag, hflag, iflag, kflag, lflag = 0, nflag, Tflag;
+static int thousands;
static struct ufs_args mdev;
int
@@ -111,12 +113,12 @@ main(int argc, char *argv[])
int ch, rv;
fstype = "ufs";
-
+ (void)setlocale(LC_ALL, "");
memset(&totalbuf, 0, sizeof(totalbuf));
totalbuf.f_bsize = DEV_BSIZE;
strlcpy(totalbuf.f_mntfromname, "total", MNAMELEN);
vfslist = NULL;
- while ((ch = getopt(argc, argv, "abcgHhiklmnPt:T")) != -1)
+ while ((ch = getopt(argc, argv, "abcgHhiklmnPt:T,")) != -1)
switch (ch) {
case 'a':
aflag = 1;
@@ -180,6 +182,9 @@ main(int argc, char *argv[])
case 'T':
Tflag = 1;
break;
+ case ',':
+ thousands = 1;
+ break;
case '?':
default:
usage();
@@ -388,16 +393,11 @@ prthumanvalinode(int64_t bytes)
/*
* Convert statfs returned file system size into BLOCKSIZE units.
- * Attempts to avoid overflow for large file systems.
*/
static intmax_t
fsbtoblk(int64_t num, uint64_t fsbs, u_long bs)
{
-
- if (fsbs != 0 && fsbs < bs)
- return (num / (intmax_t)(bs / fsbs));
- else
- return (num * (intmax_t)(fsbs / bs));
+ return (num * (intmax_t) fsbs / bs);
}
/*
@@ -410,10 +410,18 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
static int headerlen, timesthrough = 0;
static const char *header;
int64_t used, availblks, inodes;
+ const char *format;
if (++timesthrough == 1) {
mwp->mntfrom = imax(mwp->mntfrom, (int)strlen("Filesystem"));
mwp->fstype = imax(mwp->fstype, (int)strlen("Type"));
+ if (thousands) { /* make space for commas */
+ mwp->total += (mwp->total - 1) / 3;
+ mwp->used += (mwp->used - 1) / 3;
+ mwp->avail += (mwp->avail - 1) / 3;
+ mwp->iused += (mwp->iused - 1) / 3;
+ mwp->ifree += (mwp->ifree - 1) / 3;
+ }
if (hflag) {
header = " Size";
mwp->total = mwp->used = mwp->avail =
@@ -428,7 +436,7 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
(void)printf("%-*s", mwp->mntfrom, "Filesystem");
if (Tflag)
(void)printf(" %-*s", mwp->fstype, "Type");
- (void)printf(" %-*s %*s %*s Capacity", mwp->total, header,
+ (void)printf(" %*s %*s %*s Capacity", mwp->total, header,
mwp->used, "Used", mwp->avail, "Avail");
if (iflag) {
mwp->iused = imax(hflag ? 0 : mwp->iused,
@@ -440,6 +448,12 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
}
(void)printf(" Mounted on\n");
}
+ /* Check for 0 block size. Can this happen? */
+ if (sfsp->f_bsize == 0) {
+ warnx ("File system %s does not have a block size, assuming 512.",
+ sfsp->f_mntonname);
+ sfsp->f_bsize = 512;
+ }
(void)printf("%-*s", mwp->mntfrom, sfsp->f_mntfromname);
if (Tflag)
(void)printf(" %-*s", mwp->fstype, sfsp->f_fstypename);
@@ -448,7 +462,11 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
if (hflag) {
prthuman(sfsp, used);
} else {
- (void)printf(" %*jd %*jd %*jd",
+ if (thousands)
+ format = " %*j'd %*j'd %*j'd";
+ else
+ format = " %*jd %*jd %*jd";
+ (void)printf(format,
mwp->total, fsbtoblk(sfsp->f_blocks,
sfsp->f_bsize, blocksize),
mwp->used, fsbtoblk(used, sfsp->f_bsize, blocksize),
@@ -465,7 +483,11 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
prthumanvalinode(used);
prthumanvalinode(sfsp->f_ffree);
} else {
- (void)printf(" %*jd %*jd", mwp->iused, (intmax_t)used,
+ if (thousands)
+ format = " %*j'd %*j'd";
+ else
+ format = " %*jd %*jd";
+ (void)printf(format, mwp->iused, (intmax_t)used,
mwp->ifree, (intmax_t)sfsp->f_ffree);
}
(void)printf(" %4.0f%% ", inodes == 0 ? 100.0 :
@@ -542,7 +564,7 @@ usage(void)
{
(void)fprintf(stderr,
-"usage: df [-b | -g | -H | -h | -k | -m | -P] [-acilnT] [-t type] [file | filesystem ...]\n");
+"usage: df [-b | -g | -H | -h | -k | -m | -P] [-acilnT] [-t type] [-,] [file | filesystem ...]\n");
exit(EX_USAGE);
}
diff --git a/bin/mv/mv.c b/bin/mv/mv.c
index d33b28d..5147a2db 100644
--- a/bin/mv/mv.c
+++ b/bin/mv/mv.c
@@ -199,7 +199,7 @@ do_move(const char *from, const char *to)
} else if (iflg) {
(void)fprintf(stderr, "overwrite %s? %s", to, YESNO);
ask = 1;
- } else if (access(to, W_OK) && !stat(to, &sb)) {
+ } else if (access(to, W_OK) && !stat(to, &sb) && isatty(STDIN_FILENO)) {
strmode(sb.st_mode, modep);
(void)fprintf(stderr, "override %s%s%s/%s for %s? %s",
modep + 1, modep[9] == ' ' ? "" : " ",
diff --git a/bin/sh/input.c b/bin/sh/input.c
index b1f0475..2005a87 100644
--- a/bin/sh/input.c
+++ b/bin/sh/input.c
@@ -99,7 +99,6 @@ char *parsenextc; /* copy of parsefile->nextc */
MKINIT struct parsefile basepf; /* top level input file */
char basebuf[BUFSIZ + 1]; /* buffer for top level input file */
static struct parsefile *parsefile = &basepf; /* current input file */
-int init_editline = 0; /* editline library initialized? */
int whichprompt; /* 1 == PS1, 2 == PS2 */
EditLine *el; /* cookie for editline package */
diff --git a/bin/sh/input.h b/bin/sh/input.h
index 38be609..c8802f9 100644
--- a/bin/sh/input.h
+++ b/bin/sh/input.h
@@ -43,7 +43,6 @@
extern int plinno;
extern int parsenleft; /* number of characters left in input buffer */
extern char *parsenextc; /* next character in input buffer */
-extern int init_editline; /* 0 == not setup, 1 == OK, -1 == failed */
struct alias;
struct parsefile;
diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool-features.5 b/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
index f6e7938..999212c 100644
--- a/cddl/contrib/opensolaris/cmd/zpool/zpool-features.5
+++ b/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
@@ -22,7 +22,7 @@
.\" $FreeBSD$
.\"
.Dd Aug 28, 2012
-.Dt ZPOOL-FEATURES 8
+.Dt ZPOOL-FEATURES 7
.Os
.Sh NAME
.Nm zpool-features
diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool.8 b/cddl/contrib/opensolaris/cmd/zpool/zpool.8
index 88fc79b..d598a8c 100644
--- a/cddl/contrib/opensolaris/cmd/zpool/zpool.8
+++ b/cddl/contrib/opensolaris/cmd/zpool/zpool.8
@@ -567,7 +567,7 @@ Total size of the storage pool.
.It Sy unsupported@ Ns Ar feature_guid
Information about unsupported features that are enabled on the pool.
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details.
.It Sy used
Amount of storage space used within the pool.
@@ -717,7 +717,7 @@ which moves
.Ar feature_name
to the enabled state.
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details on feature states.
.It Sy listsnaps Ns = Ns Cm on No | Cm off
Controls whether information about snapshots associated with this pool is
@@ -915,7 +915,7 @@ with the
.Fl o
option.
See
-.Xr zpool-features 5
+.Xr zpool-features 7
for details about feature properties.
.It Xo
.Fl o Ar property Ns = Ns Ar value
@@ -1651,7 +1651,7 @@ Displays legacy
.Tn ZFS
versions supported by the current software.
See
-.Xr zpool-features.5
+.Xr zpool-features 7
for a description of feature flags features supported by the current software.
.El
.It Xo
@@ -1665,7 +1665,7 @@ Enables all supported features on the given pool.
Once this is done, the pool will no longer be accessible on systems that do
not support feature flags.
See
-.Xr zpool-features.5
+.Xr zpool-features 7
for details on compatability with system sthat support feature flags, but do
not support all features enabled on the pool.
.Bl -tag -width indent
@@ -1927,8 +1927,8 @@ Discarded approximately 29 seconds of transactions.
.Ed
.El
.Sh SEE ALSO
+.Xr zpool-features 7 ,
.Xr zfs 8
-.Xr zpool-features 5
.Sh AUTHORS
This manual page is a
.Xr mdoc 7
diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
index b57c816..3c2a625 100644
--- a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
+++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
@@ -345,7 +345,7 @@ usage(boolean_t requested)
(void) fprintf(fp, "YES disabled | enabled | active\n");
(void) fprintf(fp, gettext("\nThe feature@ properties must be "
- "appended with a feature name.\nSee zpool-features(5).\n"));
+ "appended with a feature name.\nSee zpool-features(7).\n"));
}
/*
@@ -4170,7 +4170,7 @@ status_callback(zpool_handle_t *zhp, void *data)
(void) printf(gettext("action: Enable all features using "
"'zpool upgrade'. Once this is done,\n\tthe pool may no "
"longer be accessible by software that does not support\n\t"
- "the features. See zpool-features(5) for details.\n"));
+ "the features. See zpool-features(7) for details.\n"));
break;
case ZPOOL_STATUS_UNSUP_FEAT_READ:
@@ -4630,7 +4630,7 @@ upgrade_list_disabled_cb(zpool_handle_t *zhp, void *arg)
"pool may become incompatible with "
"software\nthat does not support "
"the feature. See "
- "zpool-features(5) for "
+ "zpool-features(7) for "
"details.\n\n"));
(void) printf(gettext("POOL "
"FEATURE\n"));
diff --git a/cddl/sbin/zpool/Makefile b/cddl/sbin/zpool/Makefile
index 327f6dc..b9d44b6 100644
--- a/cddl/sbin/zpool/Makefile
+++ b/cddl/sbin/zpool/Makefile
@@ -5,7 +5,7 @@
.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
PROG= zpool
-MAN= zpool.8 zpool-features.5
+MAN= zpool.8 zpool-features.7
SRCS= zpool_main.c zpool_vdev.c zpool_iter.c zpool_util.c zfs_comutil.c
SRCS+= timestamp.c
diff --git a/contrib/atf/FREEBSD-Xlist b/contrib/atf/FREEBSD-Xlist
new file mode 100644
index 0000000..9d18c3c
--- /dev/null
+++ b/contrib/atf/FREEBSD-Xlist
@@ -0,0 +1,8 @@
+bootstrap/
+config.log
+config.status
+libtool
+Makefile
+stamp-h1
+*/*/.deps/
+*/.deps/
diff --git a/contrib/atf/FREEBSD-upgrade b/contrib/atf/FREEBSD-upgrade
new file mode 100644
index 0000000..45a4bf5
--- /dev/null
+++ b/contrib/atf/FREEBSD-upgrade
@@ -0,0 +1,28 @@
+$FreeBSD$
+
+atf
+
+The source code is hosted on GoogleCode as a subcomponent of the Kyua project:
+
+ http://code.google.com/p/kyua/downloads/list
+
+For the contrib directory, the sources were initially prepared like so:
+
+ ./configure --prefix=/ --exec-prefix=/usr --datarootdir=/usr/share
+
+For the contrib directory, files and directories were pruned by:
+
+sh -c 'for F in `cat FREEBSD-Xlist`; do rm -rf ./$F ; done'
+
+You may check if there are any new files that we don't need.
+
+The instructions for importing new release and merging to HEAD can be found
+at FreeBSD wiki:
+
+ http://wiki.freebsd.org/SubversionPrimer/VendorImports
+
+To make local changes to atf, simply patch and commit to the trunk
+branch (aka HEAD). Never make local changes on the vendor branch.
+
+gcooper@FreeBSD.org
+5-August-2012
diff --git a/contrib/atf/atf-c/macros.h b/contrib/atf/atf-c/macros.h
index 12f7488..7afe9e8 100644
--- a/contrib/atf/atf-c/macros.h
+++ b/contrib/atf/atf-c/macros.h
@@ -30,6 +30,8 @@
#if !defined(ATF_C_MACROS_H)
#define ATF_C_MACROS_H
+#include <string.h>
+
#include <atf-c/defs.h>
#include <atf-c/error.h>
#include <atf-c/tc.h>
diff --git a/contrib/atf/atf-run/requirements_test.cpp b/contrib/atf/atf-run/requirements_test.cpp
index ef72b41..6fe97a2 100644
--- a/contrib/atf/atf-run/requirements_test.cpp
+++ b/contrib/atf/atf-run/requirements_test.cpp
@@ -239,7 +239,8 @@ ATF_TEST_CASE_WITHOUT_HEAD(require_memory_not_enough);
ATF_TEST_CASE_BODY(require_memory_not_enough) {
atf::tests::vars_map metadata;
metadata["require.memory"] = "128t";
-#if defined(__APPLE__) || defined(__NetBSD__)
+#if defined(__APPLE__) || defined(__DragonFly__) || \
+ defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
do_check("Not enough memory; needed 140737488355328, available [0-9]*",
metadata);
#else
diff --git a/contrib/atf/atf-sh/atf_check_test.sh b/contrib/atf/atf-sh/atf_check_test.sh
index 398e517..010d0f1 100644
--- a/contrib/atf/atf-sh/atf_check_test.sh
+++ b/contrib/atf/atf-sh/atf_check_test.sh
@@ -54,7 +54,7 @@ atf_test_case expout_mismatch
expout_mismatch_head()
{
atf_set "descr" "Verifies that atf_check prints a diff of the" \
- "stdout and the expected stdout if the two do no" \
+ "stdout and the expected stdout of the two do not" \
"match"
}
expout_mismatch_body()
@@ -79,7 +79,7 @@ atf_test_case experr_mismatch
experr_mismatch_head()
{
atf_set "descr" "Verifies that atf_check prints a diff of the" \
- "stderr and the expected stderr if the two do no" \
+ "stderr and the expected stderr of the two do not" \
"match"
}
experr_mismatch_body()
diff --git a/contrib/atf/doc/atf-test-case.4 b/contrib/atf/doc/atf-test-case.4
index 15489ad..e1b2bf4 100644
--- a/contrib/atf/doc/atf-test-case.4
+++ b/contrib/atf/doc/atf-test-case.4
@@ -61,7 +61,7 @@ failures.
This body is only executed if the abstract conditions specified by the
header are met.
The
-.Em cleanup routine
+.Em cleanup
routine is a piece of code always executed after the body, regardless of
the exit status of the test case.
It can be used to undo side-effects of the test case.
diff --git a/contrib/bmake/ChangeLog b/contrib/bmake/ChangeLog
index 933e435..b17fcb5 100644
--- a/contrib/bmake/ChangeLog
+++ b/contrib/bmake/ChangeLog
@@ -1,3 +1,28 @@
+2012-11-11 Simon J. Gerraty <sjg@bad.crufty.net>
+
+ * Makefile.in (MAKE_VERSION): 20121111
+ fix generation of bmake.cat1
+
+2012-11-09 Simon J. Gerraty <sjg@bad.crufty.net>
+
+ * Makefile.in (MAKE_VERSION): 20121109
+ Merge with NetBSD make, pick up
+ o make.c: MakeBuildChild: return 0 so search continues if a
+ .ORDER dependency is detected.
+ o unit-tests/order: test the above
+
+2012-11-02 Simon J. Gerraty <sjg@bad.crufty.net>
+
+ * Makefile.in (MAKE_VERSION): 20121102
+ Merge with NetBSD make, pick up
+ o cond.c: allow cond_state[] to grow.
+ In meta mode with a very large tree, we can hit the limit
+ while processing dirdeps.
+
+2012-10-25 Simon J. Gerraty <sjg@bad.crufty.net>
+
+ * Makefile.in: we need to use ${srcdir} not ${.CURDIR}
+
2012-10-10 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile.in (MAKE_VERSION): 20121010
diff --git a/contrib/bmake/FILES b/contrib/bmake/FILES
index 397d3a2..e7c7861 100644
--- a/contrib/bmake/FILES
+++ b/contrib/bmake/FILES
@@ -110,6 +110,7 @@ unit-tests/modmisc
unit-tests/modorder
unit-tests/modts
unit-tests/modword
+unit-tests/order
unit-tests/phony-end
unit-tests/posix
unit-tests/qequals
diff --git a/contrib/bmake/Makefile.in b/contrib/bmake/Makefile.in
index 4cb55dd..7936d3b 100644
--- a/contrib/bmake/Makefile.in
+++ b/contrib/bmake/Makefile.in
@@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.56 2012/05/30 21:54:23 sjg Exp $
# @(#)Makefile 5.2 (Berkeley) 12/28/90
-# $Id: Makefile.in,v 1.174 2012/10/10 18:46:24 sjg Exp $
+# $Id: Makefile.in,v 1.178 2012/11/15 16:48:59 sjg Exp $
PROG= bmake
SRCS= arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \
@@ -21,7 +21,7 @@ srcdir= @srcdir@
CC?= @CC@
# Base version on src date
-MAKE_VERSION= 20121010
+MAKE_VERSION= 20121111
MACHINE=@machine@
MACHINE_ARCH=@machine_arch@
DEFAULT_SYS_PATH = @default_sys_path@
@@ -114,7 +114,7 @@ ${MAN}: make.1 my.history
@echo making ${PROG}.1
@sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \
-e '/^.Sh HISTORY/rmy.history' \
- -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${.CURDIR}/make.1 > $@
+ -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@
.endif
diff --git a/contrib/bmake/cond.c b/contrib/bmake/cond.c
index 6d0b965..a1c6705 100644
--- a/contrib/bmake/cond.c
+++ b/contrib/bmake/cond.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.64 2012/06/12 19:21:50 joerg Exp $ */
+/* $NetBSD: cond.c,v 1.67 2012/11/03 13:59:27 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.64 2012/06/12 19:21:50 joerg Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.67 2012/11/03 13:59:27 christos Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94";
#else
-__RCSID("$NetBSD: cond.c,v 1.64 2012/06/12 19:21:50 joerg Exp $");
+__RCSID("$NetBSD: cond.c,v 1.67 2012/11/03 13:59:27 christos Exp $");
#endif
#endif /* not lint */
#endif
@@ -1227,7 +1227,8 @@ do_Cond_EvalExpression(Boolean *value)
int
Cond_Eval(char *line)
{
- #define MAXIF 128 /* maximum depth of .if'ing */
+#define MAXIF 128 /* maximum depth of .if'ing */
+#define MAXIF_BUMP 32 /* how much to grow by */
enum if_states {
IF_ACTIVE, /* .if or .elif part active */
ELSE_ACTIVE, /* .else part active */
@@ -1235,7 +1236,8 @@ Cond_Eval(char *line)
SKIP_TO_ELSE, /* has been true, but not seen '.else' */
SKIP_TO_ENDIF /* nothing else to execute */
};
- static enum if_states cond_state[MAXIF + 1] = { IF_ACTIVE };
+ static enum if_states *cond_state = NULL;
+ static unsigned int max_if_depth = MAXIF;
const struct If *ifp;
Boolean isElif;
@@ -1244,7 +1246,10 @@ Cond_Eval(char *line)
enum if_states state;
level = PARSE_FATAL;
-
+ if (!cond_state) {
+ cond_state = bmake_malloc(max_if_depth * sizeof(*cond_state));
+ cond_state[0] = IF_ACTIVE;
+ }
/* skip leading character (the '.') and any whitespace */
for (line++; *line == ' ' || *line == '\t'; line++)
continue;
@@ -1261,8 +1266,6 @@ Cond_Eval(char *line)
}
/* Return state for previous conditional */
cond_depth--;
- if (cond_depth > MAXIF)
- return COND_SKIP;
return cond_state[cond_depth] <= ELSE_ACTIVE ? COND_PARSE : COND_SKIP;
}
@@ -1275,8 +1278,6 @@ Cond_Eval(char *line)
return COND_PARSE;
}
- if (cond_depth > MAXIF)
- return COND_SKIP;
state = cond_state[cond_depth];
switch (state) {
case SEARCH_FOR_ELIF:
@@ -1325,9 +1326,6 @@ Cond_Eval(char *line)
Parse_Error(level, "if-less elif");
return COND_PARSE;
}
- if (cond_depth > MAXIF)
- /* Error reported when we saw the .if ... */
- return COND_SKIP;
state = cond_state[cond_depth];
if (state == SKIP_TO_ENDIF || state == ELSE_ACTIVE) {
Parse_Error(PARSE_WARNING, "extra elif");
@@ -1341,10 +1339,15 @@ Cond_Eval(char *line)
}
} else {
/* Normal .if */
- if (cond_depth >= MAXIF) {
- cond_depth++;
- Parse_Error(PARSE_FATAL, "Too many nested if's. %d max.", MAXIF);
- return COND_SKIP;
+ if (cond_depth + 1 >= max_if_depth) {
+ /*
+ * This is rare, but not impossible.
+ * In meta mode, dirdeps.mk (only runs at level 0)
+ * can need more than the default.
+ */
+ max_if_depth += MAXIF_BUMP;
+ cond_state = bmake_realloc(cond_state, max_if_depth *
+ sizeof(*cond_state));
}
state = cond_state[cond_depth];
cond_depth++;
diff --git a/contrib/bmake/make.c b/contrib/bmake/make.c
index 4fa4ff9..7905f8c 100644
--- a/contrib/bmake/make.c
+++ b/contrib/bmake/make.c
@@ -1,4 +1,4 @@
-/* $NetBSD: make.c,v 1.87 2012/06/12 19:21:51 joerg Exp $ */
+/* $NetBSD: make.c,v 1.88 2012/11/09 18:53:05 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: make.c,v 1.87 2012/06/12 19:21:51 joerg Exp $";
+static char rcsid[] = "$NetBSD: make.c,v 1.88 2012/11/09 18:53:05 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: make.c,v 1.87 2012/06/12 19:21:51 joerg Exp $");
+__RCSID("$NetBSD: make.c,v 1.88 2012/11/09 18:53:05 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -1032,7 +1032,7 @@ MakeBuildChild(void *v_cn, void *toBeMade_next)
if (cn->order_pred && Lst_ForEach(cn->order_pred, MakeCheckOrder, 0)) {
/* Can't build this (or anything else in this child list) yet */
cn->made = DEFERRED;
- return 1;
+ return 0; /* but keep looking */
}
if (DEBUG(MAKE))
@@ -1055,7 +1055,7 @@ MakeBuildChild(void *v_cn, void *toBeMade_next)
return cn->type & OP_WAIT && cn->unmade > 0;
}
-/* When a .ORDER RHS node completes we do this on each LHS */
+/* When a .ORDER LHS node completes we do this on each RHS */
static int
MakeBuildParent(void *v_pn, void *toBeMade_next)
{
diff --git a/contrib/bmake/unit-tests/Makefile.in b/contrib/bmake/unit-tests/Makefile.in
index 4e3592d..e5bf9b2 100644
--- a/contrib/bmake/unit-tests/Makefile.in
+++ b/contrib/bmake/unit-tests/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.38 2012/06/19 23:38:48 sjg Exp $
+# $Id: Makefile.in,v 1.39 2012/11/09 19:16:10 sjg Exp $
#
-# $NetBSD: Makefile,v 1.34 2012/06/19 23:25:53 sjg Exp $
+# $NetBSD: Makefile,v 1.35 2012/11/09 19:08:28 sjg Exp $
#
# Unit tests for make(1)
# The main targets are:
@@ -40,6 +40,7 @@ SUBFILES= \
modorder \
modts \
modword \
+ order \
phony-end \
posix \
qequals \
@@ -52,6 +53,7 @@ SUBFILES= \
all: ${SUBFILES}
flags.doterror=
+flags.order=-j1
# the tests are actually done with sub-makes.
.PHONY: ${SUBFILES}
diff --git a/contrib/bmake/unit-tests/order b/contrib/bmake/unit-tests/order
new file mode 100644
index 0000000..175da47
--- /dev/null
+++ b/contrib/bmake/unit-tests/order
@@ -0,0 +1,20 @@
+# $NetBSD: order,v 1.1 2012/11/09 19:08:28 sjg Exp $
+
+# Test that .ORDER is handled correctly.
+# The explicit dependency the.o: the.h will make us examine the.h
+# the .ORDER will prevent us building it immediately,
+# we should then examine the.c rather than stop.
+
+all: the.o
+
+.ORDER: the.c the.h
+
+the.c the.h:
+ @echo Making $@
+
+.SUFFIXES: .o .c
+
+.c.o:
+ @echo Making $@ from $?
+
+the.o: the.h
diff --git a/contrib/bmake/unit-tests/test.exp b/contrib/bmake/unit-tests/test.exp
index 932d84e..368dc31 100644
--- a/contrib/bmake/unit-tests/test.exp
+++ b/contrib/bmake/unit-tests/test.exp
@@ -310,6 +310,9 @@ LIST:tw:C/ /,/g="one two three four five six"
LIST:tw:C/ /,/1g="one two three four five six"
LIST:tw:tW:C/ /,/="one,two three four five six"
LIST:tW:tw:C/ /,/="one two three four five six"
+Making the.c
+Making the.h
+Making the.o from the.h the.c
.TARGET="phony" .PREFIX="phony" .IMPSRC=""
.TARGET="all" .PREFIX="all" .IMPSRC=""
.TARGET="ok" .PREFIX="ok" .IMPSRC=""
diff --git a/contrib/gdb/gdb/frame.c b/contrib/gdb/gdb/frame.c
index a032c47..3650b7c 100644
--- a/contrib/gdb/gdb/frame.c
+++ b/contrib/gdb/gdb/frame.c
@@ -1846,6 +1846,23 @@ get_prev_frame (struct frame_info *this_frame)
return NULL;
}
+ /* Assume that the only way to get a zero PC is through something
+ like a SIGSEGV or a dummy frame, and hence that NORMAL frames
+ will never unwind a zero PC. */
+ if (this_frame->level > 0
+ && get_frame_type (this_frame) == NORMAL_FRAME
+ && get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME
+ && get_frame_pc (this_frame) == 0)
+ {
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, this_frame->prev);
+ fprintf_unfiltered (gdb_stdlog, " // zero PC \n");
+ }
+ return NULL;
+ }
+
/* Only try to do the unwind once. */
if (this_frame->prev_p)
{
diff --git a/contrib/libc++/include/__config b/contrib/libc++/include/__config
index 75b2206..2bbe1d9 100644
--- a/contrib/libc++/include/__config
+++ b/contrib/libc++/include/__config
@@ -415,11 +415,11 @@ template <unsigned> struct __static_assert_check {};
#endif
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
-#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_VISIBLE x { enum _
+#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_VISIBLE x { enum __lx
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
- _ __v_; \
- _LIBCPP_ALWAYS_INLINE x(_ __v) : __v_(__v) {} \
- _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<_>(__v)) {} \
+ __lx __v_; \
+ _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
+ _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
};
#else // _LIBCPP_HAS_NO_STRONG_ENUMS
@@ -427,6 +427,10 @@ template <unsigned> struct __static_assert_check {};
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
+#ifndef _LIBCPP_EXTERN_TEMPLATE
+#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
+#endif
+
#if __APPLE__ || __FreeBSD__ || _WIN32 || __sun__
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
#endif
diff --git a/contrib/libc++/include/__functional_base b/contrib/libc++/include/__functional_base
index 63aa41d..2385459 100644
--- a/contrib/libc++/include/__functional_base
+++ b/contrib/libc++/include/__functional_base
@@ -43,7 +43,7 @@ template <class _Tp>
struct __has_result_type
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::result_type* = 0);
public:
@@ -69,7 +69,7 @@ template <class _Tp>
struct __derives_from_unary_function
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
static __two __test(...);
template <class _Ap, class _Rp>
static unary_function<_Ap, _Rp>
@@ -83,7 +83,7 @@ template <class _Tp>
struct __derives_from_binary_function
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
static __two __test(...);
template <class _A1, class _A2, class _Rp>
static binary_function<_A1, _A2, _Rp>
diff --git a/contrib/libc++/include/__functional_base_03 b/contrib/libc++/include/__functional_base_03
index 6c6ce53..a1005bf 100644
--- a/contrib/libc++/include/__functional_base_03
+++ b/contrib/libc++/include/__functional_base_03
@@ -19,7 +19,7 @@ template <class _Tp>
struct __derives_from_unary_function
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
static __two __test(...);
template <class _Ap, class _Rp>
static unary_function<_Ap, _Rp>
@@ -33,7 +33,7 @@ template <class _Tp>
struct __derives_from_binary_function
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
static __two __test(...);
template <class _A1, class _A2, class _Rp>
static binary_function<_A1, _A2, _Rp>
@@ -943,7 +943,7 @@ template <class _Tp>
struct __has_type
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::type* = 0);
public:
diff --git a/contrib/libc++/include/__locale b/contrib/libc++/include/__locale
index e6c357f..4176720 100644
--- a/contrib/libc++/include/__locale
+++ b/contrib/libc++/include/__locale
@@ -254,8 +254,8 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
return static_cast<long>(__h);
}
-extern template class _LIBCPP_VISIBLE collate<char>;
-extern template class _LIBCPP_VISIBLE collate<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_VISIBLE collate<char>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_VISIBLE collate<wchar_t>)
// template <class CharT> class collate_byname;
@@ -1135,10 +1135,10 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
{
}
-extern template class codecvt_byname<char, char, mbstate_t>;
-extern template class codecvt_byname<wchar_t, char, mbstate_t>;
-extern template class codecvt_byname<char16_t, char, mbstate_t>;
-extern template class codecvt_byname<char32_t, char, mbstate_t>;
+_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char, char, mbstate_t>)
+_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<wchar_t, char, mbstate_t>)
+_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char16_t, char, mbstate_t>)
+_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char32_t, char, mbstate_t>)
_LIBCPP_VISIBLE void __throw_runtime_error(const char*);
diff --git a/contrib/libc++/include/__mutex_base b/contrib/libc++/include/__mutex_base
index 538e89b..e936ad3 100644
--- a/contrib/libc++/include/__mutex_base
+++ b/contrib/libc++/include/__mutex_base
@@ -287,14 +287,14 @@ swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) _NOEXCEPT
struct _LIBCPP_VISIBLE cv_status
{
- enum _ {
+ enum __lx {
no_timeout,
timeout
};
- _ __v_;
+ __lx __v_;
- _LIBCPP_INLINE_VISIBILITY cv_status(_ __v) : __v_(__v) {}
+ _LIBCPP_INLINE_VISIBILITY cv_status(__lx __v) : __v_(__v) {}
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
};
diff --git a/contrib/libc++/include/algorithm b/contrib/libc++/include/algorithm
index 1ce14b4..0f6107b 100644
--- a/contrib/libc++/include/algorithm
+++ b/contrib/libc++/include/algorithm
@@ -3782,39 +3782,39 @@ sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last, _Compare __comp)
#pragma warning( push )
#pragma warning( disable: 4231)
#endif // _MSC_VER
-extern template void __sort<__less<char>&, char*>(char*, char*, __less<char>&);
-extern template void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
-extern template void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
-extern template void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
-extern template void __sort<__less<short>&, short*>(short*, short*, __less<short>&);
-extern template void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
-extern template void __sort<__less<int>&, int*>(int*, int*, __less<int>&);
-extern template void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
-extern template void __sort<__less<long>&, long*>(long*, long*, __less<long>&);
-extern template void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
-extern template void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
-extern template void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&);
-extern template void __sort<__less<float>&, float*>(float*, float*, __less<float>&);
-extern template void __sort<__less<double>&, double*>(double*, double*, __less<double>&);
-extern template void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
-
-extern template bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&);
-extern template bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
-extern template bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
-extern template bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
-extern template bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&);
-extern template bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
-extern template bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&);
-extern template bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
-extern template bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&);
-extern template bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
-extern template bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
-extern template bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&);
-extern template bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&);
-extern template bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&);
-extern template bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
-
-extern template unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&);
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<char>&, char*>(char*, char*, __less<char>&))
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&))
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<short>&, short*>(short*, short*, __less<short>&))
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&))
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<int>&, int*>(int*, int*, __less<int>&))
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&))
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<long>&, long*>(long*, long*, __less<long>&))
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&))
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&))
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&))
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<float>&, float*>(float*, float*, __less<float>&))
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<double>&, double*>(double*, double*, __less<double>&))
+_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))
+
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&))
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&))
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&))
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&))
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&))
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&))
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&))
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&))
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&))
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&))
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&))
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&))
+_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))
+
+_LIBCPP_EXTERN_TEMPLATE(unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&))
#ifdef _MSC_VER
#pragma warning( pop )
#endif // _MSC_VER
diff --git a/contrib/libc++/include/cmath b/contrib/libc++/include/cmath
index a70bbf2..d3fbfe6 100644
--- a/contrib/libc++/include/cmath
+++ b/contrib/libc++/include/cmath
@@ -1202,7 +1202,9 @@ fdim(_A1 __x, _A2 __y) _NOEXCEPT
// fma
inline _LIBCPP_INLINE_VISIBILITY float fmaf(float __x, float __y, float __z) _NOEXCEPT {return (float)((double)__x*__y + __z);}
+#ifndef FP_FAST_FMAF
#define FP_FAST_FMAF
+#endif
using ::fma;
diff --git a/contrib/libc++/include/complex b/contrib/libc++/include/complex
index 6f88152..07d3754 100644
--- a/contrib/libc++/include/complex
+++ b/contrib/libc++/include/complex
@@ -1249,10 +1249,12 @@ acosh(const complex<_Tp>& __x)
if (isnan(__x.imag()))
return complex<_Tp>(abs(__x.real()), __x.imag());
if (isinf(__x.imag()))
+ {
if (__x.real() > 0)
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
else
return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
+ }
if (__x.real() < 0)
return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
diff --git a/contrib/libc++/include/condition_variable b/contrib/libc++/include/condition_variable
index 7d0b069..b1a50ee 100644
--- a/contrib/libc++/include/condition_variable
+++ b/contrib/libc++/include/condition_variable
@@ -163,7 +163,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void
condition_variable_any::notify_one() _NOEXCEPT
{
- {lock_guard<mutex> _(*__mut_);}
+ {lock_guard<mutex> __lx(*__mut_);}
__cv_.notify_one();
}
@@ -171,7 +171,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void
condition_variable_any::notify_all() _NOEXCEPT
{
- {lock_guard<mutex> _(*__mut_);}
+ {lock_guard<mutex> __lx(*__mut_);}
__cv_.notify_all();
}
@@ -188,8 +188,8 @@ condition_variable_any::wait(_Lock& __lock)
shared_ptr<mutex> __mut = __mut_;
unique_lock<mutex> __lk(*__mut);
__lock.unlock();
- unique_ptr<_Lock, __lock_external> __(&__lock);
- lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
+ unique_ptr<_Lock, __lock_external> __lxx(&__lock);
+ lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
__cv_.wait(__lk);
} // __mut_.unlock(), __lock.lock()
@@ -210,8 +210,8 @@ condition_variable_any::wait_until(_Lock& __lock,
shared_ptr<mutex> __mut = __mut_;
unique_lock<mutex> __lk(*__mut);
__lock.unlock();
- unique_ptr<_Lock, __lock_external> __(&__lock);
- lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
+ unique_ptr<_Lock, __lock_external> __lxx(&__lock);
+ lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
return __cv_.wait_until(__lk, __t);
} // __mut_.unlock(), __lock.lock()
diff --git a/contrib/libc++/include/cstddef b/contrib/libc++/include/cstddef
index 4b01be2..2467089 100644
--- a/contrib/libc++/include/cstddef
+++ b/contrib/libc++/include/cstddef
@@ -58,12 +58,12 @@ typedef long double max_align_t;
struct _LIBCPP_VISIBLE nullptr_t
{
- void* _;
+ void* __lx;
struct __nat {int __for_bool_;};
- _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : _(0) {}
- _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : _(0) {}
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
diff --git a/contrib/libc++/include/ext/__hash b/contrib/libc++/include/ext/__hash
index 8e9635d..21500e8 100644
--- a/contrib/libc++/include/ext/__hash
+++ b/contrib/libc++/include/ext/__hash
@@ -43,4 +43,4 @@ template <> struct _LIBCPP_VISIBLE hash<char *>
};
}
-#endif _LIBCPP_EXT_HASH
+#endif // _LIBCPP_EXT_HASH
diff --git a/contrib/libc++/include/future b/contrib/libc++/include/future
index 39475bd..cf552a9 100644
--- a/contrib/libc++/include/future
+++ b/contrib/libc++/include/future
@@ -391,7 +391,7 @@ struct _LIBCPP_VISIBLE is_error_code_enum<future_errc> : public true_type {};
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
template <>
-struct _LIBCPP_VISIBLE is_error_code_enum<future_errc::_> : public true_type { };
+struct _LIBCPP_VISIBLE is_error_code_enum<future_errc::__lx> : public true_type { };
#endif
//enum class launch
diff --git a/contrib/libc++/include/ios b/contrib/libc++/include/ios
index 7e489e3..1474deb 100644
--- a/contrib/libc++/include/ios
+++ b/contrib/libc++/include/ios
@@ -384,7 +384,7 @@ struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { };
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
template <>
-struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::_> : public true_type { };
+struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::__lx> : public true_type { };
#endif
_LIBCPP_VISIBLE
diff --git a/contrib/libc++/include/istream b/contrib/libc++/include/istream
index 72b2004..dc1c52b 100644
--- a/contrib/libc++/include/istream
+++ b/contrib/libc++/include/istream
@@ -1189,7 +1189,11 @@ basic_istream<_CharT, _Traits>::peek()
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __sen(*this, true);
if (__sen)
+ {
__r = this->rdbuf()->sgetc();
+ if (traits_type::eq_int_type(__r, traits_type::eof()))
+ this->setstate(ios_base::eofbit);
+ }
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -1706,9 +1710,9 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
return __is;
}
-extern template class basic_istream<char>;
-extern template class basic_istream<wchar_t>;
-extern template class basic_iostream<char>;
+_LIBCPP_EXTERN_TEMPLATE(class basic_istream<char>)
+_LIBCPP_EXTERN_TEMPLATE(class basic_istream<wchar_t>)
+_LIBCPP_EXTERN_TEMPLATE(class basic_iostream<char>)
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libc++/include/iterator b/contrib/libc++/include/iterator
index 5747504..bcbf3ae 100644
--- a/contrib/libc++/include/iterator
+++ b/contrib/libc++/include/iterator
@@ -337,7 +337,7 @@ template <class _Tp>
struct __has_iterator_category
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::iterator_category* = 0);
public:
diff --git a/contrib/libc++/include/locale b/contrib/libc++/include/locale
index 3e8d9a8..976c4cf 100644
--- a/contrib/libc++/include/locale
+++ b/contrib/libc++/include/locale
@@ -692,8 +692,8 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
return 0;
}
-extern template struct __num_get<char>;
-extern template struct __num_get<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(struct __num_get<char>)
+_LIBCPP_EXTERN_TEMPLATE(struct __num_get<wchar_t>)
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE num_get
@@ -1314,8 +1314,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
return __b;
}
-extern template class num_get<char>;
-extern template class num_get<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class num_get<char>)
+_LIBCPP_EXTERN_TEMPLATE(class num_get<wchar_t>)
struct __num_put_base
{
@@ -1464,8 +1464,8 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
__op = __ob + (__np - __nb);
}
-extern template struct __num_put<char>;
-extern template struct __num_put<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(struct __num_put<char>)
+_LIBCPP_EXTERN_TEMPLATE(struct __num_put<wchar_t>)
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE num_put
@@ -1938,8 +1938,8 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
return __pad_and_output(__s, __o, __op, __oe, __iob, __fl);
}
-extern template class num_put<char>;
-extern template class num_put<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class num_put<char>)
+_LIBCPP_EXTERN_TEMPLATE(class num_put<wchar_t>)
template <class _CharT, class _InputIterator>
_LIBCPP_HIDDEN
@@ -2605,8 +2605,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
return __b;
}
-extern template class time_get<char>;
-extern template class time_get<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class time_get<char>)
+_LIBCPP_EXTERN_TEMPLATE(class time_get<wchar_t>)
class __time_get
{
@@ -2688,8 +2688,8 @@ private:
virtual const string_type& __X() const {return this->__X_;}
};
-extern template class time_get_byname<char>;
-extern template class time_get_byname<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class time_get_byname<char>)
+_LIBCPP_EXTERN_TEMPLATE(class time_get_byname<wchar_t>)
class __time_put
{
@@ -2801,8 +2801,8 @@ time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&,
return _VSTD::copy(__nb, __ne, __s);
}
-extern template class time_put<char>;
-extern template class time_put<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class time_put<char>)
+_LIBCPP_EXTERN_TEMPLATE(class time_put<wchar_t>)
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE time_put_byname
@@ -2822,8 +2822,8 @@ protected:
~time_put_byname() {}
};
-extern template class time_put_byname<char>;
-extern template class time_put_byname<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class time_put_byname<char>)
+_LIBCPP_EXTERN_TEMPLATE(class time_put_byname<wchar_t>)
// money_base
@@ -2885,10 +2885,10 @@ template <class _CharT, bool _International>
locale::id
moneypunct<_CharT, _International>::id;
-extern template class moneypunct<char, false>;
-extern template class moneypunct<char, true>;
-extern template class moneypunct<wchar_t, false>;
-extern template class moneypunct<wchar_t, true>;
+_LIBCPP_EXTERN_TEMPLATE(class moneypunct<char, false>)
+_LIBCPP_EXTERN_TEMPLATE(class moneypunct<char, true>)
+_LIBCPP_EXTERN_TEMPLATE(class moneypunct<wchar_t, false>)
+_LIBCPP_EXTERN_TEMPLATE(class moneypunct<wchar_t, true>)
// moneypunct_byname
@@ -2942,10 +2942,10 @@ template<> void moneypunct_byname<char, true>::init(const char*);
template<> void moneypunct_byname<wchar_t, false>::init(const char*);
template<> void moneypunct_byname<wchar_t, true>::init(const char*);
-extern template class moneypunct_byname<char, false>;
-extern template class moneypunct_byname<char, true>;
-extern template class moneypunct_byname<wchar_t, false>;
-extern template class moneypunct_byname<wchar_t, true>;
+_LIBCPP_EXTERN_TEMPLATE(class moneypunct_byname<char, false>)
+_LIBCPP_EXTERN_TEMPLATE(class moneypunct_byname<char, true>)
+_LIBCPP_EXTERN_TEMPLATE(class moneypunct_byname<wchar_t, false>)
+_LIBCPP_EXTERN_TEMPLATE(class moneypunct_byname<wchar_t, true>)
// money_get
@@ -3001,8 +3001,8 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc,
}
}
-extern template class __money_get<char>;
-extern template class __money_get<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class __money_get<char>)
+_LIBCPP_EXTERN_TEMPLATE(class __money_get<wchar_t>)
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE money_get
@@ -3382,8 +3382,8 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
return __b;
}
-extern template class money_get<char>;
-extern template class money_get<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class money_get<char>)
+_LIBCPP_EXTERN_TEMPLATE(class money_get<wchar_t>)
// money_put
@@ -3557,8 +3557,8 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
__mi = __mb;
}
-extern template class __money_put<char>;
-extern template class __money_put<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class __money_put<char>)
+_LIBCPP_EXTERN_TEMPLATE(class __money_put<wchar_t>)
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE money_put
@@ -3714,8 +3714,8 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
}
-extern template class money_put<char>;
-extern template class money_put<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class money_put<char>)
+_LIBCPP_EXTERN_TEMPLATE(class money_put<wchar_t>)
// messages
@@ -3824,8 +3824,8 @@ messages<_CharT>::do_close(catalog __c) const
#endif // !_WIN32
}
-extern template class messages<char>;
-extern template class messages<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class messages<char>)
+_LIBCPP_EXTERN_TEMPLATE(class messages<wchar_t>)
template <class _CharT>
class _LIBCPP_VISIBLE messages_byname
@@ -3848,8 +3848,8 @@ protected:
~messages_byname() {}
};
-extern template class messages_byname<char>;
-extern template class messages_byname<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class messages_byname<char>)
+_LIBCPP_EXTERN_TEMPLATE(class messages_byname<wchar_t>)
template<class _Codecvt, class _Elem = wchar_t,
class _Wide_alloc = allocator<_Elem>,
diff --git a/contrib/libc++/include/memory b/contrib/libc++/include/memory
index fe5dd0c..4c12ad9 100644
--- a/contrib/libc++/include/memory
+++ b/contrib/libc++/include/memory
@@ -694,7 +694,7 @@ template <class _Tp>
struct __has_element_type
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::element_type* = 0);
public:
@@ -782,7 +782,7 @@ template <class _Tp>
struct __has_difference_type
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::difference_type* = 0);
public:
@@ -805,7 +805,7 @@ template <class _Tp, class _Up>
struct __has_rebind
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Xp> static __two __test(...);
template <class _Xp> static char __test(typename _Xp::template rebind<_Up>* = 0);
public:
@@ -998,7 +998,7 @@ template <class _Tp>
struct __has_const_pointer
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::const_pointer* = 0);
public:
@@ -1025,7 +1025,7 @@ template <class _Tp>
struct __has_void_pointer
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::void_pointer* = 0);
public:
@@ -1052,7 +1052,7 @@ template <class _Tp>
struct __has_const_void_pointer
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::const_void_pointer* = 0);
public:
@@ -1095,7 +1095,7 @@ template <class _Tp>
struct __has_size_type
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::size_type* = 0);
public:
@@ -1118,7 +1118,7 @@ template <class _Tp>
struct __has_propagate_on_container_copy_assignment
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::propagate_on_container_copy_assignment* = 0);
public:
@@ -1141,7 +1141,7 @@ template <class _Tp>
struct __has_propagate_on_container_move_assignment
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::propagate_on_container_move_assignment* = 0);
public:
@@ -1164,7 +1164,7 @@ template <class _Tp>
struct __has_propagate_on_container_swap
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::propagate_on_container_swap* = 0);
public:
@@ -1187,7 +1187,7 @@ template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
struct __has_rebind_other
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Xp> static __two __test(...);
template <class _Xp> static char __test(typename _Xp::template rebind<_Up>::other* = 0);
public:
@@ -5268,7 +5268,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
class __sp_mut
{
- void* _;
+ void* __lx;
public:
void lock() _NOEXCEPT;
void unlock() _NOEXCEPT;
@@ -5395,17 +5395,17 @@ atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v
//enum class
struct _LIBCPP_VISIBLE pointer_safety
{
- enum _
+ enum __lx
{
relaxed,
preferred,
strict
};
- _ __v_;
+ __lx __v_;
_LIBCPP_INLINE_VISIBILITY
- pointer_safety(_ __v) : __v_(__v) {}
+ pointer_safety(__lx __v) : __v_(__v) {}
_LIBCPP_INLINE_VISIBILITY
operator int() const {return __v_;}
};
diff --git a/contrib/libc++/include/ostream b/contrib/libc++/include/ostream
index b135ddb..9d26a41 100644
--- a/contrib/libc++/include/ostream
+++ b/contrib/libc++/include/ostream
@@ -1287,8 +1287,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
}
-extern template class basic_ostream<char>;
-extern template class basic_ostream<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class basic_ostream<char>)
+_LIBCPP_EXTERN_TEMPLATE(class basic_ostream<wchar_t>)
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libc++/include/random b/contrib/libc++/include/random
index a1553f1..d838289 100644
--- a/contrib/libc++/include/random
+++ b/contrib/libc++/include/random
@@ -1991,7 +1991,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left);
__os.fill(__os.widen(' '));
return __os << __x.__x_;
@@ -2003,7 +2003,7 @@ basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
{
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
_UIntType __t;
__is >> __t;
@@ -2377,7 +2377,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left);
_CharT __sp = __os.widen(' ');
__os.fill(__sp);
@@ -2398,7 +2398,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x)
{
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
_UI __t[_Np];
for (size_t __i = 0; __i < _Np; ++__i)
@@ -2684,7 +2684,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left);
_CharT __sp = __os.widen(' ');
__os.fill(__sp);
@@ -2703,7 +2703,7 @@ basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x)
{
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
_UI __t[_Rp+1];
for (size_t __i = 0; __i < _Rp+1; ++__i)
@@ -2859,7 +2859,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const discard_block_engine<_Eng, _Pp, _Rp>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left);
_CharT __sp = __os.widen(' ');
__os.fill(__sp);
@@ -2872,7 +2872,7 @@ basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
discard_block_engine<_Eng, _Pp, _Rp>& __x)
{
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
_Eng __e;
int __n;
@@ -3340,7 +3340,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const shuffle_order_engine<_Eng, _Kp>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left);
_CharT __sp = __os.widen(' ');
__os.fill(__sp);
@@ -3357,7 +3357,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
shuffle_order_engine<_Eng, _Kp>& __x)
{
typedef typename shuffle_order_engine<_Eng, _Kp>::result_type result_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
_Eng __e;
result_type _Vp[_Kp+1];
@@ -3561,7 +3561,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const uniform_int_distribution<_IT>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left);
_CharT __sp = __os.widen(' ');
__os.fill(__sp);
@@ -3576,7 +3576,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef uniform_int_distribution<_IT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
result_type __a;
result_type __b;
@@ -3682,7 +3682,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const uniform_real_distribution<_RT>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
_CharT __sp = __os.widen(' ');
@@ -3698,7 +3698,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef uniform_real_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
result_type __a;
result_type __b;
@@ -3793,7 +3793,7 @@ template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
_CharT __sp = __os.widen(' ');
@@ -3807,7 +3807,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x)
{
typedef bernoulli_distribution _Eng;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
double __p;
__is >> __p;
@@ -3955,7 +3955,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const binomial_distribution<_IntType>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
_CharT __sp = __os.widen(' ');
@@ -3971,7 +3971,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef binomial_distribution<_IntType> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
result_type __t;
double __p;
@@ -4073,7 +4073,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const exponential_distribution<_RealType>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
return __os << __x.lambda();
@@ -4087,7 +4087,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef exponential_distribution<_RealType> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
result_type __lambda;
__is >> __lambda;
@@ -4227,7 +4227,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const normal_distribution<_RT>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
_CharT __sp = __os.widen(' ');
@@ -4246,7 +4246,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef normal_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
result_type __mean;
result_type __stddev;
@@ -4598,7 +4598,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const poisson_distribution<_IntType>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
return __os << __x.mean();
@@ -4611,7 +4611,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
{
typedef poisson_distribution<_IntType> _Eng;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
double __mean;
__is >> __mean;
@@ -4709,7 +4709,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const weibull_distribution<_RT>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
_CharT __sp = __os.widen(' ');
@@ -4726,7 +4726,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef weibull_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
result_type __a;
result_type __b;
@@ -4828,7 +4828,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const extreme_value_distribution<_RT>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
_CharT __sp = __os.widen(' ');
@@ -4845,7 +4845,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef extreme_value_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
result_type __a;
result_type __b;
@@ -5000,7 +5000,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const gamma_distribution<_RT>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
_CharT __sp = __os.widen(' ');
@@ -5017,7 +5017,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef gamma_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
result_type __alpha;
result_type __beta;
@@ -5136,7 +5136,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const negative_binomial_distribution<_IntType>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
_CharT __sp = __os.widen(' ');
@@ -5152,7 +5152,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef negative_binomial_distribution<_IntType> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
result_type __k;
double __p;
@@ -5242,7 +5242,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const geometric_distribution<_IntType>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
return __os << __x.p();
@@ -5255,7 +5255,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
{
typedef geometric_distribution<_IntType> _Eng;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
double __p;
__is >> __p;
@@ -5346,7 +5346,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const chi_squared_distribution<_RT>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
__os << __x.n();
@@ -5361,7 +5361,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef chi_squared_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
result_type __n;
__is >> __n;
@@ -5466,7 +5466,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const cauchy_distribution<_RT>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
_CharT __sp = __os.widen(' ');
@@ -5483,7 +5483,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef cauchy_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
result_type __a;
result_type __b;
@@ -5588,7 +5588,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const fisher_f_distribution<_RT>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
_CharT __sp = __os.widen(' ');
@@ -5605,7 +5605,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef fisher_f_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
result_type __m;
result_type __n;
@@ -5704,7 +5704,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const student_t_distribution<_RT>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
__os << __x.n();
@@ -5719,7 +5719,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef student_t_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
result_type __n;
__is >> __n;
@@ -5927,7 +5927,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const discrete_distribution<_IT>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
_CharT __sp = __os.widen(' ');
@@ -5947,7 +5947,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef discrete_distribution<_IT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
size_t __n;
__is >> __n;
@@ -6231,7 +6231,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const piecewise_constant_distribution<_RT>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
_CharT __sp = __os.widen(' ');
@@ -6259,7 +6259,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef piecewise_constant_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
size_t __n;
__is >> __n;
@@ -6571,7 +6571,7 @@ basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const piecewise_linear_distribution<_RT>& __x)
{
- __save_flags<_CharT, _Traits> _(__os);
+ __save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
ios_base::scientific);
_CharT __sp = __os.widen(' ');
@@ -6599,7 +6599,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
typedef piecewise_linear_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
- __save_flags<_CharT, _Traits> _(__is);
+ __save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
size_t __n;
__is >> __n;
diff --git a/contrib/libc++/include/streambuf b/contrib/libc++/include/streambuf
index e34ad23..d688024 100644
--- a/contrib/libc++/include/streambuf
+++ b/contrib/libc++/include/streambuf
@@ -553,11 +553,11 @@ basic_streambuf<_CharT, _Traits>::overflow(int_type)
return traits_type::eof();
}
-extern template class basic_streambuf<char>;
-extern template class basic_streambuf<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class basic_streambuf<char>)
+_LIBCPP_EXTERN_TEMPLATE(class basic_streambuf<wchar_t>)
-extern template class basic_ios<char>;
-extern template class basic_ios<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class basic_ios<char>)
+_LIBCPP_EXTERN_TEMPLATE(class basic_ios<wchar_t>)
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libc++/include/string b/contrib/libc++/include/string
index 89a00e5..5bf42f0 100644
--- a/contrib/libc++/include/string
+++ b/contrib/libc++/include/string
@@ -1031,7 +1031,7 @@ __basic_string_common<__b>::__throw_out_of_range() const
#pragma warning( push )
#pragma warning( disable: 4231 )
#endif // _MSC_VER
-extern template class __basic_string_common<true>;
+_LIBCPP_EXTERN_TEMPLATE(class __basic_string_common<true>)
#ifdef _MSC_VER
#pragma warning( pop )
#endif // _MSC_VER
@@ -1094,14 +1094,14 @@ private:
union
{
unsigned char __size_;
- value_type _;
+ value_type __lx;
};
value_type __data_[__min_cap];
};
- union _{__long _; __short __;};
+ union __lx{__long __lx; __short __lxx;};
- enum {__n_words = sizeof(_) / sizeof(size_type)};
+ enum {__n_words = sizeof(__lx) / sizeof(size_type)};
struct __raw
{
@@ -3975,8 +3975,8 @@ getline(basic_istream<_CharT, _Traits>&& __is,
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-extern template class basic_string<char>;
-extern template class basic_string<wchar_t>;
+_LIBCPP_EXTERN_TEMPLATE(class basic_string<char>)
+_LIBCPP_EXTERN_TEMPLATE(class basic_string<wchar_t>)
extern template
string
diff --git a/contrib/libc++/include/system_error b/contrib/libc++/include/system_error
index 9f7e4e9..cbc52fb 100644
--- a/contrib/libc++/include/system_error
+++ b/contrib/libc++/include/system_error
@@ -350,7 +350,7 @@ struct _LIBCPP_VISIBLE is_error_condition_enum<errc>
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
template <>
-struct _LIBCPP_VISIBLE is_error_condition_enum<errc::_>
+struct _LIBCPP_VISIBLE is_error_condition_enum<errc::__lx>
: true_type { };
#endif
diff --git a/contrib/libc++/include/tuple b/contrib/libc++/include/tuple
index 65af3eb..3fa6730 100644
--- a/contrib/libc++/include/tuple
+++ b/contrib/libc++/include/tuple
@@ -142,7 +142,7 @@ template <class _Tp>
struct __has_allocator_type
{
private:
- struct __two {char _; char __;};
+ struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::allocator_type* = 0);
public:
diff --git a/contrib/libc++/include/type_traits b/contrib/libc++/include/type_traits
index f74b778..26c37df 100644
--- a/contrib/libc++/include/type_traits
+++ b/contrib/libc++/include/type_traits
@@ -156,7 +156,7 @@ template <class _If, class _Then>
template <bool, class _Tp = void> struct _LIBCPP_VISIBLE enable_if {};
template <class _Tp> struct _LIBCPP_VISIBLE enable_if<true, _Tp> {typedef _Tp type;};
-struct __two {char _[2];};
+struct __two {char __lx[2];};
// helper class:
@@ -754,12 +754,12 @@ template <class _Tp>
struct __is_empty1
: public _Tp
{
- double _;
+ double __lx;
};
struct __is_empty2
{
- double _;
+ double __lx;
};
template <class _Tp, bool = is_class<_Tp>::value>
@@ -811,7 +811,7 @@ template <class _Tp> struct _LIBCPP_VISIBLE has_virtual_destructor
// alignment_of
-template <class _Tp> struct __alignment_of {_Tp _;};
+template <class _Tp> struct __alignment_of {_Tp __lx;};
template <class _Tp> struct _LIBCPP_VISIBLE alignment_of
: public integral_constant<size_t, __alignof__(__alignment_of<typename remove_all_extents<_Tp>::type>)> {};
@@ -842,8 +842,8 @@ struct __align_type
typedef _Tp type;
};
-struct __struct_double {long double _;};
-struct __struct_double4 {double _[4];};
+struct __struct_double {long double __lx;};
+struct __struct_double4 {double __lx[4];};
typedef
__type_list<__align_type<unsigned char>,
@@ -918,7 +918,7 @@ struct _LIBCPP_VISIBLE aligned_storage<_Len, n>\
{\
struct _ALIGNAS(n) type\
{\
- unsigned char _[_Len];\
+ unsigned char __lx[_Len];\
};\
}
@@ -1771,8 +1771,10 @@ class _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1, _A2)>
// main is_constructible test
+template<typename, typename T> struct __select_2nd { typedef T type; };
+
template <class _Tp, class ..._Args>
-decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...)), true_type())
+typename __select_2nd<decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...))), true_type>::type
__is_constructible_test(_Tp&&, _Args&& ...);
template <class ..._Args>
@@ -1809,15 +1811,15 @@ struct __is_constructible<true, _Tp>
template <class _Tp>
struct __is_constructible_ref
{
- true_type static __(_Tp);
- false_type static __(...);
+ true_type static __lxx(_Tp);
+ false_type static __lxx(...);
};
template <class _Tp, class _A0>
struct __is_constructible<true, _Tp, _A0>
: public common_type
<
- decltype(__is_constructible_ref<_Tp>::__(declval<_A0>()))
+ decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>()))
>::type
{};
diff --git a/contrib/libc++/include/utility b/contrib/libc++/include/utility
index df693ec..514ce17 100644
--- a/contrib/libc++/include/utility
+++ b/contrib/libc++/include/utility
@@ -460,8 +460,6 @@ make_pair(_T1 __x, _T2 __y)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
template <class _T1, class _T2>
class _LIBCPP_VISIBLE tuple_size<pair<_T1, _T2> >
: public integral_constant<size_t, 2> {};
@@ -580,8 +578,6 @@ get(pair<_T1, _T2>&& __p) _NOEXCEPT
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_UTILITY
diff --git a/contrib/libc++/include/valarray b/contrib/libc++/include/valarray
index 4091d0f..c56dd12 100644
--- a/contrib/libc++/include/valarray
+++ b/contrib/libc++/include/valarray
@@ -4770,9 +4770,9 @@ end(const valarray<_Tp>& __v)
return __v.__end_;
}
-extern template valarray<size_t>::valarray(size_t);
-extern template valarray<size_t>::~valarray();
-extern template void valarray<size_t>::resize(size_t, size_t);
+_LIBCPP_EXTERN_TEMPLATE(valarray<size_t>::valarray(size_t))
+_LIBCPP_EXTERN_TEMPLATE(valarray<size_t>::~valarray())
+_LIBCPP_EXTERN_TEMPLATE(void valarray<size_t>::resize(size_t, size_t))
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libc++/include/vector b/contrib/libc++/include/vector
index ee71435..0c28068 100644
--- a/contrib/libc++/include/vector
+++ b/contrib/libc++/include/vector
@@ -313,7 +313,7 @@ __vector_base_common<__b>::__throw_out_of_range() const
#pragma warning( push )
#pragma warning( disable: 4231 )
#endif // _MSC_VER
-extern template class __vector_base_common<true>;
+_LIBCPP_EXTERN_TEMPLATE(class __vector_base_common<true>)
#ifdef _MSC_VER
#pragma warning( pop )
#endif // _MSC_VER
diff --git a/contrib/libc++/src/memory.cpp b/contrib/libc++/src/memory.cpp
index 3884a2b..14084a5 100644
--- a/contrib/libc++/src/memory.cpp
+++ b/contrib/libc++/src/memory.cpp
@@ -125,14 +125,14 @@ static const std::size_t __sp_mut_count = 16;
static mutex mut_back[__sp_mut_count];
_LIBCPP_CONSTEXPR __sp_mut::__sp_mut(void* p) _NOEXCEPT
- : _(p)
+ : __lx(p)
{
}
void
__sp_mut::lock() _NOEXCEPT
{
- mutex& m = *static_cast<mutex*>(_);
+ mutex& m = *static_cast<mutex*>(__lx);
unsigned count = 0;
while (!m.try_lock())
{
@@ -148,7 +148,7 @@ __sp_mut::lock() _NOEXCEPT
void
__sp_mut::unlock() _NOEXCEPT
{
- static_cast<mutex*>(_)->unlock();
+ static_cast<mutex*>(__lx)->unlock();
}
__sp_mut&
diff --git a/contrib/tzdata/africa b/contrib/tzdata/africa
index 1c6e520..54c7a1e 100644
--- a/contrib/tzdata/africa
+++ b/contrib/tzdata/africa
@@ -4,7 +4,7 @@
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
-# tz@elsie.nci.nih.gov for general use in the future).
+# tz@iana.org for general use in the future).
# From Paul Eggert (2006-03-22):
#
@@ -424,6 +424,20 @@ Zone Africa/Monrovia -0:43:08 - LMT 1882
# Libya
+# From Even Scharning (2012-11-10):
+# Libya set their time one hour back at 02:00 on Saturday November 10.
+# http://www.libyaherald.com/2012/11/04/clocks-to-go-back-an-hour-on-saturday/
+# Here is an official source [in Arabic]: http://ls.ly/fb6Yc
+#
+# Steffen Thorsen forwarded a translation (2012-11-10) in
+# http://mm.icann.org/pipermail/tz/2012-November/018451.html
+#
+# From Tim Parenti (2012-11-11):
+# Treat the 2012-11-10 change as a zone change from UTC+2 to UTC+1.
+# The DST rules planned for 2013 and onward roughly mirror those of Europe
+# (either two days before them or five days after them, so as to fall on
+# lastFri instead of lastSun).
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Libya 1951 only - Oct 14 2:00 1:00 S
Rule Libya 1952 only - Jan 1 0:00 0 -
@@ -438,17 +452,21 @@ Rule Libya 1986 only - Apr 4 0:00 1:00 S
Rule Libya 1986 only - Oct 3 0:00 0 -
Rule Libya 1987 1989 - Apr 1 0:00 1:00 S
Rule Libya 1987 1989 - Oct 1 0:00 0 -
+Rule Libya 1997 only - Apr 4 0:00 1:00 S
+Rule Libya 1997 only - Oct 4 0:00 0 -
+Rule Libya 2013 max - Mar lastFri 1:00 1:00 S
+Rule Libya 2013 max - Oct lastFri 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Tripoli 0:52:44 - LMT 1920
1:00 Libya CE%sT 1959
2:00 - EET 1982
1:00 Libya CE%sT 1990 May 4
-# The following entries are from Shanks & Pottenger;
+# The 1996 and 1997 entries are from Shanks & Pottenger;
# the IATA SSIM data contain some obvious errors.
2:00 - EET 1996 Sep 30
- 1:00 - CET 1997 Apr 4
- 1:00 1:00 CEST 1997 Oct 4
- 2:00 - EET
+ 1:00 Libya CE%sT 1997 Oct 4
+ 2:00 - EET 2012 Nov 10 2:00
+ 1:00 Libya CE%sT
# Madagascar
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
diff --git a/contrib/tzdata/asia b/contrib/tzdata/asia
index 25d161d..d5562c8 100644
--- a/contrib/tzdata/asia
+++ b/contrib/tzdata/asia
@@ -4,7 +4,7 @@
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
-# tz@elsie.nci.nih.gov for general use in the future).
+# tz@iana.org for general use in the future).
# From Paul Eggert (2006-03-22):
#
@@ -1199,7 +1199,6 @@ Rule Zion 2012 only - Mar Fri>=26 2:00 1:00 D
Rule Zion 2012 only - Sep 23 2:00 0 S
# From Ephraim Silverberg (2012-10-18):
-
# Yesterday, the Interior Ministry Committee, after more than a year
# past, approved sending the proposed June 2011 changes to the Time
# Decree Law back to the Knesset for second and third (final) votes
@@ -1212,6 +1211,10 @@ Rule Zion 2012 only - Sep 23 2:00 0 S
# later (i.e. at 02:00 the first Monday after October 2).
# [Rosh Hashana holidays are factored in until 2100.]
+# From Ephraim Silverberg (2012-11-05):
+# The Knesset passed today (in second and final readings) the amendment to the
+# Time Decree Law making the changes ... law.
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Zion 2013 max - Mar Fri>=23 2:00 1:00 D
Rule Zion 2013 2026 - Oct Sun>=2 2:00 0 S
@@ -2049,8 +2052,7 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
# occurred before our cutoff date of 1970.
# However, as we get more information, we may need to add entries
# for parts of the West Bank as they transitioned from Israel's rules
-# to Palestine's rules. If you have more info about this, please
-# send it to tz@elsie.nci.nih.gov for incorporation into future editions.
+# to Palestine's rules.
# From IINS News Service - Israel - 1998-03-23 10:38:07 Israel time,
# forwarded by Ephraim Silverberg:
diff --git a/contrib/tzdata/australasia b/contrib/tzdata/australasia
index 74d476e..bef6f20 100644
--- a/contrib/tzdata/australasia
+++ b/contrib/tzdata/australasia
@@ -780,7 +780,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
-# tz@elsie.nci.nih.gov for general use in the future).
+# tz@iana.org for general use in the future).
# From Paul Eggert (2006-03-22):
# A good source for time zone historical data outside the U.S. is
diff --git a/contrib/tzdata/europe b/contrib/tzdata/europe
index 5d2acc5..ad9816c 100644
--- a/contrib/tzdata/europe
+++ b/contrib/tzdata/europe
@@ -4,7 +4,7 @@
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
-# tz@elsie.nci.nih.gov for general use in the future).
+# tz@iana.org for general use in the future).
# From Paul Eggert (2006-03-22):
# A good source for time zone historical data outside the U.S. is
diff --git a/contrib/tzdata/northamerica b/contrib/tzdata/northamerica
index 18a4228..772d7a4 100644
--- a/contrib/tzdata/northamerica
+++ b/contrib/tzdata/northamerica
@@ -6,7 +6,7 @@
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
-# tz@elsie.nci.nih.gov for general use in the future).
+# tz@iana.org for general use in the future).
# From Paul Eggert (1999-03-22):
# A reliable and entertaining source about time zones is
diff --git a/contrib/tzdata/southamerica b/contrib/tzdata/southamerica
index 3195846..3301a43 100644
--- a/contrib/tzdata/southamerica
+++ b/contrib/tzdata/southamerica
@@ -4,7 +4,7 @@
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
-# tz@elsie.nci.nih.gov for general use in the future).
+# tz@iana.org for general use in the future).
# From Paul Eggert (2006-03-22):
# A good source for time zone historical data outside the U.S. is
diff --git a/crypto/heimdal/lib/sl/slc-lex.l b/crypto/heimdal/lib/sl/slc-lex.l
index 1099ede..6101569 100644
--- a/crypto/heimdal/lib/sl/slc-lex.l
+++ b/crypto/heimdal/lib/sl/slc-lex.l
@@ -47,8 +47,6 @@ unsigned lineno = 1;
static void handle_comment(void);
static char * handle_string(void);
-#define YY_NO_UNPUT
-
#undef ECHO
%}
diff --git a/etc/Makefile b/etc/Makefile
index bbb5018..c18908f 100644
--- a/etc/Makefile
+++ b/etc/Makefile
@@ -220,8 +220,7 @@ distribution:
cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
.if ${MK_BIND_MTREE} != "no"
- @if [ ! -e ${DESTDIR}/etc/namedb ]; then \
- set -x; \
+ if [ ! -e ${DESTDIR}/etc/namedb ]; then \
ln -s ../var/named/etc/namedb ${DESTDIR}/etc/namedb; \
fi
.endif
@@ -267,9 +266,8 @@ distribution:
.if ${MK_MAIL} != "no"
cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
${ETCMAIL} ${DESTDIR}/etc/mail
- @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
+ if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
! -f ${DESTDIR}/etc/aliases ]; then \
- set -x; \
ln -s mail/aliases ${DESTDIR}/etc/aliases; \
fi
.endif
diff --git a/etc/rc.d/jail b/etc/rc.d/jail
index 0718fa8..ff2f312 100755
--- a/etc/rc.d/jail
+++ b/etc/rc.d/jail
@@ -656,7 +656,8 @@ jail_start()
done
eval ${_setfib} jail -n ${_jail} ${_flags} -i -c path=${_rootdir} host.hostname=${_hostname} \
- ip4.addr=\"${_addrl}\" ip6.addr=\"${_addr6l}\" ${_parameters} command=${_exec_start} > ${_tmp_jail} 2>&1 \
+ ${_addrl:+ip4.addr=\"${_addrl}\"} ${_addr6l:+ip6.addr=\"${_addr6l}\"} \
+ ${_parameters} command=${_exec_start} > ${_tmp_jail} 2>&1 \
</dev/null
if [ "$?" -eq 0 ] ; then
diff --git a/games/fortune/datfiles/fortunes b/games/fortune/datfiles/fortunes
index cd476ed..e9edb26 100644
--- a/games/fortune/datfiles/fortunes
+++ b/games/fortune/datfiles/fortunes
@@ -901,7 +901,7 @@ to add. This will take at least two weeks," he finally said.
"Even that is too much to expect," insisted the manager, "I will be
satisfied if you simply tell me when the program is complete."
The programmer agreed to this.
- Several years slated, the manager retired. On the way to his
+ Several years later, the manager retired. On the way to his
retirement lunch, he discovered the programmer asleep at his terminal.
He had been programming all night.
-- Geoffrey James, "The Tao of Programming"
@@ -7947,7 +7947,7 @@ the same mistake twice without getting nervous.
A well-known friend is a treasure.
%
A well-used door needs no oil on its hinges.
-A swift-flowing steam does no grow stagnant.
+A swift-flowing stream does not grow stagnant.
Neither sound nor thoughts can travel through a vacuum.
Software rots if not used.
diff --git a/games/fortune/fortune/fortune.c b/games/fortune/fortune/fortune.c
index 22d85ac..d5ce1b9 100644
--- a/games/fortune/fortune/fortune.c
+++ b/games/fortune/fortune/fortune.c
@@ -109,7 +109,7 @@ static bool Equal_probs = FALSE; /* scatter un-allocted prob equally */
static bool Match = FALSE; /* dump fortunes matching a pattern */
static bool WriteToDisk = false; /* use files on disk to save state */
#ifdef DEBUG
-static bool Debug = FALSE; /* print debug messages */
+static int Debug = 0; /* print debug messages */
#endif
static char *Fortbuf = NULL; /* fortune buffer for -m */
diff --git a/include/xlocale/_ctype.h b/include/xlocale/_ctype.h
index 7ffa7a1..b048c55 100644
--- a/include/xlocale/_ctype.h
+++ b/include/xlocale/_ctype.h
@@ -53,7 +53,7 @@ _RuneLocale *__runes_for_locale(locale_t, int*);
#endif
#ifndef _XLOCALE_INLINE
-#if __GNUC__ && !__GNUC_STDC_INLINE__
+#if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__)
/* GNU89 inline has nonstandard semantics. */
#define _XLOCALE_INLINE extern __inline
#else
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index 2481f28..906f4ce 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -34,7 +34,7 @@ SRCS+= __getosreldate.c __xuname.c \
syslog.c telldir.c termios.c time.c times.c timezone.c tls.c \
ttyname.c ttyslot.c ualarm.c ulimit.c uname.c unvis.c \
usleep.c utime.c utxdb.c valloc.c vis.c wait.c wait3.c waitpid.c \
- wordexp.c
+ waitid.c wordexp.c
.PATH: ${.CURDIR}/../../contrib/libc-pwcache
SRCS+= pwcache.c pwcache.h
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
index b4f88ae..f5d4f71 100644
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -391,6 +391,7 @@ FBSD_1.3 {
pwcache_userdb;
pwcache_groupdb;
uid_from_user;
+ waitid;
};
FBSDprivate_1.0 {
diff --git a/lib/libc/gen/getbsize.3 b/lib/libc/gen/getbsize.3
index 1407051..2caf5fe 100644
--- a/lib/libc/gen/getbsize.3
+++ b/lib/libc/gen/getbsize.3
@@ -28,12 +28,12 @@
.\" @(#)getbsize.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd November 16, 2012
.Dt GETBSIZE 3
.Os
.Sh NAME
.Nm getbsize
-.Nd get user block size
+.Nd get preferred block size
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
@@ -43,11 +43,31 @@
.Sh DESCRIPTION
The
.Fn getbsize
-function determines the user's preferred block size based on the value of the
-.Dq BLOCKSIZE
-environment variable; see
-.Xr environ 7
-for details on its use and format.
+function returns a preferred block size for reporting by system utilities
+.Xr df 1 ,
+.Xr du 1 ,
+.Xr ls 1
+and
+.Xr systat 1 ,
+based on the value of the
+.Ev BLOCKSIZE
+environment variable.
+.Ev BLOCKSIZE
+may be specified directly in bytes, or in multiples of a kilobyte by
+specifying a number followed by ``K'' or ``k'', in multiples of a
+megabyte by specifying a number followed by ``M'' or ``m'' or in
+multiples of a gigabyte by specifying a number followed by ``G'' or
+``g''.
+Multiples must be integers.
+.Pp
+Valid values of
+.Ev BLOCKSIZE
+are 512 bytes to 1 gigabyte.
+Sizes less than 512 bytes are rounded up to 512 bytes, and sizes
+greater than 1 GB are rounded down to 1 GB.
+In each case
+.Fn getbsize
+produces a warning message.
.Pp
The
.Fn getbsize
@@ -61,10 +81,6 @@ terminating null).
The memory referenced by
.Fa blocksizep
is filled in with block size, in bytes.
-.Pp
-If the user's block size is unreasonable, a warning message is
-written to standard error and the returned information reflects
-a block size of 512 bytes.
.Sh SEE ALSO
.Xr df 1 ,
.Xr du 1 ,
diff --git a/lib/libc/gen/waitid.c b/lib/libc/gen/waitid.c
new file mode 100644
index 0000000..795b208
--- /dev/null
+++ b/lib/libc/gen/waitid.c
@@ -0,0 +1,65 @@
+/*-
+ * Copyright (c) 2012 Jukka A. Ukkonen
+ * All rights reserved.
+ *
+ * This software was developed by Jukka Ukkonen for FreeBSD.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "namespace.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <stddef.h>
+#include <string.h>
+#include <signal.h>
+#include <errno.h>
+#include "un-namespace.h"
+
+int
+__waitid(idtype_t idtype, id_t id, siginfo_t *info, int flags)
+{
+ int status;
+ pid_t ret;
+
+ ret = _wait6(idtype, id, &status, flags, NULL, info);
+
+ /*
+ * According to SUSv4, waitid() shall not return a PID when a
+ * process is found, but only 0. If a process was actually
+ * found, siginfo_t fields si_signo and si_pid will be
+ * non-zero. In case WNOHANG was set in the flags and no
+ * process was found those fields are set to zero using
+ * memset() below.
+ */
+ if (ret == 0 && info != NULL)
+ memset(info, 0, sizeof(*info));
+ else if (ret > 0)
+ ret = 0;
+ return (ret);
+}
+
+__weak_reference(__waitid, waitid);
+__weak_reference(__waitid, _waitid);
diff --git a/lib/libc/include/namespace.h b/lib/libc/include/namespace.h
index 1e00030..739d7b1 100644
--- a/lib/libc/include/namespace.h
+++ b/lib/libc/include/namespace.h
@@ -229,6 +229,7 @@
#define socketpair _socketpair
#define usleep _usleep
#define wait4 _wait4
+#define wait6 _wait6
#define waitpid _waitpid
#define write _write
#define writev _writev
diff --git a/lib/libc/include/un-namespace.h b/lib/libc/include/un-namespace.h
index 9c9ce97..f31fa7a 100644
--- a/lib/libc/include/un-namespace.h
+++ b/lib/libc/include/un-namespace.h
@@ -210,6 +210,7 @@
#undef socketpair
#undef usleep
#undef wait4
+#undef wait6
#undef waitpid
#undef write
#undef writev
diff --git a/lib/libc/net/getnetent.3 b/lib/libc/net/getnetent.3
index 2e9cd33..ec08b6b 100644
--- a/lib/libc/net/getnetent.3
+++ b/lib/libc/net/getnetent.3
@@ -73,7 +73,7 @@ The order of the lookups is controlled by the
`networks' entry in
.Xr nsswitch.conf 5 .
.Bd -literal -offset indent
-struct netent {
+struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net number type */
@@ -142,8 +142,7 @@ Network numbers are supplied in host order.
.It Pa /etc/resolv.conf
.El
.Sh DIAGNOSTICS
-Null pointer
-(0) returned on
+Null pointer returned on
.Dv EOF
or error.
.Sh SEE ALSO
diff --git a/lib/libc/net/getprotoent.3 b/lib/libc/net/getprotoent.3
index 9f9e00d..565e038 100644
--- a/lib/libc/net/getprotoent.3
+++ b/lib/libc/net/getprotoent.3
@@ -65,7 +65,7 @@ containing the broken-out
fields of a line in the network protocol data base,
.Pa /etc/protocols .
.Bd -literal -offset indent
-struct protoent {
+struct protoent {
char *p_name; /* official name of protocol */
char **p_aliases; /* alias list */
int p_proto; /* protocol number */
@@ -117,8 +117,7 @@ or until
.Dv EOF
is encountered.
.Sh RETURN VALUES
-Null pointer
-(0) returned on
+Null pointer returned on
.Dv EOF
or error.
.Sh FILES
diff --git a/lib/libc/net/getservent.3 b/lib/libc/net/getservent.3
index 65d40bb..5f5a452 100644
--- a/lib/libc/net/getservent.3
+++ b/lib/libc/net/getservent.3
@@ -65,7 +65,7 @@ containing the broken-out
fields of a line in the network services data base,
.Pa /etc/services .
.Bd -literal -offset indent
-struct servent {
+struct servent {
char *s_name; /* official name of service */
char **s_aliases; /* alias list */
int s_port; /* port service resides at */
@@ -130,8 +130,7 @@ searches must also match the protocol.
.It Pa /etc/services
.El
.Sh DIAGNOSTICS
-Null pointer
-(0) returned on
+Null pointer returned on
.Dv EOF
or error.
.Sh SEE ALSO
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index df4ef42..a35ed5d 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -217,5 +217,6 @@ MLINKS+=timer_settime.2 timer_getoverrun.2 timer_settime.2 timer_gettime.2
MLINKS+=truncate.2 ftruncate.2
MLINKS+=unlink.2 unlinkat.2
MLINKS+=utimes.2 futimes.2 utimes.2 futimesat.2 utimes.2 lutimes.2
-MLINKS+=wait.2 wait3.2 wait.2 wait4.2 wait.2 waitpid.2
+MLINKS+=wait.2 wait3.2 wait.2 wait4.2 wait.2 waitpid.2 \
+ wait.2 waitid.2 wait.2 wait6.2
MLINKS+=write.2 pwrite.2 write.2 pwritev.2 write.2 writev.2
diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map
index 008b8da..babae30 100644
--- a/lib/libc/sys/Symbol.map
+++ b/lib/libc/sys/Symbol.map
@@ -384,6 +384,7 @@ FBSD_1.3 {
ffclock_getestimate;
ffclock_setestimate;
posix_fadvise;
+ wait6;
};
FBSDprivate_1.0 {
@@ -1019,6 +1020,8 @@ FBSDprivate_1.0 {
__sys_vadvise;
_wait4;
__sys_wait4;
+ _wait6;
+ __sys_wait6;
_write;
__sys_write;
_writev;
diff --git a/lib/libc/sys/rtprio.2 b/lib/libc/sys/rtprio.2
index ac78b50..f30ed22 100644
--- a/lib/libc/sys/rtprio.2
+++ b/lib/libc/sys/rtprio.2
@@ -145,13 +145,21 @@ Higher real/idle priority threads
preempt lower real/idle priority threads.
Threads of equal real/idle priority are run round-robin.
.Sh RETURN VALUES
-.Rv -std rtprio
+.Rv -std rtprio rtprio_thread
.Sh ERRORS
The
.Fn rtprio
-system call
+and
+.Fn rtprio_thread
+system calls
will fail if:
.Bl -tag -width Er
+.It Bq Er EFAULT
+The rtp pointer passed to
+.Fn rtprio
+or
+.Fn rtprio_thread
+was invalid.
.It Bq Er EINVAL
The specified
.Fa prio
diff --git a/lib/libc/sys/sendfile.2 b/lib/libc/sys/sendfile.2
index 9d1fba5..0e7dbe3 100644
--- a/lib/libc/sys/sendfile.2
+++ b/lib/libc/sys/sendfile.2
@@ -265,6 +265,8 @@ is negative.
.It Bq Er EIO
An error occurred while reading from
.Fa fd .
+.It Bq Er ENOBUFS
+The system was unable to allocate an internal buffer.
.It Bq Er ENOTCONN
The
.Fa s
diff --git a/lib/libc/sys/wait.2 b/lib/libc/sys/wait.2
index 71bd529..0c494bb 100644
--- a/lib/libc/sys/wait.2
+++ b/lib/libc/sys/wait.2
@@ -28,15 +28,17 @@
.\" @(#)wait.2 8.2 (Berkeley) 4/19/94
.\" $FreeBSD$
.\"
-.Dd November 12, 2005
+.Dd November 10, 2012
.Dt WAIT 2
.Os
.Sh NAME
.Nm wait ,
+.Nm waitid ,
.Nm waitpid ,
+.Nm wait3 ,
.Nm wait4 ,
-.Nm wait3
-.Nd wait for process termination
+.Nm wait6
+.Nd wait for processes to change status
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
@@ -46,12 +48,17 @@
.Fn wait "int *status"
.Ft pid_t
.Fn waitpid "pid_t wpid" "int *status" "int options"
+.In sys/signal.h
+.Ft int
+.Fn waitid "idtype_t idtype" "id_t id" "siginfo_t *info" "int options"
.In sys/time.h
.In sys/resource.h
.Ft pid_t
.Fn wait3 "int *status" "int options" "struct rusage *rusage"
.Ft pid_t
.Fn wait4 "pid_t wpid" "int *status" "int options" "struct rusage *rusage"
+.Ft pid_t
+.Fn wait6 "idtype_t idtype" "id_t id" "int *status" "int options" "struct __wrusage *wrusage" "siginfo_t *infop"
.Sh DESCRIPTION
The
.Fn wait
@@ -86,28 +93,172 @@ system call provides a more general interface for programs
that need to wait for certain child processes,
that need resource utilization statistics accumulated by child processes,
or that require options.
-The other wait functions are implemented using
-.Fn wait4 .
.Pp
+The broadest interface of all functions in this family is
+.Fn wait6
+which is otherwise very much like
+.Fn wait4
+but with a few very important distinctions.
+To wait for exited processes, the option flag
+.Dv WEXITED
+need to be explicitly specified.
+This allows for waiting for processes which have experienced other
+status changes without having to handle also the exit status from
+the terminated processes.
+Instead of the traditional
+.Dv rusage
+argument, a pointer to a new structure
+.Bd -literal
+struct __wrusage {
+ struct rusage wru_self;
+ struct rusage wru_children;
+};
+.Ed
+can be passed.
+This allows the calling process to collect resource usage statistics
+from both its own child process as well as from its grand children.
+When no resource usage statistics are needed this pointer can be
+.Dv NULL .
+The last argument
+.Fa infop
+must be either
+.Dv NULL
+or a pointer to a
+.Fa siginfo_t
+structure.
+When specified, the structure is filled the same as for
+.Dv SIGNCHLD
+signal, delivered at the process state change.
+.br
+The process, which state is queried, is specified by two arguments
+.Fa idtype
+and
+.Fa id .
+The separate
+.Fa idtype
+and
+.Fa id
+arguments allows to support many other types of
+IDs as well in addition to PID and PGID.
+.Bl -bullet -offset indent
+.It
+If
+.Fa idtype
+is
+.Dv P_PID ,
+.Fn waitid
+and
+.Fn wait6
+wait for the child process with a process ID equal to
+.Dv (pid_t)id .
+.It
+If
+.Fa idtype
+is
+.Dv P_PGID ,
+.Fn waitid
+and
+.Fn wait6
+wait for the child process with a process group ID equal to
+.Dv (pid_t)id .
+.It
+If
+.Fa idtype
+is
+.Dv P_ALL ,
+.Fn waitid
+and
+.Fn wait6
+wait for any child process and the
+.Dv id
+is ignored.
+.It
+If
+.Fa idtype
+is
+.Dv P_PID
+or
+.Dv P_PGID
+and the
+.Dv id
+is zero,
+.Fn waitid
+and
+.Fn wait6
+wait for any child process in the same process group as the caller.
+.El
+.Pp
+Non-standard specifiers for the process to wait for, supported by this
+implementation of
+.Fn waitid
+and
+.Fn wait6 ,
+are:
+.Bl -bullet -offset indent
+.It
The
+.Fa idtype
+value
+.Dv P_UID
+waits for processes which effective UID is equal to
+.Dv (uid_t)id .
+.It
+The
+.Fa idtype
+value
+.Dv P_GID
+waits for processes which effective GID is equal to
+.Dv (gid_t)id .
+.It
+The
+.Fa idtype
+value
+.Dv P_SID
+waits for processes which session ID is equal to
+.Dv id .
+In case the child process started its own new session,
+SID will be the same as its own PID.
+Otherwise the SID of a child process will match the caller's SID.
+.It
+The
+.Fa idtype
+value
+.Dv P_JAILID
+waits for processes within a jail which jail identifier is equal
+to
+.Dv id .
+.El
+.Pp
+For
+.Fn wait ,
+.Fn wait3 ,
+and
+.Fn wait4
+functions, the single
.Fa wpid
argument specifies the set of child processes for which to wait.
+.Bl -bullet -offset indent
+.It
If
.Fa wpid
is -1, the call waits for any child process.
+.It
If
.Fa wpid
is 0,
the call waits for any child process in the process group of the caller.
+.It
If
.Fa wpid
is greater than zero, the call waits for the process with process id
.Fa wpid .
+.It
If
.Fa wpid
is less than -1, the call waits for any process whose process group id
equals the absolute value of
.Fa wpid .
+.El
.Pp
The
.Fa status
@@ -116,41 +267,102 @@ argument is defined below.
The
.Fa options
argument contains the bitwise OR of any of the following options.
-The
-.Dv WCONTINUED
-option indicates that children of the current process that
+.Bl -tag -width Ds
+.It Dv WCONTINUED
+indicates that children of the current process that
have continued from a job control stop, by receiving a
.Dv SIGCONT
signal, should also have their status reported.
-The
-.Dv WNOHANG
-option
-is used to indicate that the call should not block if
-there are no processes that wish to report status.
-If the
-.Dv WUNTRACED
-option is set,
-children of the current process that are stopped
+.It Dv WNOHANG
+is used to indicate that the call should not block when
+there are no processes wishing to report status.
+.It Dv WUNTRACED
+indicates that children of the current process which are stopped
due to a
.Dv SIGTTIN , SIGTTOU , SIGTSTP ,
or
.Dv SIGSTOP
-signal also have their status reported.
-The
-.Dv WSTOPPED
-option is an alias for
+signal shall have their status reported.
+.It Dv WSTOPPED
+is an alias for
.Dv WUNTRACED .
-The
-.Dv WNOWAIT
-option keeps the process whose status is returned in a waitable state.
+.It Dv WTRAPPED
+allows waiting for processes which have trapped or reached a breakpoint.
+.It Dv WEXITED
+indicates that the caller is wants to receive status reports from
+terminated processes.
+This flag is implicitly set for the functions
+.Fn wait ,
+.Fn waitpid ,
+.Fn wait3 ,
+and
+.Fn wait4 .
+.br
+For the
+.Fn waitid
+and
+.Fn wait6
+functions, the flag has to be explicitly included in the
+.Fa options ,
+if status reports from terminated processes are expected.
+.It Dv WNOWAIT
+keeps the process whose status is returned in a waitable state.
The process may be waited for again after this call completes.
+.El
+.sp
+For the
+.Fn waitid
+and
+.Fn wait6
+functions, at least one of the options
+.Dv WEXITED ,
+.Dv WUNTRACED ,
+.Dv WSTOPPED ,
+.Dv WTRAPPED ,
+or
+.Dv WCONTINUED
+must be specified.
+Otherwise there will be no events for the call to report.
+To avoid hanging indefinitely in such a case these functions
+return -1 with
+.Dv errno
+set to
+.Dv EINVAL .
.Pp
If
.Fa rusage
-is non-zero, a summary of the resources used by the terminated
-process and all its
-children is returned (this information is currently not available
-for stopped or continued processes).
+is non-NULL, a summary of the resources used by the terminated
+process and all its children is returned.
+.Pp
+If
+.Fa wrusage
+argument is non-NULL, a resource usage statistics
+from both its own child process as well as from its grand children
+is returned.
+.Pp
+If
+.Fa infop
+is non-NULL, it must point to a
+.Dv siginfo_t
+structure which is filled on return such that the
+.Dv si_signo
+field is always
+.Dv SIGCHLD
+and the field
+.Dv si_pid
+if be non-zero, if there is a status change to report.
+If there are no status changes to report and WNOHANG is applied,
+both of these fields are returned zero.
+When using the
+.Fn waitid
+function with the
+.Dv WNOHANG
+option set, checking these fields is the only way to know whether
+there were any status changes to report, because the return value
+from
+.Fn waitid
+is be zero as it is for any successful return from
+.Fn waitid .
.Pp
When the
.Dv WNOHANG
@@ -175,6 +387,20 @@ call is the same as
with a
.Fa wpid
value of -1.
+The
+.Fn wait6
+call, with the bits
+.Dv WEXITED
+and
+.Dv WTRAPPED
+set in the
+.Fa options
+and with
+.Fa infop
+set to
+.Dv NULL ,
+is similar to
+.Fn wait4 .
.Pp
The following macros may be used to test the manner of exit of the process.
One of the first four macros will evaluate to a non-zero (true) value:
@@ -284,6 +510,7 @@ is returned and
is set to indicate the error.
.Pp
If
+.Fn wait6 ,
.Fn wait4 ,
.Fn wait3 ,
or
@@ -306,6 +533,18 @@ a value of -1
is returned and
.Va errno
is set to indicate the error.
+.Pp
+If
+.Fn waitid
+returns because one or more processes have a state change to report,
+0 is returned.
+To indicate an error, -1 will be returned and
+.Dv errno
+set to an appropriate value.
+If
+.Dv WNOHANG
+was used, 0 can be returned indicating no error, but no processes
+may have changed state either, if si_signo and/or si_pid are zero.
.Sh ERRORS
The
.Fn wait
@@ -335,6 +574,14 @@ The call was interrupted by a caught signal,
or the signal did not have the
.Dv SA_RESTART
flag set.
+.It Bq Er EINVAL
+An invalid value was specified for
+.Fa options ,
+or
+.Fa idtype
+and
+.Fa id
+do not specify a valid set of processes.
.El
.Sh SEE ALSO
.Xr _exit 2 ,
@@ -344,11 +591,13 @@ flag set.
.Xr siginfo 3
.Sh STANDARDS
The
-.Fn wait
+.Fn wait ,
+.Fn waitpid ,
and
-.Fn waitpid
+.Fn waitid
functions are defined by POSIX;
-.Fn wait4
+.Fn wait6 ,
+.Fn wait4 ,
and
.Fn wait3
are not specified by POSIX.
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c
index 00dd887..abf79a3 100644
--- a/lib/libfetch/http.c
+++ b/lib/libfetch/http.c
@@ -1752,11 +1752,11 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
/* get headers. http_next_header expects one line readahead */
if (fetch_getln(conn) == -1) {
- fetch_syserr();
- goto ouch;
+ fetch_syserr();
+ goto ouch;
}
do {
- switch ((h = http_next_header(conn, &headerbuf, &p))) {
+ switch ((h = http_next_header(conn, &headerbuf, &p))) {
case hdr_syserror:
fetch_syserr();
goto ouch;
@@ -1785,7 +1785,7 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
conn->err != HTTP_USE_PROXY) {
n = 1;
break;
- }
+ }
if (new)
free(new);
if (verbose)
diff --git a/sbin/fsck_ffs/suj.c b/sbin/fsck_ffs/suj.c
index 0800a5c..ae47487 100644
--- a/sbin/fsck_ffs/suj.c
+++ b/sbin/fsck_ffs/suj.c
@@ -504,7 +504,7 @@ blk_equals(struct jblkrec *brec, ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t start,
return (0);
if (brec->jb_blkno + brec->jb_oldfrags != start)
return (0);
- if (brec->jb_frags != frags)
+ if (brec->jb_frags < frags)
return (0);
return (1);
}
@@ -551,7 +551,6 @@ blk_freemask(ufs2_daddr_t blk, ino_t ino, ufs_lbn_t lbn, int frags)
brec = (struct jblkrec *)srec->sr_rec;
/*
* If the block overlaps but does not match
- * exactly it's a new allocation. If it matches
* exactly this record refers to the current
* location.
*/
@@ -648,7 +647,8 @@ blk_free(ufs2_daddr_t bno, int mask, int frags)
uint8_t *blksfree;
if (debug)
- printf("Freeing %d frags at blk %jd\n", frags, bno);
+ printf("Freeing %d frags at blk %jd mask 0x%x\n",
+ frags, bno, mask);
cg = dtog(fs, bno);
sc = cg_lookup(cg);
cgp = sc->sc_cgp;
@@ -1143,12 +1143,8 @@ ino_adjblks(struct suj_ino *sino)
static void
blk_free_visit(ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t blk, int frags)
{
- int mask;
- mask = blk_freemask(blk, ino, lbn, frags);
- if (debug)
- printf("blk %jd freemask 0x%X\n", blk, mask);
- blk_free(blk, mask, frags);
+ blk_free(blk, blk_freemask(blk, ino, lbn, frags), frags);
}
/*
@@ -1163,8 +1159,6 @@ blk_free_lbn(ufs2_daddr_t blk, ino_t ino, ufs_lbn_t lbn, int frags, int follow)
int mask;
mask = blk_freemask(blk, ino, lbn, frags);
- if (debug)
- printf("blk %jd freemask 0x%X\n", blk, mask);
resid = 0;
if (lbn <= -NDADDR && follow && mask == 0)
indir_visit(ino, lbn, blk, &resid, blk_free_visit, VISIT_INDIR);
@@ -2334,6 +2328,10 @@ suj_prune(void)
}
if (newseq != oldseq) {
+ TAILQ_FOREACH(seg, &allsegs, ss_next) {
+ printf("%jd, ", seg->ss_rec.jsr_seq);
+ }
+ printf("\n");
err_suj("Journal file sequence mismatch %jd != %jd\n",
newseq, oldseq);
}
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 717a09a..f81d7a8 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -422,7 +422,7 @@ routename(struct sockaddr *sa)
/*
* Return the name of the network whose address is given.
- * The address is assumed to be that of a net or subnet, not a host.
+ * The address is assumed to be that of a net, not a host.
*/
const char *
netname(struct sockaddr *sa)
@@ -430,9 +430,8 @@ netname(struct sockaddr *sa)
const char *cp = NULL;
static char line[MAXHOSTNAMELEN + 1];
struct netent *np = NULL;
- u_long net, mask;
u_long i;
- int n, subnetshift;
+ int n;
switch (sa->sa_family) {
@@ -444,28 +443,7 @@ netname(struct sockaddr *sa)
if (in.s_addr == 0)
cp = "default";
else if (!nflag) {
- if (IN_CLASSA(i)) {
- mask = IN_CLASSA_NET;
- subnetshift = 8;
- } else if (IN_CLASSB(i)) {
- mask = IN_CLASSB_NET;
- subnetshift = 8;
- } else {
- mask = IN_CLASSC_NET;
- subnetshift = 4;
- }
- /*
- * If there are more bits than the standard mask
- * would suggest, subnets must be in use.
- * Guess at the subnet mask, assuming reasonable
- * width subnet fields.
- */
- while (in.s_addr & ~mask)
- mask |= mask >> subnetshift;
- net = in.s_addr & mask;
- while ((mask & 1) == 0)
- mask >>= 1, net >>= 1;
- np = getnetbyaddr(net, AF_INET);
+ np = getnetbyaddr(i, AF_INET);
if (np != NULL)
cp = np->n_name;
}
@@ -810,30 +788,19 @@ newroute(int argc, char **argv)
static void
inet_makenetandmask(u_long net, struct sockaddr_in *sin, u_long bits)
{
- u_long addr, mask = 0;
+ u_long mask = 0;
char *cp;
rtm_addrs |= RTA_NETMASK;
- /*
- * XXX: This approach unable to handle 0.0.0.1/32 correctly
- * as inet_network() converts 0.0.0.1 and 1 equally.
- */
- if (net <= 0xff)
- addr = net << IN_CLASSA_NSHIFT;
- else if (net <= 0xffff)
- addr = net << IN_CLASSB_NSHIFT;
- else if (net <= 0xffffff)
- addr = net << IN_CLASSC_NSHIFT;
- else
- addr = net;
+
/*
* If no /xx was specified we must calculate the
* CIDR address.
*/
- if ((bits == 0) && (addr != 0)) {
+ if ((bits == 0) && (net != 0)) {
u_long i, j;
for(i=0,j=0xff; i<4; i++) {
- if (addr & j) {
+ if (net & j) {
break;
}
j <<= 8;
@@ -844,7 +811,7 @@ inet_makenetandmask(u_long net, struct sockaddr_in *sin, u_long bits)
if (bits != 0)
mask = 0xffffffff << (32 - bits);
- sin->sin_addr.s_addr = htonl(addr);
+ sin->sin_addr.s_addr = htonl(net);
sin = &so_mask.sin;
sin->sin_addr.s_addr = htonl(mask);
sin->sin_len = 0;
diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c
index f179a4c..f2e02f2 100644
--- a/sbin/umount/umount.c
+++ b/sbin/umount/umount.c
@@ -359,8 +359,10 @@ umountfs(struct statfs *sfs)
do_rpc = 1;
}
- if (!namematch(ai))
+ if (!namematch(ai)) {
+ free(orignfsdirname);
return (1);
+ }
/* First try to unmount using the file system ID. */
snprintf(fsidbuf, sizeof(fsidbuf), "FSID:%d:%d", sfs->f_fsid.val[0],
sfs->f_fsid.val[1]);
@@ -369,13 +371,16 @@ umountfs(struct statfs *sfs)
if (errno != ENOENT || sfs->f_fsid.val[0] != 0 ||
sfs->f_fsid.val[1] != 0)
warn("unmount of %s failed", sfs->f_mntonname);
- if (errno != ENOENT)
+ if (errno != ENOENT) {
+ free(orignfsdirname);
return (1);
+ }
/* Compatibility for old kernels. */
if (sfs->f_fsid.val[0] != 0 || sfs->f_fsid.val[1] != 0)
warnx("retrying using path instead of file system ID");
if (unmount(sfs->f_mntonname, fflag) != 0) {
warn("unmount of %s failed", sfs->f_mntonname);
+ free(orignfsdirname);
return (1);
}
}
@@ -393,6 +398,7 @@ umountfs(struct statfs *sfs)
if (clp == NULL) {
warnx("%s: %s", hostp,
clnt_spcreateerror("MOUNTPROG"));
+ free(orignfsdirname);
return (1);
}
clp->cl_auth = authsys_create_default();
@@ -403,6 +409,7 @@ umountfs(struct statfs *sfs)
if (clnt_stat != RPC_SUCCESS) {
warnx("%s: %s", hostp,
clnt_sperror(clp, "RPCMNT_UMOUNT"));
+ free(orignfsdirname);
return (1);
}
/*
@@ -415,10 +422,10 @@ umountfs(struct statfs *sfs)
hostp, nfsdirname);
free_mtab();
}
- free(orignfsdirname);
auth_destroy(clp->cl_auth);
clnt_destroy(clp);
}
+ free(orignfsdirname);
return (0);
}
diff --git a/share/man/man4/lagg.4 b/share/man/man4/lagg.4
index 0ba8e1a..aec7b7e 100644
--- a/share/man/man4/lagg.4
+++ b/share/man/man4/lagg.4
@@ -92,8 +92,8 @@ 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.
+Supports the IEEE 802.1AX (formerly 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.
@@ -150,7 +150,7 @@ 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
+Create a link aggregation using LACP with two
.Xr bge 4
Gigabit Ethernet interfaces:
.Bd -literal -offset indent
diff --git a/share/man/man4/ng_UI.4 b/share/man/man4/ng_UI.4
index 2054d19..30f7c48 100644
--- a/share/man/man4/ng_UI.4
+++ b/share/man/man4/ng_UI.4
@@ -65,12 +65,12 @@ will have a 0x03 byte prepended to them before being forwarded out on the
hook.
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width foobar
-.It Dv downstream
+.Bl -tag -width ".Va downstream"
+.It Va downstream
Downstream connection.
Packets on this side of the node have a 0x03 as
their first byte.
-.It Dv upstream
+.It Va upstream
Upstream connection.
Packets on this side of the node have the
initial 0x03 byte stripped off.
diff --git a/share/man/man4/ng_async.4 b/share/man/man4/ng_async.4
index 2349cb3..ffd9a38 100644
--- a/share/man/man4/ng_async.4
+++ b/share/man/man4/ng_async.4
@@ -35,7 +35,7 @@
.\" $FreeBSD$
.\" $Whistle: ng_async.8,v 1.6 1999/01/25 23:46:25 archie Exp $
.\"
-.Dd January 19, 1999
+.Dd November 13, 2012
.Dt NG_ASYNC 4
.Os
.Sh NAME
@@ -88,13 +88,13 @@ 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
+.Bl -tag -width ".Va async"
+.It Va 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
+.It Va sync
Synchronous connection.
This hook sends and receives synchronous frames.
For PPP, these frames should contain address, control, and protocol fields,
@@ -106,24 +106,17 @@ type node.
.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
+.It Dv NGM_ASYNC_CMD_SET_CONFIG Pq Ic setconfig
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 */
+ u_char enabled; /* Turn encoding on/off */
+ uint16_t amru; /* Max receive async frame length */
+ uint16_t smru; /* Max receive sync frame length */
+ uint32_t accm; /* ACCM encoding */
};
.Ed
-.Pp
The
.Dv enabled
field enables or disables all encoding/decoding functions (default disabled).
@@ -142,8 +135,15 @@ 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
+.It Dv NGM_ASYNC_CMD_GET_CONFIG Pq Ic getconfig
This command returns the current configuration structure.
+.It Dv NGM_ASYNC_CMD_GET_STATS Pq Ic getstats
+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 Pq Ic clrstats
+Clears the node statistics.
+.Pp
.El
.Sh SHUTDOWN
This node shuts down upon receipt of a
diff --git a/share/man/man4/ng_atmllc.4 b/share/man/man4/ng_atmllc.4
index 81768b5..50131a2 100644
--- a/share/man/man4/ng_atmllc.4
+++ b/share/man/man4/ng_atmllc.4
@@ -60,7 +60,7 @@ encapsulated into a PDU and transmitted via the
hook.
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width indent
+.Bl -tag -width ".Va ether"
.It Va atm
ATM connection.
Typically, this hook would be connected to a
diff --git a/share/man/man4/ng_bluetooth.4 b/share/man/man4/ng_bluetooth.4
index 2214172..c956dd0 100644
--- a/share/man/man4/ng_bluetooth.4
+++ b/share/man/man4/ng_bluetooth.4
@@ -43,7 +43,7 @@ All Bluetooth variables can be examined and changed via
.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
+.Bl -tag -width foo
.It Va net.bluetooth.version
A read-only integer variable that shows the current version of the
Bluetooth stack.
diff --git a/share/man/man4/ng_bpf.4 b/share/man/man4/ng_bpf.4
index 4f89729..44a51e3 100644
--- a/share/man/man4/ng_bpf.4
+++ b/share/man/man4/ng_bpf.4
@@ -35,7 +35,7 @@
.\" $FreeBSD$
.\" $Whistle: ng_bpf.8,v 1.2 1999/12/03 01:57:12 archie Exp $
.\"
-.Dd May 30, 2007
+.Dd November 13, 2012
.Dt NG_BPF 4
.Os
.Sh NAME
@@ -81,7 +81,7 @@ 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
+.It Dv NGM_BPF_SET_PROGRAM Pq Ic setprogram
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:
@@ -90,7 +90,7 @@ 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 */
+ int32_t bpf_prog_len; /* #insns in program */
struct bpf_insn bpf_prog[]; /* bpf program */
};
.Ed
@@ -112,25 +112,25 @@ The program must be a valid
program or else
.Er EINVAL
is returned.
-.It Dv NGM_BPF_GET_PROGRAM
+.It Dv NGM_BPF_GET_PROGRAM Pq Ic getprogram
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
+.It Dv NGM_BPF_GET_STATS Pq Ic getstats
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
+.It Dv NGM_BPF_CLR_STATS Pq Ic clrstats
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
+.It Dv NGM_BPF_GETCLR_STATS Pq Ic getclrstats
This command is identical to
.Dv NGM_BPF_GET_STATS ,
except that the statistics are also atomically cleared.
diff --git a/share/man/man4/ng_bridge.4 b/share/man/man4/ng_bridge.4
index b00dc60..4899937 100644
--- a/share/man/man4/ng_bridge.4
+++ b/share/man/man4/ng_bridge.4
@@ -98,7 +98,7 @@ node to the bridge node.
This node type supports the generic control messages, plus the
following:
.Bl -tag -width foo
-.It Dv NGM_BRIDGE_SET_CONFIG
+.It Dv NGM_BRIDGE_SET_CONFIG Pq Ic setconfig
Set the node configuration.
This command takes a
.Dv "struct ng_bridge_config"
@@ -140,13 +140,13 @@ 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
+.It Dv NGM_BRIDGE_GET_CONFIG Pq Ic getconfig
Returns the current configuration as a
.Dv "struct ng_bridge_config" .
-.It Dv NGM_BRIDGE_RESET
+.It Dv NGM_BRIDGE_RESET Pq Ic reset
Causes the node to forget all hosts and unmute all links.
The node configuration is not changed.
-.It Dv NGM_BRIDGE_GET_STATS
+.It Dv NGM_BRIDGE_GET_STATS Pq Ic getstats
This command takes a four byte link number as an argument and
returns a
.Dv "struct ng_bridge_link_stats"
@@ -171,17 +171,17 @@ struct ng_bridge_link_stats {
uint64_t memoryFailures; /* times couldn't get mem or mbuf */
};
.Ed
-.It Dv NGM_BRIDGE_CLR_STATS
+.It Dv NGM_BRIDGE_CLR_STATS Pq Ic clrstats
This command takes a four byte link number as an argument and
clears the statistics for that link.
-.It Dv NGM_BRIDGE_GETCLR_STATS
+.It Dv NGM_BRIDGE_GETCLR_STATS Pq Ic getclrstats
Same as
.Dv NGM_BRIDGE_GET_STATS ,
but also atomically clears the statistics as well.
-.It Dv NGM_BRIDGE_GET_TABLE
+.It Dv NGM_BRIDGE_GET_TABLE Pq Ic gettable
Returns the current host mapping table used to direct packets, in a
.Dv "struct ng_bridge_host_ary" .
-.It Dv NGM_BRIDGE_SET_PERSISTENT
+.It Dv NGM_BRIDGE_SET_PERSISTENT Pq Ic setpersistent
This command sets the persistent flag on the node, and takes no arguments.
.El
.Sh SHUTDOWN
diff --git a/share/man/man4/ng_bt3c.4 b/share/man/man4/ng_bt3c.4
index 157a378..b6c3ba7 100644
--- a/share/man/man4/ng_bt3c.4
+++ b/share/man/man4/ng_bt3c.4
@@ -74,34 +74,34 @@ The
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
+.Bl -tag -width ".Va hook"
+.It Va 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
+.Bl -tag -width foo
+.It Dv NGM_BT3C_NODE_GET_STATE Pq Ic 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
+.It Dv NGM_BT3C_NODE_SET_DEBUG Pq Ic set_debug
This command takes an integer argument and sets the current debug level
for the node.
-.It Dv NGM_BT3C_NODE_GET_QLEN
+.It Dv NGM_BT3C_NODE_GET_DEBUG Pq Ic get_debug
+Returns an integer containing the current debug level for the node.
+.It Dv NGM_BT3C_NODE_GET_QLEN Pq Ic 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
+.It Dv NGM_BT3C_NODE_SET_QLEN Pq Ic 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
+.It Dv NGM_BT3C_NODE_GET_STAT Pq Ic 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
+.It Dv NGM_BT3C_NODE_RESET_STAT Pq Ic reset_stat
Reset all statistic counters to zero.
.It Dv NGM_BT3C_NODE_DOWNLOAD_FIRMWARE
Download card firmware.
diff --git a/share/man/man4/ng_btsocket.4 b/share/man/man4/ng_btsocket.4
index 22763f9..12f2844 100644
--- a/share/man/man4/ng_btsocket.4
+++ b/share/man/man4/ng_btsocket.4
@@ -25,7 +25,7 @@
.\" $Id: ng_btsocket.4,v 1.7 2003/05/21 19:37:35 max Exp $
.\" $FreeBSD$
.\"
-.Dd July 8, 2002
+.Dd November 13, 2012
.Dt NG_BTSOCKET 4
.Os
.Sh NAME
@@ -65,14 +65,14 @@ The Bluetooth raw HCI socket address is defined as follows:
struct sockaddr_hci {
u_char hci_len; /* total length */
u_char hci_family; /* address family */
- char hci_node[16]; /* HCI node name */
+ char hci_node[32]; /* address (size == NG_NODESIZ ) */
};
.Ed
.Pp
Raw HCI sockets support a number of
.Xr ioctl 2
requests such as:
-.Bl -tag -width indent
+.Bl -tag -width foo
.It Dv SIOC_HCI_RAW_NODE_GET_STATE
Returns current state for the HCI node.
.It Dv SIOC_HCI_RAW_NODE_INIT
@@ -174,7 +174,7 @@ request.
Raw L2CAP sockets support number of
.Xr ioctl 2
requests such as:
-.Bl -tag -width indent
+.Bl -tag -width foo
.It Dv SIOC_L2CAP_NODE_GET_FLAGS
Returns current state for the L2CAP node.
.It Dv SIOC_L2CAP_NODE_GET_DEBUG
@@ -243,7 +243,7 @@ level which can be set with
.Xr setsockopt 2
and tested with
.Xr getsockopt 2 :
-.Bl -tag -width indent
+.Bl -tag -width foo
.It Dv SO_L2CAP_IMTU
Get (set) maximum payload size the local socket is capable of accepting.
.It Dv SO_L2CAP_OMTU
@@ -312,7 +312,7 @@ The following options, which can be tested with
call, are defined at
.Dv SOL_RFCOMM
level for RFCOMM sockets:
-.Bl -tag -width indent
+.Bl -tag -width foo
.It Dv SO_RFCOMM_MTU
Returns the maximum transfer unit size (in bytes) for the underlying RFCOMM
channel.
diff --git a/share/man/man4/ng_car.4 b/share/man/man4/ng_car.4
index 79967e7..348b03d 100644
--- a/share/man/man4/ng_car.4
+++ b/share/man/man4/ng_car.4
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 11, 2007
+.Dd November 13, 2012
.Dt NG_CAR 4
.Os
.Sh NAME
@@ -50,7 +50,7 @@ Traffic shaping with RED.
.El
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width indent
+.Bl -tag -width ".Va upper"
.It Va upper
Hook leading to upper layer protocols.
.It Va lower
@@ -73,7 +73,7 @@ is considered
traffic.
.Sh MODES OF OPERATION
Each hook can operate in one of the following modes:
-.Bl -tag -width indent
+.Bl -tag -width foo
.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
@@ -114,24 +114,24 @@ 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
+.Bl -tag -width foo
+.It Dv NGM_CAR_SET_CONF Pq Ic setconf
Set node configuration to the specified at
.Vt "struct ng_car_bulkconf"
-.It Dv NGM_CAR_GET_CONF Pq Li getconf
+.It Dv NGM_CAR_GET_CONF Pq Ic 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 */
+ uint64_t cbs; /* Commited burst size (bytes) */
+ uint64_t ebs; /* Exceeded/Peak burst size (bytes) */
+ uint64_t cir; /* Commited information rate (bits/s) */
+ uint64_t pir; /* Peak information rate (bits/s) */
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 */
+ uint8_t mode; /* single/double rate, ... */
+ uint8_t opt; /* color-aware or color-blind */
};
/* possible actions (..._action) */
@@ -156,17 +156,17 @@ struct ng_car_bulkconf {
struct ng_car_hookconf downstream;
};
.Ed
-.It Dv NGM_CAR_GET_STATS Pq Li getstats
+.It Dv NGM_CAR_GET_STATS Pq Ic 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;
+ uint64_t passed_pkts; /* Counter for passed packets */
+ uint64_t droped_pkts; /* Counter for droped packets */
+ uint64_t green_pkts; /* Counter for green packets */
+ uint64_t yellow_pkts; /* Counter for yellow packets */
+ uint64_t red_pkts; /* Counter for red packets */
+ uint64_t errors; /* Counter for operation errors */
};
struct ng_car_bulkstats {
@@ -174,9 +174,9 @@ struct ng_car_bulkstats {
struct ng_car_hookstats downstream;
};
.Ed
-.It Dv NGM_CAR_CLR_STATS Pq Li clrstats
+.It Dv NGM_CAR_CLR_STATS Pq Ic clrstats
Clear node statistics.
-.It Dv NGM_CAR_GETCLR_STATS Pq Li getclrstats
+.It Dv NGM_CAR_GETCLR_STATS Pq Ic getclrstats
Atomically return and clear node statistics.
.El
.Sh SHUTDOWN
diff --git a/share/man/man4/ng_ccatm.4 b/share/man/man4/ng_ccatm.4
index 1010c0f..f643d72 100644
--- a/share/man/man4/ng_ccatm.4
+++ b/share/man/man4/ng_ccatm.4
@@ -146,7 +146,7 @@ enum atmop {
.Pp
These codes correspond directly to the operations specified in the ATM
Forum document with the following exceptions:
-.Bl -tag -width indent
+.Bl -tag -width foo
.It Dv ATMOP_RESP
As discussed in
.Xr ng_uni 4 ,
@@ -191,12 +191,12 @@ 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
+.Bl -tag -width foo
+.It Dv NGM_CCATM_DUMP Pq Ic dump
This causes the internal state of the node to be dumped in ASCII to the
.Va dump
hook.
-.It Dv NGM_CCATM_STOP
+.It Dv NGM_CCATM_STOP Pq Ic 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.
@@ -207,17 +207,17 @@ struct ngm_ccatm_port {
};
.Ed
.Pp
-.It Dv NGM_CCATM_START
+.It Dv NGM_CCATM_START Pq Ic start
Start processing on the port.
The argument is a
.Vt ngm_ccatm_port
structure.
-.It Dv NGM_CCATM_CLEAR
+.It Dv NGM_CCATM_CLEAR Pq Ic 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
+.It Dv NGM_CCATM_GET_ADDRESSES Pq Ic get_addresses
Get the list of all registered addresses on the given port.
The argument is a
.Vt ngm_ccatm_port
@@ -243,7 +243,7 @@ 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
+.It Dv NGM_CCATM_ADDRESS_REGISTERED Pq Ic address_reg
This message is used by ILMI to inform the
.Nm
node that a previous address registration request was successful.
@@ -251,7 +251,7 @@ 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
+.It Dv NGM_CCATM_ADDRESS_UNREGISTERED Pq Ic address_unreg
This message is used by ILMI to inform the
.Nm
node that an address has been unregistered.
@@ -259,7 +259,7 @@ 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
+.It Dv NGM_CCATM_SET_PORT_PARAM Pq Ic set_port_param
This request sets the parameters on the given port.
The argument is a
.Bd -literal
@@ -281,13 +281,13 @@ address and prefix tables of that port are empty.
The
.Va num_addr
field is ignored.
-.It Dv NGM_CCATM_GET_PORT_PARAM
+.It Dv NGM_CCATM_GET_PORT_PARAM Pq Ic 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
+.It Dv NGM_CCATM_GET_PORTLIST Pq Ic get_portlist
Get a list of all available ports on that node.
This is returned as a
.Bd -literal
@@ -296,20 +296,20 @@ struct ngm_ccatm_portlist {
uint32_t ports[];
};
.Ed
-.It Dv NGM_CCATM_GETSTATE
+.It Dv NGM_CCATM_GETSTATE Pq Ic 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
+.It Dv NGM_CCATM_SETLOG Pq Ic 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
+.It Dv NGM_CCATM_RESET Pq Ic reset
Reset the node.
This is allowed only if the number of user hooks and connected UNI stacks is
zero.
diff --git a/share/man/man4/ng_cisco.4 b/share/man/man4/ng_cisco.4
index e4300a0..143ecdb 100644
--- a/share/man/man4/ng_cisco.4
+++ b/share/man/man4/ng_cisco.4
@@ -114,28 +114,28 @@ understands the
message.
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width foobarbazio
-.It Dv downstream
+.Bl -tag -width ".Va downstream"
+.It Va downstream
The connection to the synchronous line.
-.It Dv inet
+.It Va inet
IP hook.
-.It Dv inet6
+.It Va inet6
IPv6 hook.
-.It Dv atalk
+.It Va atalk
AppleTalk hook.
-.It Dv ipx
-IPX hook
+.It Va 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
+.It Dv NGM_CISCO_SET_IPADDR Pq Ic setipaddr
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
+.It Dv NGM_CISCO_GET_IPADDR Pq Ic getipaddr
This command returns the IP configuration in the same format used by
.Dv NGM_CISCO_SET_IPADDR .
This command is also
@@ -143,13 +143,13 @@ This command is also
by this node type to the
.Dv inet
peer whenever an IP address inquiry packet is received.
-.It Dv NGM_CISCO_GET_STATUS
+.It Dv NGM_CISCO_GET_STATUS Pq Ic getstats
Returns a
.Dv "struct ngciscostat" :
.Bd -literal -offset 4n
struct ngciscostat {
- uint32_t seq_retries; /* # unack'd retries */
- uint32_t keepalive_period; /* in seconds */
+ uint32_t seqRetries; /* # unack'd retries */
+ uint32_t keepAlivePeriod; /* in seconds */
};
.Ed
.El
diff --git a/share/man/man4/ng_deflate.4 b/share/man/man4/ng_deflate.4
index 11dc132..dbf3c56 100644
--- a/share/man/man4/ng_deflate.4
+++ b/share/man/man4/ng_deflate.4
@@ -61,7 +61,7 @@ mode to permit sending uncompressed frames.
.Sh HOOKS
This node type supports the following hooks:
.Pp
-.Bl -tag -compact -width decomp
+.Bl -tag -compact -width ".Va decomp"
.It Va comp
Connection to
.Xr ng_ppp 4
@@ -82,7 +82,7 @@ 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
+.It Dv NGM_DEFLATE_CONFIG Pq Ic config
This command resets and configures the node for a session
(i.e., for compression or decompression).
This command takes a
@@ -101,7 +101,7 @@ 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
+.It Dv NGM_DEFLATE_RESETREQ Pq Ic 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
@@ -113,7 +113,7 @@ 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
+.It Dv NGM_DEFLATE_GET_STATS Pq Ic getstats
This control message obtains statistics for a given hook.
The statistics are returned in
.Vt "struct ng_deflate_stats" :
@@ -127,9 +127,9 @@ struct ng_deflate_stats {
uint64_t Errors;
};
.Ed
-.It Dv NGM_DEFLATE_CLR_STATS Pq Li clrstats
+.It Dv NGM_DEFLATE_CLR_STATS Pq Ic clrstats
This control message clears statistics for a given hook.
-.It Dv NGM_DEFLATE_GETCLR_STATS Pq Li getclrstats
+.It Dv NGM_DEFLATE_GETCLR_STATS Pq Ic getclrstats
This control message obtains and clears statistics for a given hook.
.El
.Sh SHUTDOWN
diff --git a/share/man/man4/ng_eiface.4 b/share/man/man4/ng_eiface.4
index 6699153..d0d6f96 100644
--- a/share/man/man4/ng_eiface.4
+++ b/share/man/man4/ng_eiface.4
@@ -63,8 +63,8 @@ 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
+.Bl -tag -width foo
+.It Dv NGM_EIFACE_SET Pq Ic set
Set link-level address of the interface.
Requires
.Vt "struct ether_addr"
@@ -76,7 +76,7 @@ version, called
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
+.It Dv NGM_EIFACE_GET_IFNAME Pq Ic getifname
Return the name of the associated interface as a
.Dv NUL Ns -terminated
.Tn ASCII
diff --git a/share/man/man4/ng_etf.4 b/share/man/man4/ng_etf.4
index adc3fba..a35f4fa 100644
--- a/share/man/man4/ng_etf.4
+++ b/share/man/man4/ng_etf.4
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 16, 2006
+.Dd November 13, 2012
.Dt NG_ETF 4
.Os
.Sh NAME
@@ -66,7 +66,7 @@ than those configured by the control messages must have arrived via the
hook.
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width ".Em downstream"
+.Bl -tag -width ".Aq Em any legal name"
.It Em downstream
Typically this hook would be connected to a
.Xr ng_ether 4
@@ -89,11 +89,11 @@ with a particular set of ethertypes.
.Sh CONTROL MESSAGES
This node type supports the generic control messages, plus the following:
.Bl -tag -width 4n
-.It Dv NGM_ETF_GET_STATUS
+.It Dv NGM_ETF_GET_STATUS Pq Ic getstatus
This command returns a
.Vt "struct ng_etfstat"
containing node statistics for packet counts.
-.It Dv NGM_ETF_SET_FILTER
+.It Dv NGM_ETF_SET_FILTER Pq Ic setfilter
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
@@ -101,8 +101,8 @@ 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 */
+ char matchhook[NG_HOOKSIZ]; /* hook name */
+ uint16_t ethertype; /* this ethertype to this hook */
};
.Ed
.El
diff --git a/share/man/man4/ng_ether.4 b/share/man/man4/ng_ether.4
index 6ca5c11..610a8af 100644
--- a/share/man/man4/ng_ether.4
+++ b/share/man/man4/ng_ether.4
@@ -124,36 +124,36 @@ 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
+.Bl -tag -width foo
+.It Dv NGM_ETHER_GET_IFNAME Pq Ic 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
+.It Dv NGM_ETHER_GET_IFINDEX Pq Ic getifindex
Returns the global index of the associated interface as a 32 bit integer.
-.It Dv NGM_ETHER_GET_ENADDR Pq Li getenaddr
+.It Dv NGM_ETHER_GET_ENADDR Pq Ic getenaddr
Returns the device's unique six byte Ethernet address.
-.It Dv NGM_ETHER_SET_ENADDR Pq Li setenaddr
+.It Dv NGM_ETHER_SET_ENADDR Pq Ic 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
+.It Dv NGM_ETHER_SET_PROMISC Pq Ic 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
+.It Dv NGM_ETHER_GET_PROMISC Pq Ic 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
+.It Dv NGM_ETHER_SET_AUTOSRC Pq Ic 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
@@ -161,22 +161,22 @@ 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
+.It Dv NGM_ETHER_GET_AUTOSRC Pq Ic 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
+.It Dv NGM_ETHER_ADD_MULTI Pq Ic 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
+.It Dv NGM_ETHER_DEL_MULTI Pq Ic 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
+.It Dv NGM_ETHER_DETACH Pq Ic detach
Detach from underlying Ethernet interface and shut down node.
.El
.Sh SHUTDOWN
diff --git a/share/man/man4/ng_fec.4 b/share/man/man4/ng_fec.4
index 26004ee..f9759cb 100644
--- a/share/man/man4/ng_fec.4
+++ b/share/man/man4/ng_fec.4
@@ -57,20 +57,20 @@ 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
+.Bl -tag -width foo
+.It Dv NGM_FEC_ADD_IFACE Pq Ic 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
+.It Dv NGM_FEC_DEL_IFACE Pq Ic 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
+.Bl -tag -width foo
+.It Dv NGM_FEC_SET_MODE_MAC Pq Ic 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
+.It Dv NGM_FEC_SET_MODE_INET Pq Ic set_mode_inet
Forwarding decisions will be based on the IP address of the destination.
.El
.Sh SHUTDOWN
diff --git a/share/man/man4/ng_frame_relay.4 b/share/man/man4/ng_frame_relay.4
index edc8a8c..576fdfe 100644
--- a/share/man/man4/ng_frame_relay.4
+++ b/share/man/man4/ng_frame_relay.4
@@ -63,10 +63,10 @@ through
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
+.Bl -tag -width ".Va downstream"
+.It Va downstream
The connection to the synchronous line.
-.It Dv dlciX
+.It Va dlciX
Here X is a decimal number from 0 to 1023.
This hook corresponds
to the DLCI X frame relay virtual channel.
diff --git a/share/man/man4/ng_gif.4 b/share/man/man4/ng_gif.4
index 6c4dad2..2f360c0 100644
--- a/share/man/man4/ng_gif.4
+++ b/share/man/man4/ng_gif.4
@@ -99,10 +99,10 @@ packet attached to the front.
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
+.Bl -tag -width ".Va orphans"
+.It Va lower
Connection to the lower device link layer.
-.It Dv orphans
+.It Va orphans
Like
.Dv lower ,
but only receives unrecognized packets.
diff --git a/share/man/man4/ng_gif_demux.4 b/share/man/man4/ng_gif_demux.4
index e549728..b245e09 100644
--- a/share/man/man4/ng_gif_demux.4
+++ b/share/man/man4/ng_gif_demux.4
@@ -70,7 +70,7 @@ hook.
.Sh HOOKS
This node type supports the following hooks:
.Bl -tag -width ".Dv inet6"
-.It Dv gif
+.It Va gif
Connection to the
.Dv lower
or
@@ -78,19 +78,19 @@ or
hook of an
.Xr ng_gif 4
node.
-.It Dv inet
+.It Va inet
Hook for input and output of IP frames.
-.It Dv inet6
+.It Va inet6
Hook for input and output of IPv6 frames.
-.It Dv atalk
+.It Va atalk
Hook for input and output of AppleTalk frames.
-.It Dv ipx
+.It Va ipx
Hook for input and output of IPX frames.
-.It Dv atm
+.It Va atm
Hook for input and output of ATM frames.
-.It Dv natm
+.It Va natm
Hook for input and output of NATM frames.
-.It Dv ns
+.It Va ns
Hook for input and output of NS frames.
.El
.Sh CONTROL MESSAGES
diff --git a/share/man/man4/ng_h4.4 b/share/man/man4/ng_h4.4
index cda15e4..a3b99ed 100644
--- a/share/man/man4/ng_h4.4
+++ b/share/man/man4/ng_h4.4
@@ -71,15 +71,15 @@ similar to the
control message.
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width indent
-.It Dv hook
+.Bl -tag -width ".Va hook"
+.It Va 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
+.Bl -tag -width foo
.It Dv NGM_H4_NODE_RESET
Reset the node.
.It Dv NGM_H4_NODE_GET_STATE
diff --git a/share/man/man4/ng_hci.4 b/share/man/man4/ng_hci.4
index 0234d41..7ef7fcb 100644
--- a/share/man/man4/ng_hci.4
+++ b/share/man/man4/ng_hci.4
@@ -191,7 +191,7 @@ Host Controller.
.Sh HCI INITIALIZATION
On initialization, HCI control application must issue the following HCI
commands (in any order).
-.Bl -tag -width indent
+.Bl -tag -width foo
.It Dv Read_BD_ADDR
To obtain BD_ADDR of the Bluetooth unit.
.It Dv Read_Local_Supported_Features
@@ -250,23 +250,23 @@ typedef struct {
.Ed
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width indent
-.It Dv drv
+.Bl -tag -width ".Va drv"
+.It Va drv
Bluetooth Host Controller Transport Layer hook.
Single HCI packet contained in single
.Vt mbuf
structure.
-.It Dv acl
+.It Va acl
Upper layer protocol/node is connected to the hook.
Single HCI ACL data packet contained in single
.Vt mbuf
structure.
-.It Dv sco
+.It Va sco
Upper layer protocol/node is connected to the hook.
Single HCI SCO data packet contained in single
.Vt mbuf
structure.
-.It Dv raw
+.It Va raw
Raw hook.
Every HCI frame (including HCI command frame) that goes in
or out will be delivered to the hook.
@@ -276,7 +276,7 @@ Single HCI frame contained in single
structure.
.El
.Sh BLUETOOTH UPPER LAYER PROTOCOLS INTERFACE (LP CONTROL MESSAGES)
-.Bl -tag -width indent
+.Bl -tag -width foo
.It Dv NGM_HCI_LP_CON_REQ
Requests the lower protocol to create a connection.
If a physical link
@@ -311,7 +311,7 @@ agreement.
.El
.Sh NETGRAPH CONTROL MESSAGES
This node type supports the generic control messages, plus the following:
-.Bl -tag -width indent
+.Bl -tag -width foo
.It Dv NGM_HCI_NODE_GET_STATE
Returns current state for the node.
.It Dv NGM_HCI_NODE_INIT
diff --git a/share/man/man4/ng_hole.4 b/share/man/man4/ng_hole.4
index 0199d74..4d0c077 100644
--- a/share/man/man4/ng_hole.4
+++ b/share/man/man4/ng_hole.4
@@ -57,19 +57,19 @@ 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
+.Bl -tag -width foo
+.It Dv NGM_HOLE_GET_STATS Pq Ic getstats
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
+.It Dv NGM_HOLE_CLR_STATS Pq Ic clrstats
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
+.It Dv NGM_HOLE_GETCLR_STATS Pq Ic getclrstats
This command is identical to
.Dv NGM_HOLE_GET_STATS ,
except that the statistics are also atomically cleared.
diff --git a/share/man/man4/ng_hub.4 b/share/man/man4/ng_hub.4
index c52aba0..da68723 100644
--- a/share/man/man4/ng_hub.4
+++ b/share/man/man4/ng_hub.4
@@ -48,7 +48,7 @@ as long as the name is unique.
This node type supports the generic control messages, plus the
following:
.Bl -tag -width foo
-.It Dv NGM_HUB_SET_PERSISTENT
+.It Dv NGM_HUB_SET_PERSISTENT Pq Ic setpersistent
This command sets the persistent flag on the node, and takes no arguments.
.El
.Sh SHUTDOWN
diff --git a/share/man/man4/ng_iface.4 b/share/man/man4/ng_iface.4
index 76ec47f..1756f9d 100644
--- a/share/man/man4/ng_iface.4
+++ b/share/man/man4/ng_iface.4
@@ -83,40 +83,40 @@ The default mode is point-to-point.
nodes support the Berkeley Packet Filter (BPF).
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width foobar
-.It Dv inet
+.Bl -tag -width ".Va inet6"
+.It Va inet
Transmission and reception of IP packets.
-.It Dv inet6
+.It Va inet6
Transmission and reception of IPv6 packets.
-.It Dv atalk
+.It Va atalk
Transmission and reception of AppleTalk packets.
-.It Dv ipx
+.It Va ipx
Transmission and reception of IPX packets.
-.It Dv atm
+.It Va atm
Transmission and reception of ATM packets.
-.It Dv natm
+.It Va natm
Transmission and reception of NATM packets.
-.It Dv ns
+.It Va 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
+.It Dv NGM_IFACE_GET_IFNAME Pq Ic 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_IFACE_GET_IFINDEX
+.It Dv NGM_IFACE_GET_IFINDEX Pq Ic getifindex
Returns the global index of the associated interface as a 32 bit integer.
-.It Dv NGM_IFACE_POINT2POINT
+.It Dv NGM_IFACE_POINT2POINT Pq Ic point2point
Set the interface to point-to-point mode.
The interface must not currently be up.
-.It Dv NGM_IFACE_BROADCAST
+.It Dv NGM_IFACE_BROADCAST Pq Ic broadcast
Set the interface to broadcast mode.
The interface must not currently be up.
-.It Dv NGM_CISCO_GET_IPADDR
+.It Dv NGM_CISCO_GET_IPADDR Pq Ic getipaddr
This message is defined by the
.Xr ng_cisco 4
node type; see
diff --git a/share/man/man4/ng_ksocket.4 b/share/man/man4/ng_ksocket.4
index 3a9fcd0..ff67028 100644
--- a/share/man/man4/ng_ksocket.4
+++ b/share/man/man4/ng_ksocket.4
@@ -111,28 +111,28 @@ 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
+.It Dv NGM_KSOCKET_BIND Pq Ic 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
+.It Dv NGM_KSOCKET_LISTEN Pq Ic 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
+.It Dv NGM_KSOCKET_CONNECT Pq Ic 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
+.It Dv NGM_KSOCKET_ACCEPT Pq Ic accept
Equivalent to the
.Xr accept 2
system call on a non-blocking socket.
@@ -148,26 +148,26 @@ when a connection is established.
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
+.It Dv NGM_KSOCKET_GETNAME Pq Ic 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
+.It Dv NGM_KSOCKET_GETPEERNAME Pq Ic 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
+.It Dv NGM_KSOCKET_SETOPT Pq Ic 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
+.It Dv NGM_KSOCKET_GETOPT Pq Ic getopt
Equivalent to the
.Xr getsockopt 2
system call, except that the option is passed in a
diff --git a/share/man/man4/ng_l2cap.4 b/share/man/man4/ng_l2cap.4
index 949b039..ba5df7d 100644
--- a/share/man/man4/ng_l2cap.4
+++ b/share/man/man4/ng_l2cap.4
@@ -104,7 +104,7 @@ 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
+.Bl -tag -width foo
.It Dv NG_L2CAP_CLOSED
In this state, there is no channel associated with this CID.
This is the only
@@ -209,13 +209,13 @@ 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
+.Bl -tag -width ".Va hci"
+.It Va hci
Bluetooth Host Controller Interface downstream hook.
-.It Dv l2c
+.It Va l2c
Upper layer protocol upstream hook.
Usually the Bluetooth L2CAP socket layer is connected to the hook.
-.It Dv ctl
+.It Va ctl
Control hook.
Usually the Bluetooth raw L2CAP sockets layer is connected to the hook.
.El
@@ -242,7 +242,7 @@ and will not set
flag.
There is no reason for this, because they are just notifications and do
not require acknowledgment.
-.Bl -tag -width indent
+.Bl -tag -width foo
.It Dv NGM_L2CAP_L2CA_CON
Requests the creation of a channel representing a logical connection to a
physical address.
@@ -380,7 +380,7 @@ parameter is the PSM value indicating service that should be blocked
.El
.Sh NETGRAPH CONTROL MESSAGES
This node type supports the generic control messages, plus the following:
-.Bl -tag -width indent
+.Bl -tag -width foo
.It Dv NGM_L2CAP_NODE_GET_FLAGS
Returns current state for the node.
.It Dv NGM_L2CAP_NODE_GET_DEBUG
diff --git a/share/man/man4/ng_l2tp.4 b/share/man/man4/ng_l2tp.4
index c556a49..fc5ed07 100644
--- a/share/man/man4/ng_l2tp.4
+++ b/share/man/man4/ng_l2tp.4
@@ -37,7 +37,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd August 2, 2004
+.Dd November 13, 2012
.Dt NG_L2TP 4
.Os
.Sh NAME
@@ -59,13 +59,12 @@ control session packet acknowledgment and retransmission.
The
.Nm l2tp
node type supports the following hooks:
-.Pp
-.Bl -tag -compact -offset indent -width ".Dv session_hhhh"
-.It Dv lower
+.Bl -tag -width ".Va session_hhhh"
+.It Va lower
L2TP frames.
-.It Dv ctrl
+.It Va ctrl
Control packets.
-.It Dv session_hhhh
+.It Va session_hhhh
Session 0xhhhh data packets.
.El
.Pp
@@ -104,8 +103,8 @@ 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
+.Bl -tag -width foo
+.It Dv NGM_L2TP_SET_CONFIG Pq Ic setconfig
This command updates the configuration of the node.
It takes a
.Vt "struct ng_l2tp_config"
@@ -182,14 +181,14 @@ Once a failure condition is declared, each additional retransmission
will cause the
.Nm l2tp
node to send a
-.Dv NGM_L2TP_ACK_FAILURE
+.Dv NGM_L2TP_ACK_FAILURE Pq Ic ackfailure
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
+.It Dv NGM_L2TP_GET_CONFIG Pq Ic getconfig
Returns the current configuration as a
.Vt "struct ng_l2tp_config" .
-.It Dv NGM_L2TP_SET_SESS_CONFIG
+.It Dv NGM_L2TP_SET_SESS_CONFIG Pq Ic setsessconfig
This control message configures a single data session.
The corresponding hook must already be connected before sending this command.
The argument is a
@@ -199,9 +198,9 @@ The argument is a
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? */
+ u_char control_dseq; /* whether we control data sequencing */
+ u_char enable_dseq; /* whether to enable data sequencing */
+ u_char include_length; /* whether to include length field */
};
.Ed
.Pp
@@ -256,35 +255,35 @@ The
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
+.It Dv NGM_L2TP_GET_SESS_CONFIG Pq Ic getsessconfig
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
+.It Dv NGM_L2TP_GET_STATS Pq Ic getstats
This command returns a
.Vt "struct ng_l2tp_stats"
containing statistics of the L2TP tunnel.
-.It Dv NGM_L2TP_CLR_STATS
+.It Dv NGM_L2TP_CLR_STATS Pq Ic clrstats
This command clears the statistics for the L2TP tunnel.
-.It Dv NGM_L2TP_GETCLR_STATS
+.It Dv NGM_L2TP_GETCLR_STATS Pq Ic getclrstats
Same as
.Dv NGM_L2TP_GET_STATS ,
but also atomically clears the statistics as well.
-.It Dv NGM_L2TP_GET_SESSION_STATS
+.It Dv NGM_L2TP_GET_SESSION_STATS Pq Ic getsessstats
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
+.It Dv NGM_L2TP_CLR_SESSION_STATS Pq Ic clrsessstats
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
+.It Dv NGM_L2TP_GETCLR_SESSION_STATS Pq Ic getclrsessstats
Same as
.Dv NGM_L2TP_GET_SESSION_STATS ,
but also atomically clears the statistics as well.
-.It Dv NGM_L2TP_SET_SEQ
+.It Dv NGM_L2TP_SET_SEQ Pq Ic setsequence
This command sets the sequence numbers of a not yet enabled node.
It takes a
.Vt "struct ng_l2tp_seq_config"
diff --git a/share/man/man4/ng_lmi.4 b/share/man/man4/ng_lmi.4
index a8fed52..5378717 100644
--- a/share/man/man4/ng_lmi.4
+++ b/share/man/man4/ng_lmi.4
@@ -35,7 +35,7 @@
.\" $FreeBSD$
.\" $Whistle: ng_lmi.8,v 1.4 1999/01/25 23:46:27 archie Exp $
.\"
-.Dd January 19, 1999
+.Dd November 13, 2012
.Dt NG_LMI 4
.Os
.Sh NAME
@@ -82,16 +82,16 @@ This node also supports the
control message.
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width foobarbaz
-.It Dv annexA
+.Bl -tag -width ".Va auto1023"
+.It Va annexA
ITU Annex A LMI hook.
-.It Dv annexD
+.It Va annexD
ANSI Annex D LMI hook.
-.It Dv group4
+.It Va group4
Group-of-four LMI hook.
-.It Dv auto0
+.It Va auto0
Auto-detection hook for DLCI 0.
-.It Dv auto1023
+.It Va auto1023
Auto-detection hook for DLCI 1023.
.El
.Sh CONTROL MESSAGES
@@ -108,8 +108,8 @@ struct nglmistat {
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 */
+ u_char seen[NGM_LMI_STAT_ARYSIZE]; /* DLCIs ever seen */
+ u_char up[NGM_LMI_STAT_ARYSIZE]; /* DLCIs currently up */
};
.Ed
.It Dv NGM_TEXT_STATUS
diff --git a/share/man/man4/ng_mppc.4 b/share/man/man4/ng_mppc.4
index df3b3a7..e7eeedf 100644
--- a/share/man/man4/ng_mppc.4
+++ b/share/man/man4/ng_mppc.4
@@ -64,16 +64,15 @@ 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
+.Bl -tag -width ".Va decomp"
+.It Va 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
+.It Va decomp
Connection to
.Xr ng_ppp 4
.Dv "decomp"
diff --git a/share/man/man4/ng_nat.4 b/share/man/man4/ng_nat.4
index b2cff1f..2c7da77 100644
--- a/share/man/man4/ng_nat.4
+++ b/share/man/man4/ng_nat.4
@@ -44,7 +44,7 @@ node uses
engine for packet aliasing.
.Sh HOOKS
This node type has two hooks:
-.Bl -tag -width indent
+.Bl -tag -width ".Va out"
.It Va out
Packets received on this hook are considered outgoing and will be
masqueraded to a configured address.
@@ -54,12 +54,12 @@ 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
+.Bl -tag -width foo
+.It Dv NGM_NAT_SET_IPADDR Pq Ic 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
+.It Dv NGM_NAT_SET_MODE Pq Ic setmode
Set node's operation mode using supplied
.Vt "struct ng_nat_mode" .
.Bd -literal
@@ -76,11 +76,11 @@ struct ng_nat_mode {
#define NG_NAT_PROXY_ONLY 0x40
#define NG_NAT_REVERSE 0x80
.Ed
-.It Dv NGM_NAT_SET_TARGET Pq Li settarget
+.It Dv NGM_NAT_SET_TARGET Pq Ic 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
+.It Dv NGM_NAT_REDIRECT_PORT Pq Ic redirectport
Redirect incoming connections arriving to given port(s) to
another host and port(s).
The following
@@ -106,7 +106,7 @@ 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
+.It Dv NGM_NAT_REDIRECT_ADDR Pq Ic redirectaddr
Redirect traffic for public IP address to a machine on the
local network.
This function is known as
@@ -123,7 +123,7 @@ struct ng_nat_redirect_addr {
.Ed
.Pp
Unique ID for this redirection is returned as response to this message.
-.It Dv NGM_NAT_REDIRECT_PROTO Pq Li redirectproto
+.It Dv NGM_NAT_REDIRECT_PROTO Pq Ic redirectproto
Redirect incoming IP packets of protocol
.Va proto
(see
@@ -143,7 +143,7 @@ struct ng_nat_redirect_proto {
.Ed
.Pp
Unique ID for this redirection is returned as response to this message.
-.It Dv NGM_NAT_REDIRECT_DYNAMIC Pq Li redirectdynamic
+.It Dv NGM_NAT_REDIRECT_DYNAMIC Pq Ic 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.
@@ -152,10 +152,10 @@ 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
+.It Dv NGM_NAT_REDIRECT_DELETE Pq Ic redirectdelete
Delete redirection with specified ID (currently active
connections are not affected).
-.It Dv NGM_NAT_ADD_SERVER Pq Li addserver
+.It Dv NGM_NAT_ADD_SERVER Pq Ic 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
@@ -191,7 +191,7 @@ and
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
+.It Dv NGM_NAT_LIST_REDIRECTS Pq Ic listredirects
Return list of configured static redirects as
.Vt "struct ng_nat_list_redirects" .
.Bd -literal
@@ -233,7 +233,7 @@ servers counter is greater than zero, then
and
.Va local_port
are also meaningless.
-.It Dv NGM_NAT_PROXY_RULE Pq Li proxyrule
+.It Dv NGM_NAT_PROXY_RULE Pq Ic proxyrule
Specify a transparent proxying rule (string must be
supplied as argument).
See
diff --git a/share/man/man4/ng_netflow.4 b/share/man/man4/ng_netflow.4
index 36551d5..b88c017 100644
--- a/share/man/man4/ng_netflow.4
+++ b/share/man/man4/ng_netflow.4
@@ -99,7 +99,7 @@ hook of the
node.
.Sh CONTROL MESSAGES
This node type supports the generic control messages, plus the following:
-.Bl -tag -width indent
+.Bl -tag -width foo
.It Dv NGM_NETFLOW_INFO Pq Ic info
Returns some node statistics and the current timeout values in a
.Vt "struct ng_netflow_info" .
diff --git a/share/man/man4/ng_one2many.4 b/share/man/man4/ng_one2many.4
index 948b763..288ea18 100644
--- a/share/man/man4/ng_one2many.4
+++ b/share/man/man4/ng_one2many.4
@@ -34,7 +34,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 1, 2011
+.Dd November 13, 2012
.Dt NG_ONE2MANY 4
.Os
.Sh NAME
@@ -107,7 +107,7 @@ In the future other algorithms may be added as well.
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
+.Bl -tag -width foo
.It Dv NG_ONE2MANY_FAIL_MANUAL
The node is explicitly told which of the links are up via the
.Dv NGM_ONE2MANY_SET_CONFIG
@@ -149,7 +149,7 @@ plus a single hook named
This node type supports the generic control messages, plus the
following:
.Bl -tag -width foo
-.It Dv NGM_ONE2MANY_SET_CONFIG
+.It Dv NGM_ONE2MANY_SET_CONFIG Pq Ic setconfig
Sets the node configuration using a
.Dv "struct ng_one2many_link_config"
as the control message argument:
@@ -174,10 +174,10 @@ are
.Dv NG_ONE2MANY_FAIL_MANUAL
(default) or
.Dv NG_ONE2MANY_FAIL_NOTIFY .
-.It Dv NGM_ONE2MANY_GET_CONFIG
+.It Dv NGM_ONE2MANY_GET_CONFIG Pq Ic getconfig
Returns the current node configuration in a
.Dv "struct ng_one2many_link_config" .
-.It Dv NGM_ONE2MANY_GET_STATS
+.It Dv NGM_ONE2MANY_GET_STATS Pq Ic getstats
This command takes a 32 bit link number as an argument and
returns a
.Dv "struct ng_one2many_link_stats"
@@ -191,6 +191,7 @@ struct ng_one2many_link_stats {
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 */
+ uint64_t memoryFailures; /* times couldn't get mem or mbuf */
};
.Ed
.Pp
@@ -198,10 +199,10 @@ To access statistics for the
.Dv one
link, use the link number
.Dv -1 .
-.It Dv NGM_ONE2MANY_CLR_STATS
+.It Dv NGM_ONE2MANY_CLR_STATS Pq Ic clrstats
This command takes a 32 bit link number as an argument and
clears the statistics for that link.
-.It Dv NGM_ONE2MANY_GETCLR_STATS
+.It Dv NGM_ONE2MANY_GETCLR_STATS Pq Ic getclrstats
Same as
.Dv NGM_ONE2MANY_GET_STATS ,
but also atomically clears the statistics for the link as well.
diff --git a/share/man/man4/ng_patch.4 b/share/man/man4/ng_patch.4
index b1ddf4a..db7ede54 100644
--- a/share/man/man4/ng_patch.4
+++ b/share/man/man4/ng_patch.4
@@ -57,7 +57,7 @@ bytes beginning from
are taken as a single integer in network byte order.
.Sh HOOKS
This node type has two hooks:
-.Bl -tag -width indent
+.Bl -tag -width ".Va out"
.It Va in
Packets received on this hook are modified according to rules specified
in config and then forwarded to
@@ -73,8 +73,8 @@ 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
+.Bl -tag -width foo
+.It Dv NGM_PATCH_SETCONFIG Pq Ic setconfig
This command sets the sequence of modify operations
that will be applied to incoming data on a hook.
The following
@@ -115,16 +115,16 @@ 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
+.It Dv NGM_PATCH_GETCONFIG Pq Ic 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
+.It Dv NGM_PATCH_GET_STATS Pq Ic getstats
Returns node statistics as a
.Vt "struct ng_patch_stats" .
-.It Dv NGM_PATCH_CLR_STATS Pq Li clrstats
+.It Dv NGM_PATCH_CLR_STATS Pq Ic clrstats
Clear node statistics.
-.It Dv NGM_PATCH_GETCLR_STATS Pq Li getclrstats
+.It Dv NGM_PATCH_GETCLR_STATS Pq Ic getclrstats
This command is identical to
.Dv NGM_PATCH_GET_STATS ,
except that the statistics are also atomically cleared.
diff --git a/share/man/man4/ng_ppp.4 b/share/man/man4/ng_ppp.4
index 88cf6e2..d69a59f 100644
--- a/share/man/man4/ng_ppp.4
+++ b/share/man/man4/ng_ppp.4
@@ -35,7 +35,7 @@
.\" $FreeBSD$
.\" $Whistle: ng_ppp.8,v 1.3 1999/01/25 23:46:27 archie Exp $
.\"
-.Dd September 24, 2012
+.Dd November 13, 2012
.Dt NG_PPP 4
.Os
.Sh NAME
@@ -290,55 +290,54 @@ 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>
+.Bl -tag -width ".Va vjc_vjuncomp"
+.It Va link<N>
Individual PPP link number
.Dv <N>
-.It Dv compress
+.It Va compress
Connection to compression engine
-.It Dv decompress
+.It Va decompress
Connection to decompression engine
-.It Dv encrypt
+.It Va encrypt
Connection to encryption engine
-.It Dv decrypt
+.It Va decrypt
Connection to decryption engine
-.It Dv vjc_ip
+.It Va vjc_ip
Connection to
.Xr ng_vjc 4
.Dv ip
hook
-.It Dv vjc_vjcomp
+.It Va vjc_vjcomp
Connection to
.Xr ng_vjc 4
.Dv vjcomp
hook
-.It Dv vjc_vjuncomp
+.It Va vjc_vjuncomp
Connection to
.Xr ng_vjc 4
.Dv vjuncomp
hook
-.It Dv vjc_vjip
+.It Va vjc_vjip
Connection to
.Xr ng_vjc 4
.Dv vjip
hook
-.It Dv inet
+.It Va inet
IP packet data
-.It Dv ipv6
+.It Va ipv6
IPv6 packet data
-.It Dv atalk
+.It Va atalk
AppleTalk packet data
-.It Dv ipx
+.It Va ipx
IPX packet data
-.It Dv bypass
+.It Va 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
+.It Dv NGM_PPP_SET_CONFIG Pq Ic setconfig
This command configures all aspects of the node.
This includes enabling
multi-link PPP, encryption, compression, Van Jacobson compression, and IP,
@@ -359,7 +358,7 @@ struct ng_ppp_link_conf {
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) */
+ uint32_t bandwidth; /* link bandwidth (in bytes/sec/10) */
};
/* Bundle config structure */
@@ -387,28 +386,28 @@ struct ng_ppp_node_conf {
};
.Ed
.Pp
-.It Dv NGM_PPP_GET_CONFIG
+.It Dv NGM_PPP_GET_CONFIG Pq Ic getconfig
Returns the current configuration as a
.Dv "struct ng_ppp_node_conf" .
-.It Dv NGM_PPP_GET_LINK_STATS
+.It Dv NGM_PPP_GET_LINK_STATS Pq Ic getstats
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
+.It Dv NGM_PPP_GET_LINK_STATS64 Pq Ic getstats64
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
+.It Dv NGM_PPP_CLR_LINK_STATS Pq Ic clrstats
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
+.It Dv NGM_PPP_GETCLR_LINK_STATS Pq Ic getclrstats
Same as
.Dv NGM_PPP_GET_LINK_STATS ,
but also atomically clears the statistics as well.
-.It Dv NGM_PPP_GETCLR_LINK_STATS64
+.It Dv NGM_PPP_GETCLR_LINK_STATS64 Pq Ic getclrstats64
Same as NGM_PPP_GETCLR_LINK_STATS but returns
.Dv "struct ng_ppp_link_stat64"
containing 64bit counters.
diff --git a/share/man/man4/ng_pppoe.4 b/share/man/man4/ng_pppoe.4
index e7a9939..a124d67 100644
--- a/share/man/man4/ng_pppoe.4
+++ b/share/man/man4/ng_pppoe.4
@@ -35,7 +35,7 @@
.\" $FreeBSD$
.\" $Whistle: ng_pppoe.8,v 1.1 1999/01/25 23:46:27 archie Exp $
.\"
-.Dd December 27, 2007
+.Dd November 13, 2012
.Dt NG_PPPOE 4
.Os
.Sh NAME
@@ -67,8 +67,8 @@ the
control message.
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width [unspecified]
-.It Dv ethernet
+.Bl -tag -width ".Va [unspecified]"
+.It Va ethernet
The hook that should normally be connected to an
.Xr ng_ether 4
node.
@@ -77,9 +77,9 @@ Once connected,
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
+.It Va debug
Presently no use.
-.It Dv [unspecified]
+.It Va [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
@@ -98,7 +98,7 @@ struct ngpppoestat {
.It Dv NGM_TEXT_STATUS
This generic message returns a human-readable version of the node status.
(not yet)
-.It Dv NGM_PPPOE_CONNECT
+.It Dv NGM_PPPOE_CONNECT Pq Ic 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.
@@ -110,7 +110,7 @@ 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
+.It Dv NGM_PPPOE_LISTEN Pq Ic pppoe_listen
Tell a nominated newly created hook that its session should enter
the state machine as a server listener.
The argument
@@ -124,7 +124,7 @@ 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
+.It Dv NGM_PPPOE_OFFER Pq Ic 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.
@@ -148,18 +148,18 @@ 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 */
+ uint16_t data_len; /* length of the service name */
char data[0]; /* init data goes here */
};
.Ed
.Bl -tag -width 3n
-.It Dv NGM_PPPOE_SUCCESS
+.It Dv NGM_PPPOE_SUCCESS Pq Ic 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
+.It Dv NGM_PPPOE_FAIL Pq Ic 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.
@@ -167,7 +167,7 @@ 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
+.It Dv NGM_PPPOE_CLOSE Pq Ic 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.
@@ -191,7 +191,7 @@ struct ngpppoe_sts {
};
.Ed
.Bl -tag -width 3n
-.It Dv NGM_PPPOE_GETMODE
+.It Dv NGM_PPPOE_GETMODE Pq Ic pppoe_getmode
This command returns the current compatibility mode of the node
as a string.
.Tn ASCII
@@ -221,7 +221,7 @@ 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
+.It Dv NGM_PPPOE_SETMODE Pq Ic pppoe_setmode
Configure node to the specified mode.
The string argument is required.
This command understands the same keywords that are returned by the
@@ -235,7 +235,7 @@ 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
+.It Dv NGM_PPPOE_SETENADDR Pq Ic 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
diff --git a/share/man/man4/ng_pptpgre.4 b/share/man/man4/ng_pptpgre.4
index e0d41f1..3e26f9c 100644
--- a/share/man/man4/ng_pptpgre.4
+++ b/share/man/man4/ng_pptpgre.4
@@ -35,7 +35,7 @@
.\" $FreeBSD$
.\" $Whistle: ng_pptpgre.8,v 1.2 1999/12/08 00:20:53 archie Exp $
.\"
-.Dd March 29, 2008
+.Dd November 13, 2012
.Dt NG_PPTPGRE 4
.Os
.Sh NAME
@@ -72,19 +72,18 @@ hook of a
node.
.Sh HOOKS
This node type supports the following hooks:
-.Pp
-.Bl -tag -compact -width ".Li session_hhhh"
-.It Li session_hhhh
+.Bl -tag -width ".Va session_hhhh"
+.It Va session_hhhh
Session 0xhhhh data packets to the upper protocol layers
-.It Li upper
+.It Va upper
Same as session_hhhh, but for single session with configurable cid (legacy)
-.It Li lower
+.It Va 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
+.Bl -tag -width foo
+.It Dv NGM_PPTPGRE_SET_CONFIG Pq Ic setconfig
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
@@ -95,7 +94,7 @@ as an argument:
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 enableAlwaysAck; /* always include ack with data */
u_char enableWindowing; /* enable windowing algorithm */
uint16_t cid; /* my call id */
uint16_t peerCid; /* peer call id */
@@ -124,16 +123,16 @@ 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
+.It Dv NGM_PPTPGRE_GET_CONFIG Pq Ic getconfig
Takes two byte argument as cid and returns the current configuration as a
.Vt "struct ng_pptpgre_conf" .
-.It Dv NGM_PPTPGRE_GET_STATS
+.It Dv NGM_PPTPGRE_GET_STATS Pq Ic getstats
This command returns a
.Vt "struct ng_pptpgre_stats"
containing various node statistics.
-.It Dv NGM_PPTPGRE_CLR_STATS
+.It Dv NGM_PPTPGRE_CLR_STATS Pq Ic clrstats
This command resets the node statistics.
-.It Dv NGM_PPTPGRE_GETCLR_STATS
+.It Dv NGM_PPTPGRE_GETCLR_STATS Pq Ic getclrstats
This command atomically gets and resets the node statistics, returning a
.Vt "struct ng_pptpgre_stats" .
.El
diff --git a/share/man/man4/ng_pred1.4 b/share/man/man4/ng_pred1.4
index a8c8c5e..fed3fdc 100644
--- a/share/man/man4/ng_pred1.4
+++ b/share/man/man4/ng_pred1.4
@@ -54,7 +54,7 @@ node type hook of the same name.
.Sh HOOKS
This node type supports the following hooks:
.Pp
-.Bl -tag -compact -width decomp
+.Bl -tag -compact -width ".Va decomp"
.It Va comp
Connection to
.Xr ng_ppp 4
@@ -74,7 +74,7 @@ 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
+.It Dv NGM_PRED1_CONFIG Pq Ic config
This command resets and configures the node for a session
(i.e., for compression or decompression).
This command takes a
@@ -88,7 +88,7 @@ struct ng_pred1_config {
The
.Ft enable
field enables traffic flow through the node.
-.It Dv NGM_PRED1_RESETREQ Pq Li resetreq
+.It Dv NGM_PRED1_RESETREQ Pq Ic 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
@@ -100,7 +100,7 @@ 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
+.It Dv NGM_PRED1_GET_STATS Pq Ic getstats
This control message obtains statistics for a given hook.
The statistics are returned in
.Vt "struct ng_pred1_stats" :
@@ -114,9 +114,9 @@ struct ng_pred1_stats {
uint64_t Errors;
};
.Ed
-.It Dv NGM_PRED1_CLR_STATS Pq Li clrstats
+.It Dv NGM_PRED1_CLR_STATS Pq Ic clrstats
This control message clears statistics for a given hook.
-.It Dv NGM_PRED1_GETCLR_STATS Pq Li getclrstats
+.It Dv NGM_PRED1_GETCLR_STATS Pq Ic getclrstats
This control message obtains and clears statistics for a given hook.
.El
.Sh SHUTDOWN
diff --git a/share/man/man4/ng_rfc1490.4 b/share/man/man4/ng_rfc1490.4
index 472b308..de45fb7 100644
--- a/share/man/man4/ng_rfc1490.4
+++ b/share/man/man4/ng_rfc1490.4
@@ -78,20 +78,20 @@ hook of an
node.
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width foobarbazum
-.It Dv downstream
+.Bl -tag -width ".Va downstream"
+.It Va downstream
Connects to the RFC 1490 peer entity.
-.It Dv ethernet
+.It Va ethernet
Transmits and receives bridged raw Ethernet frames, without a checksum.
-.It Dv inet
+.It Va inet
Transmits and receives raw IP frames.
-.It Dv ppp
+.It Va 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
+.Bl -tag -width foo
+.It Dv NGM_RFC1490_SET_ENCAP Pq Ic 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:
@@ -105,7 +105,7 @@ Also conforms to RFC1490/2427.
IP packets are sent and received using proprietary Cisco encapsulation
method.
.El
-.It Dv NGM_RFC1490_GETENCAP
+.It Dv NGM_RFC1490_GET_ENCAP Pq Ic getencap
This command returns current encapsulation method on the node.
.El
.Sh SHUTDOWN
diff --git a/share/man/man4/ng_source.4 b/share/man/man4/ng_source.4
index 7c55751..5205bc4 100644
--- a/share/man/man4/ng_source.4
+++ b/share/man/man4/ng_source.4
@@ -111,10 +111,10 @@ 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
+.Bl -tag -width foo
.It Dv NGM_SOURCE_GET_STATS Pq Ic getstats
Returns a structure containing the following fields:
-.Bl -tag -width indent
+.Bl -tag -width ".Va elapsedTime"
.It Va outOctets
The number of octets/bytes sent out the
.Va output
@@ -185,7 +185,7 @@ 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
+.Bl -tag -width ".Va offset"
.It Va offset
The offset from the beginning of the packet at which the timestamp is to be
inserted.
@@ -200,7 +200,7 @@ 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
+.Bl -tag -width ".Va increment"
.It Va offset
The offset from the beginning of the packet at which the counter is to be
inserted.
diff --git a/share/man/man4/ng_split.4 b/share/man/man4/ng_split.4
index 9b74863..4062ca2 100644
--- a/share/man/man4/ng_split.4
+++ b/share/man/man4/ng_split.4
@@ -49,17 +49,17 @@ 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
+.Bl -tag -width ".Va mixed"
+.It Va in
Packets received on
.Em in
are forwarded to
.Em mixed .
-.It Dv out
+.It Va out
Packets received on
.Em out
will be discarded as illegal.
-.It Dv mixed
+.It Va mixed
Packets received on
.Em mixed
are forwarded to
diff --git a/share/man/man4/ng_sppp.4 b/share/man/man4/ng_sppp.4
index 49f8a4c..d23268f 100644
--- a/share/man/man4/ng_sppp.4
+++ b/share/man/man4/ng_sppp.4
@@ -99,8 +99,8 @@ 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
+.Bl -tag -width foo
+.It Dv NGM_SPPP_GET_IFNAME Pq Ic getifname
Returns the name of the associated interface as a
.Dv NUL Ns -terminated
.Tn ASCII
diff --git a/share/man/man4/ng_sscfu.4 b/share/man/man4/ng_sscfu.4
index 0679d58..c44c1f4 100644
--- a/share/man/man4/ng_sscfu.4
+++ b/share/man/man4/ng_sscfu.4
@@ -123,8 +123,8 @@ reset.
The
.Nm sscfu
node understands the generic messages plus the following:
-.Bl -tag -width indent
-.It Dv NGM_SSCFU_GETDEFPARAM
+.Bl -tag -width foo
+.It Dv NGM_SSCFU_GETDEFPARAM Pq Ic getdefparam
This message returns a
.Vt sscop_param
structure, which contains the default parameters for the SSCOP at the
@@ -132,22 +132,22 @@ 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
+.It Dv NGM_SSCFU_ENABLE Pq Ic 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
+.It Dv NGM_SSCFU_DISABLE Pq Ic disable
Destroy the SSCF instance.
After this, all messages on any hooks are discarded.
-.It Dv NGM_SSCFU_GETDEBUG
+.It Dv NGM_SSCFU_GETDEBUG Pq Ic getdebug
Retrieve the debugging flags in a
.Vt uint32_t .
-.It Dv NGM_SSCFU_SETDEBUG
+.It Dv NGM_SSCFU_SETDEBUG Pq Ic setdebug
Set debugging flags.
The argument must be a
.Vt uint32_t .
-.It Dv NGM_SSCFU_GETSTATE
+.It Dv NGM_SSCFU_GETSTATE Pq Ic getstate
Retrieve the current state of the SSCFU instance in a
.Vt uint32_t .
If the node has not been enabled, 0 is returned.
diff --git a/share/man/man4/ng_sscop.4 b/share/man/man4/ng_sscop.4
index 0c6f0d4..5496a37 100644
--- a/share/man/man4/ng_sscop.4
+++ b/share/man/man4/ng_sscop.4
@@ -204,8 +204,8 @@ struct sscop_merr {
The
.Nm sscop
node understands the generic control messages, plus the following:
-.Bl -tag -width indent
-.It Dv NGM_SSCOP_SETPARAM
+.Bl -tag -width foo
+.It Dv NGM_SSCOP_SETPARAM Pq Ic setparam
Sets operational parameters of the SSCOP instance and takes the
following structure:
.Bd -literal
@@ -312,28 +312,28 @@ but that could not be set and
is an
.Xr errno 2
code describing why the parameter could not be set.
-.It Dv NGM_SSCOP_GETPARAM
+.It Dv NGM_SSCOP_GETPARAM Pq Ic getparam
This message returns the current operational parameters of the SSCOP
instance in a
.Vt sscop_param
structure.
-.It Dv NGM_SSCOP_ENABLE
+.It Dv NGM_SSCOP_ENABLE Pq Ic 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
+.It Dv NGM_SSCOP_DISABLE Pq Ic disable
Destroy the SSCOP instance.
After this, all messages on any hooks are
discarded.
-.It Dv NGM_SSCOP_SETDEBUG
+.It Dv NGM_SSCOP_SETDEBUG Pq Ic setdebug
Set debugging flags.
The argument is a
.Vt uint32_t .
-.It Dv NGM_SSCOP_GETDEBUG
+.It Dv NGM_SSCOP_GETDEBUG Pq Ic getdebug
Retrieve the actual debugging flags.
Needs no arguments and responds with a
.Vt uint32_t .
-.It Dv NGM_SSCOP_GETSTATE
+.It Dv NGM_SSCOP_GETSTATE Pq Ic 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.
@@ -352,7 +352,7 @@ state of the protocol.
At the upper layer interface, the
.Nm sscop
node handles three types of flow control messages:
-.Bl -tag -width indent
+.Bl -tag -width foo
.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
diff --git a/share/man/man4/ng_tag.4 b/share/man/man4/ng_tag.4
index 98cfa24..e025a26 100644
--- a/share/man/man4/ng_tag.4
+++ b/share/man/man4/ng_tag.4
@@ -112,8 +112,8 @@ 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
+.Bl -tag -width foo
+.It Dv NGM_TAG_SET_HOOKIN Pq Ic sethookin
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:
@@ -149,14 +149,14 @@ respectively.
If
.Va strip
flag is non-zero, then found tag is deleted from list of packet tags.
-.It Dv NGM_TAG_GET_HOOKIN
+.It Dv NGM_TAG_GET_HOOKIN Pq Ic gethookin
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
+.It Dv NGM_TAG_SET_HOOKOUT Pq Ic sethookout
This command sets tags values which will be applied to outgoing
packets.
The following structure must be supplied as an argument:
@@ -175,25 +175,25 @@ The hook to be updated is specified in
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
+.It Dv NGM_TAG_GET_HOOKOUT Pq Ic gethookout
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
+.It Dv NGM_TAG_GET_STATS Pq Ic getstats
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
+.It Dv NGM_TAG_CLR_STATS Pq Ic clrstats
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
+.It Dv NGM_TAG_GETCLR_STATS Pq Ic getclrstats
This command is identical to
.Dv NGM_TAG_GET_STATS ,
except that the statistics are also atomically cleared.
diff --git a/share/man/man4/ng_tcpmss.4 b/share/man/man4/ng_tcpmss.4
index fc610b6..240d975 100644
--- a/share/man/man4/ng_tcpmss.4
+++ b/share/man/man4/ng_tcpmss.4
@@ -45,8 +45,8 @@ The
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
+.Bl -tag -width foo
+.It Dv NGM_TCPMSS_CONFIG Pq Ic config
This control message configures node to do given MSS adjusting on
a particular hook.
It requires the
@@ -69,7 +69,7 @@ if it exceeds
.Va maxMSS .
After that, packets would be sent to hook
.Va outHook .
-.It Dv NGM_TCPMSS_GET_STATS Pq Li getstats
+.It Dv NGM_TCPMSS_GET_STATS Pq Ic getstats
This control message obtains statistics for a given hook.
The statistics are returned in
.Vt "struct ng_tcpmss_hookstat" :
@@ -82,9 +82,9 @@ struct ng_tcpmss_hookstat {
uint64_t FixedPkts; /* changed packets */
};
.Ed
-.It Dv NGM_TCPMSS_CLR_STATS Pq Li clrstats
+.It Dv NGM_TCPMSS_CLR_STATS Pq Ic clrstats
This control message clears statistics for a given hook.
-.It Dv NGM_TCPMSS_GETCLR_STATS Pq Li getclrstats
+.It Dv NGM_TCPMSS_GETCLR_STATS Pq Ic getclrstats
This control message obtains and clears statistics for a given hook.
.El
.Sh EXAMPLES
diff --git a/share/man/man4/ng_tee.4 b/share/man/man4/ng_tee.4
index 84801b7..e86209d 100644
--- a/share/man/man4/ng_tee.4
+++ b/share/man/man4/ng_tee.4
@@ -88,23 +88,23 @@ and
respectively.
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width foobarbarfoo
-.It Dv right
+.Bl -tag -width ".Va left2right"
+.It Va right
The connection to the node on the right.
-.It Dv left
+.It Va left
The connection to the node on the left.
-.It Dv right2left
+.It Va right2left
Tap for right to left traffic.
-.It Dv left2right
+.It Va 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
+.It Dv NGM_TEE_GET_STATS Pq Ic getstats
Get statistics, returned as a
.Dv "struct ng_tee_stats" .
-.It Dv NGM_TEE_CLR_STATS
+.It Dv NGM_TEE_CLR_STATS Pq Ic clrstats
Clear statistics.
.El
.Sh SHUTDOWN
diff --git a/share/man/man4/ng_tty.4 b/share/man/man4/ng_tty.4
index dc73e58..3add57c 100644
--- a/share/man/man4/ng_tty.4
+++ b/share/man/man4/ng_tty.4
@@ -80,8 +80,8 @@ 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
+.Bl -tag -width ".Va hook"
+.It Va hook
.Xr tty 4
serial data contained in
.Dv mbuf
diff --git a/share/man/man4/ng_ubt.4 b/share/man/man4/ng_ubt.4
index ebb454d..6a39ddd 100644
--- a/share/man/man4/ng_ubt.4
+++ b/share/man/man4/ng_ubt.4
@@ -76,8 +76,8 @@ TDK Bluetooth USB adapter
.El
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width indent
-.It Dv hook
+.Bl -tag -width ".Va hook"
+.It Va hook
single HCI frame contained in a single
.Vt mbuf
structure.
@@ -85,22 +85,22 @@ structure.
.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
+.It Dv NGM_UBT_NODE_GET_DEBUG Pq Ic get_debug
Returns an integer containing the current debug level for the node.
-.It Dv NGM_UBT_NODE_SET_DEBUG
+.It Dv NGM_UBT_NODE_SET_DEBUG Pq Ic set_debug
This command takes an integer argument and sets the current debug level
for the node.
-.It Dv NGM_UBT_NODE_GET_QLEN
+.It Dv NGM_UBT_NODE_GET_QLEN Pq Ic 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
+.It Dv NGM_UBT_NODE_SET_QLEN Pq Ic 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
+.It Dv NGM_UBT_NODE_GET_STAT Pq Ic 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
+.It Dv NGM_UBT_NODE_RESET_STAT Pq Ic reset_stat
Reset all statistic counters to zero.
.El
.Sh SHUTDOWN
diff --git a/share/man/man4/ng_uni.4 b/share/man/man4/ng_uni.4
index f6eb05f..a2e3c45 100644
--- a/share/man/man4/ng_uni.4
+++ b/share/man/man4/ng_uni.4
@@ -212,7 +212,7 @@ enum uni_sig {
.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
+.Bl -tag -width foo
.It Dv UNIAPI_ERROR
This is the error response, mentioned earlier.
It carries an error code or
@@ -245,8 +245,8 @@ Each of the signals is followed by a fixed size structure defined in
The
.Nm uni
node understands the standard control messages, plus the following:
-.Bl -tag -width indent
-.It Dv NGM_UNI_SETDEBUG
+.Bl -tag -width foo
+.It Dv NGM_UNI_SETDEBUG Pq Ic setdebug
Set debugging facility levels.
The UNI stack defines a number of debugging
facilities, each one associated with a debugging level.
@@ -258,12 +258,12 @@ struct ngm_uni_debug {
uint32_t level[UNI_MAXFACILITY];
};
.Ed
-.It Dv NGM_UNI_SETDEBUG
+.It Dv NGM_UNI_GETDEBUG Pq Ic getdebug
Get debugging facility levels.
This returns an
.Vt ngm_uni_debug
structure.
-.It Dv NGM_UNI_GET_CONFIG
+.It Dv NGM_UNI_GET_CONFIG Pq Ic get_config
Retrieve the current configuration of the UNI instance.
This message returns a
.Vt uni_config
@@ -326,7 +326,7 @@ 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
+.It Dv NGM_UNI_SET_CONFIG Pq Ic set_config
Change the UNI configuration.
This takes a
.Bd -literal
@@ -386,10 +386,10 @@ the definitions from
and
.Vt "enum uni_option"
should be used.
-.It Dv NGM_UNI_ENABLE
+.It Dv NGM_UNI_ENABLE Pq Ic enable
Create the UNI instance and enable processing.
Before the UNI is enabled parameters cannot be retrieved or set.
-.It Dv NGM_UNI_DISABLE
+.It Dv NGM_UNI_DISABLE Pq Ic disable
Destroy the UNI instance and free all resources.
Note, that connections are not released.
.El
diff --git a/share/man/man4/ng_vjc.4 b/share/man/man4/ng_vjc.4
index 714aa7e..83f0269 100644
--- a/share/man/man4/ng_vjc.4
+++ b/share/man/man4/ng_vjc.4
@@ -103,20 +103,20 @@ and
hooks, respectively.
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width foobarbazi
-.It Dv ip
+.Bl -tag -width ".Va vjuncomp"
+.It Va ip
Upstream (uncompressed) IP packets.
-.It Dv vjcomp
+.It Va vjcomp
Downstream compressed TCP packets.
-.It Dv vjuncomp
+.It Va vjuncomp
Downstream uncompressed TCP packets.
-.It Dv vjip
+.It Va 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
+.It Dv NGM_VJC_SET_CONFIG Pq Ic setconfig
This command resets the compression state and configures it according
to the supplied
.Dv "struct ngm_vjc_config"
@@ -169,12 +169,12 @@ either (a) it is not possible for an outgoing frame to be lost, or
reported to the peer's decompression engine (see
.Dv NGM_VJC_RECV_ERROR
below).
-.It Dv NGM_VJC_GET_STATE
+.It Dv NGM_VJC_GET_STATE Pq Ic getstate
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
+.It Dv NGM_VJC_CLR_STATS Pq Ic clrstats
Clears the node statistics counters.
Statistics are also cleared whenever the
.Dv enableComp
@@ -183,7 +183,7 @@ or
fields are changed from zero to one by a
.Dv NGM_VJC_SET_CONFIG
control message.
-.It Dv NGM_VJC_RECV_ERROR
+.It Dv NGM_VJC_RECV_ERROR Pq Ic recverror
When the peer has CID header field compression enabled,
this message must be sent to the local
.Nm vjc
diff --git a/share/man/man4/ng_vlan.4 b/share/man/man4/ng_vlan.4
index bf673cf..1efaccc 100644
--- a/share/man/man4/ng_vlan.4
+++ b/share/man/man4/ng_vlan.4
@@ -78,7 +78,7 @@ hooks is tagged accordingly and sent out the
hook.
.Sh HOOKS
This node type supports the following hooks:
-.Bl -tag -width ".Va downstream"
+.Bl -tag -width "Aq Em any valid name"
.It Va downstream
Typically this hook would be connected to a
.Xr ng_ether 4
@@ -102,12 +102,12 @@ 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
+.Bl -tag -width foo
+.It Dv NGM_VLAN_ADD_FILTER Pq Ic addfilter
Associates a hook with the tag.
-.It Dv NGM_VLAN_DEL_FILTER Pq Li delfilter
+.It Dv NGM_VLAN_DEL_FILTER Pq Ic delfilter
Disassociates a hook from the tag.
-.It Dv NGM_VLAN_GET_TABLE Pq Li gettable
+.It Dv NGM_VLAN_GET_TABLE Pq Ic gettable
Returns a table of all hook/tag associations.
.El
.Sh EXAMPLES
diff --git a/share/man/man4/unix.4 b/share/man/man4/unix.4
index 97e797c..363f185 100644
--- a/share/man/man4/unix.4
+++ b/share/man/man4/unix.4
@@ -32,7 +32,7 @@
.\" @(#)unix.4 8.1 (Berkeley) 6/9/93
.\" $FreeBSD$
.\"
-.Dd October 5, 2009
+.Dd November 16, 2012
.Dt UNIX 4
.Os
.Sh NAME
@@ -123,20 +123,10 @@ of a
or
.Xr sendto 2
must be writable.
-.Sh PROTOCOLS
+.Sh PASSING FILE DESCRIPTORS
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
+sockets support the communication of
.Ux
file descriptors through the use of the
.Va msg_control
@@ -173,36 +163,7 @@ 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
+.Sh SOCKET OPTIONS
.Tn UNIX
domain sockets support a number of socket options which can be set with
.Xr setsockopt 2
@@ -256,6 +217,13 @@ cmsg_len = CMSG_LEN(SOCKCREDSIZE(ngroups))
cmsg_level = SOL_SOCKET
cmsg_type = SCM_CREDS
.Ed
+.Pp
+On
+.Dv SOCK_STREAM
+and
+.Dv SOCK_SEQPACKET
+sockets credentials are passed only on the first read from a socket,
+then system clears the option on socket.
.It Dv LOCAL_CONNWAIT
Used with
.Dv SOCK_STREAM
@@ -264,8 +232,62 @@ sockets, this option causes the
function to block until
.Xr accept 2
has been called on the listening socket.
+.It Dv LOCAL_PEERCRED
+Requested via
+.Xr getsockopt 2
+on a
+.Dv SOCK_STREAM
+socket returns credentials of the remote side.
+These will arrive in the form of a filled in
+.Vt xucred
+structure, defined in
+.In sys/ucred.h
+as follows:
+.Bd -literal
+struct xucred {
+ u_int cr_version; /* structure layout version */
+ uid_t cr_uid; /* effective user id */
+ short cr_ngroups; /* number of groups */
+ gid_t cr_groups[XU_NGROUPS]; /* groups */
+};
+.Ed
+The
+.Vt cr_version
+fields should be checked against
+.Dv XUCRED_VERSION
+define.
+.Pp
+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
+To reliably obtain peer credentials on a
+.Dv SOCK_DGRAM
+socket refer to the
+.Dv LOCAL_CREDS
+socket option.
.El
.Sh SEE ALSO
+.Xr connect 2 ,
+.Xr dup 2 ,
+.Xr fcntl 2 ,
+.Xr getsockopt 2 ,
+.Xr listen 2 ,
+.Xr recvmsg 2 ,
+.Xr sendto 2 ,
+.Xr setsockopt 2 ,
.Xr socket 2 ,
.Xr intro 4
.Rs
diff --git a/share/man/man7/environ.7 b/share/man/man7/environ.7
index 51f9a4e..2b80987 100644
--- a/share/man/man7/environ.7
+++ b/share/man/man7/environ.7
@@ -56,13 +56,9 @@ The size of the block units used by several commands, most notably
.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.
+This variable is processed by the
+.Xr getbsize 3
+function.
.It Ev COLUMNS
The user's preferred width in column positions for the terminal.
Utilities such as
@@ -259,6 +255,7 @@ built-in command in
.Xr execve 2 ,
.Xr execle 3 ,
.Xr getenv 3 ,
+.Xr getbsize 3 ,
.Xr setenv 3 ,
.Xr setlocale 3 ,
.Xr system 3 ,
diff --git a/share/man/man7/tuning.7 b/share/man/man7/tuning.7
index b859c28..36544bb 100644
--- a/share/man/man7/tuning.7
+++ b/share/man/man7/tuning.7
@@ -23,50 +23,26 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 11, 2012
+.Dd October 20, 2012
.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
+The swap partition should typically be approximately 2x the size of
+main memory
+for systems with less than 4GB of RAM, or approximately equal to
+the size of 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
+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
+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.
+controllers), 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.
@@ -79,100 +55,7 @@ little, swap space is the saving grace of
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 GB
-.Pa /usr
-partition.
-However, if you install a lot of ports
-(especially window managers and Linux-emulated binaries), we recommend
-at least a 2 GB
-.Pa /usr
-and if you also intend to keep system source
-on the machine, we recommend a 3 GB
-.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.
+It is not a good idea to make one large partition.
First,
each partition has different operational characteristics and separating them
allows the file system to tune itself to those characteristics.
@@ -181,113 +64,23 @@ 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 16K or 32K file system block sizes.
-The default file system block size is 32K,
-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 32K
-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 4K, 8K, or 16K 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 65536, 131072, 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 65536 ..." .
-.Pp
+The only
.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
+option worthwhile turning on is
.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
@@ -301,7 +94,7 @@ 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.\&
+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
@@ -516,7 +309,7 @@ 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
+Higher write queuing values may also add latency to reads occurring at
the same time.
.Pp
The
@@ -645,7 +438,7 @@ 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
+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
@@ -756,7 +549,7 @@ 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.\&
+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.
@@ -947,42 +740,12 @@ 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
+are perpetually 0%) then you need to consider upgrading the CPU
+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.
@@ -1001,21 +764,15 @@ 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
+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.\&
+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
@@ -1041,6 +798,7 @@ over services you export from your box (web services, email).
.Xr hier 7 ,
.Xr ports 7 ,
.Xr boot 8 ,
+.Xr bsdinstall 8 ,
.Xr bsdlabel 8 ,
.Xr ccdconfig 8 ,
.Xr config 8 ,
@@ -1055,7 +813,6 @@ over services you export from your box (web services, email).
.Xr newfs 8 ,
.Xr route 8 ,
.Xr sysctl 8 ,
-.Xr sysinstall 8 ,
.Xr tunefs 8
.Sh HISTORY
The
@@ -1066,3 +823,5 @@ and first appeared
in
.Fx 4.3 ,
May 2001.
+The manual page was greatly modified by
+.An Eitan Adler Aq eadler@FreeBSD.org
diff --git a/share/man/man9/firmware.9 b/share/man/man9/firmware.9
index 0f4fa9a..807099d 100644
--- a/share/man/man9/firmware.9
+++ b/share/man/man9/firmware.9
@@ -255,11 +255,11 @@ IxNpeMicrocode.dat optional npe_fw \\
Note that generating the firmware modules in this way requires
the availability of the following tools:
.Xr awk ,
-.Xr Make ,
+.Xr make ,
the compiler and the linker.
.Sh SEE ALSO
-.Xr module 9 ,
-.Xr kld 4
+.Xr kld 4 ,
+.Xr module 9
.Pp
.Pa /usr/share/examples/kld/firmware
.Sh HISTORY
diff --git a/share/man/man9/malloc.9 b/share/man/man9/malloc.9
index 51b8cd3..9653b58 100644
--- a/share/man/man9/malloc.9
+++ b/share/man/man9/malloc.9
@@ -29,7 +29,7 @@
.\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $
.\" $FreeBSD$
.\"
-.Dd January 28, 2012
+.Dd November 15, 2012
.Dt MALLOC 9
.Os
.Sh NAME
@@ -153,13 +153,12 @@ 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.
+Indicates that the system can use its reserve of memory to satisfy the
+request.
+This option should only be used in combination with
+.Dv M_NOWAIT
+when an allocation failure cannot be tolerated by the caller without
+catastrophic effects on the system.
.El
.Pp
Exactly one of either
diff --git a/share/man/man9/mbuf.9 b/share/man/man9/mbuf.9
index 6fa131e..42fe372 100644
--- a/share/man/man9/mbuf.9
+++ b/share/man/man9/mbuf.9
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 18, 2011
+.Dd November 13, 2012
.Dt MBUF 9
.Os
.\"
@@ -1063,45 +1063,6 @@ 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
@@ -1147,22 +1108,6 @@ 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 ,
diff --git a/share/man/man9/mi_switch.9 b/share/man/man9/mi_switch.9
index 46e7a8e..8353567 100644
--- a/share/man/man9/mi_switch.9
+++ b/share/man/man9/mi_switch.9
@@ -60,7 +60,7 @@ can be enumerated as follows:
.It
From within a function such as
.Xr cv_wait 9 ,
-.Xr mtx_lock ,
+.Xr mtx_lock 9 ,
or
.Xr tsleep 9
when the current thread
diff --git a/share/man/man9/pfil.9 b/share/man/man9/pfil.9
index 9425f5d..d34c579 100644
--- a/share/man/man9/pfil.9
+++ b/share/man/man9/pfil.9
@@ -203,8 +203,8 @@ function
might sleep!
.Sh SEE ALSO
.Xr bpf 4 ,
-.Xr if_bridge 4
-.Xr rmlock 4
+.Xr if_bridge 4 ,
+.Xr rmlock 9
.Sh HISTORY
The
.Nm
diff --git a/share/misc/flowers b/share/misc/flowers
index 107551c..0cf0665 100644
--- a/share/misc/flowers
+++ b/share/misc/flowers
@@ -6,7 +6,7 @@ African violet:Such worth is rare.
Apple blossom:Preference.
Bachelor's button:Celibacy.
Bay leaf:I change but in death.
-Camelia:Reflected loveliness.
+Camellia:Reflected loveliness.
Chrysanthemum, other color:Slighted love.
Chrysanthemum, red:I love.
Chrysanthemum, white:Truth.
@@ -21,8 +21,8 @@ Ivy:Friendship, fidelity, marriage.
Jasmine:Amiability, transports of joy, sensuality.
Leaves (dead):Melancholy.
Lilac:Youthful innocence.
-Lilly of the valley:Return of happiness.
-Lilly:Purity, sweetness.
+Lily of the valley:Return of happiness.
+Lily:Purity, sweetness.
Magnolia:Dignity, perseverance.
Marigold:Jealousy.
Mint:Virtue.
diff --git a/share/termcap/termcap.src b/share/termcap/termcap.src
index a5117a8..4bd4aab 100644
--- a/share/termcap/termcap.src
+++ b/share/termcap/termcap.src
@@ -2825,7 +2825,7 @@ xterm-basic|modern xterm common:\
:as=\E(0:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:\
:cm=\E[%i%d;%dH:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:\
:ei=\E[4l:ho=\E[H:im=\E[4h:is=\E[!p\E[?3;4l\E[4l\E>:\
- :kD=\E[3~:kb=^H:ke=\E[?1l\E>:ks=\E[?1h\E=:le=^H:md=\E[1m:\
+ :kD=\E[3~:kb=^H:ke=\E[?1l\E>:ks=\E[?1h\E=:kB=\E[Z:le=^H:md=\E[1m:\
:me=\E[m:ml=\El:mr=\E[7m:mu=\Em:nd=\E[C:op=\E[39;49m:\
:rc=\E8:rs=\E[!p\E[?3;4l\E[4l\E>:sc=\E7:se=\E[27m:sf=^J:\
:so=\E[7m:sr=\EM:st=\EH:\
diff --git a/sys/amd64/amd64/minidump_machdep.c b/sys/amd64/amd64/minidump_machdep.c
index 9be642e..c1b03c1 100644
--- a/sys/amd64/amd64/minidump_machdep.c
+++ b/sys/amd64/amd64/minidump_machdep.c
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/watchdog.h>
#include <vm/vm.h>
#include <vm/vm_page.h>
+#include <vm/vm_phys.h>
#include <vm/pmap.h>
#include <machine/atomic.h>
#include <machine/elf.h>
diff --git a/sys/amd64/amd64/uma_machdep.c b/sys/amd64/amd64/uma_machdep.c
index dc9c307..c4ca677 100644
--- a/sys/amd64/amd64/uma_machdep.c
+++ b/sys/amd64/amd64/uma_machdep.c
@@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/lock.h>
+#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/systm.h>
#include <vm/vm.h>
@@ -48,12 +49,7 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
int pflags;
*flags = UMA_SLAB_PRIV;
- if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT)
- pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED;
- else
- pflags = VM_ALLOC_SYSTEM | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED;
- if (wait & M_ZERO)
- pflags |= VM_ALLOC_ZERO;
+ pflags = malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED;
for (;;) {
m = vm_page_alloc(NULL, 0, pflags);
if (m == NULL) {
diff --git a/sys/arm/arm/busdma_machdep-v6.c b/sys/arm/arm/busdma_machdep-v6.c
index bb21ea1..0c64845 100644
--- a/sys/arm/arm/busdma_machdep-v6.c
+++ b/sys/arm/arm/busdma_machdep-v6.c
@@ -1463,7 +1463,6 @@ add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr,
struct bounce_zone *bz;
struct bounce_page *bpage;
- printf("add bounce page\n");
KASSERT(dmat->bounce_zone != NULL, ("no bounce zone in dma tag"));
KASSERT(map != NULL,
("add_bounce_page: bad map %p", map));
diff --git a/sys/arm/arm/cpufunc.c b/sys/arm/arm/cpufunc.c
index d59c141..dd43c27 100644
--- a/sys/arm/arm/cpufunc.c
+++ b/sys/arm/arm/cpufunc.c
@@ -1047,7 +1047,7 @@ struct cpu_functions cortexa_cpufuncs = {
/* TLB functions */
- arm11_tlb_flushID, /* tlb_flushID */
+ armv7_tlb_flushID, /* tlb_flushID */
armv7_tlb_flushID_SE, /* tlb_flushID_SE */
arm11_tlb_flushI, /* tlb_flushI */
arm11_tlb_flushI_SE, /* tlb_flushI_SE */
@@ -1067,7 +1067,8 @@ struct cpu_functions cortexa_cpufuncs = {
armv7_idcache_wbinv_all, /* idcache_wbinv_all */
armv7_idcache_wbinv_range, /* idcache_wbinv_range */
- /* Note: From OMAP4 the L2 ops are filled in when the
+ /*
+ * Note: For CPUs using the PL310 the L2 ops are filled in when the
* L2 cache controller is actually enabled.
*/
cpufunc_nullop, /* l2cache_wbinv_all */
diff --git a/sys/arm/arm/cpufunc_asm_armv7.S b/sys/arm/arm/cpufunc_asm_armv7.S
index 963aa68..58f295c 100644
--- a/sys/arm/arm/cpufunc_asm_armv7.S
+++ b/sys/arm/arm/cpufunc_asm_armv7.S
@@ -70,7 +70,11 @@ ENTRY(armv7_setttb)
orr r0, r0, #PT_ATTR
mcr p15, 0, r0, c2, c0, 0 /* Translation Table Base Register 0 (TTBR0) */
+#ifdef SMP
+ mcr p15, 0, r0, c8, c3, 0 /* invalidate I+D TLBs Inner Shareable*/
+#else
mcr p15, 0, r0, c8, c7, 0 /* invalidate I+D TLBs */
+#endif
dsb
isb
RET
@@ -78,11 +82,12 @@ ENTRY(armv7_setttb)
ENTRY(armv7_tlb_flushID)
dsb
#ifdef SMP
- mcr p15, 0, r0, c8, c3, 0
+ mcr p15, 0, r0, c8, c3, 0 /* flush I+D tlb */
+ mcr p15, 0, r0, c7, c1, 6 /* flush BTB */
#else
mcr p15, 0, r0, c8, c7, 0 /* flush I+D tlb */
-#endif
mcr p15, 0, r0, c7, c5, 6 /* flush BTB */
+#endif
dsb
isb
mov pc, lr
@@ -91,11 +96,12 @@ ENTRY(armv7_tlb_flushID_SE)
ldr r1, .Lpage_mask
bic r0, r0, r1
#ifdef SMP
- mcr p15, 0, r0, c8, c3, 1 /* flush D tlb single entry */
+ mcr p15, 0, r0, c8, c3, 1 /* flush D tlb single entry Inner Shareable*/
+ mcr p15, 0, r0, c7, c1, 6 /* flush BTB Inner Shareable */
#else
mcr p15, 0, r0, c8, c7, 1 /* flush D tlb single entry */
-#endif
mcr p15, 0, r0, c7, c5, 6 /* flush BTB */
+#endif
dsb
isb
mov pc, lr
@@ -155,7 +161,11 @@ Finished:
ENTRY(armv7_idcache_wbinv_all)
stmdb sp!, {lr}
bl armv7_dcache_wbinv_all
+#ifdef SMP
+ mcr p15, 0, r0, c7, c1, 0 /* Invalidate all I caches to PoU (ICIALLUIS) */
+#else
mcr p15, 0, r0, c7, c5, 0 /* Invalidate all I caches to PoU (ICIALLU) */
+#endif
dsb
isb
ldmia sp!, {lr}
@@ -251,7 +261,11 @@ ENTRY(armv7_context_switch)
orr r0, r0, #PT_ATTR
mcr p15, 0, r0, c2, c0, 0 /* set the new TTB */
+#ifdef SMP
+ mcr p15, 0, r0, c8, c3, 0 /* and flush the I+D tlbs Inner Sharable */
+#else
mcr p15, 0, r0, c8, c7, 0 /* and flush the I+D tlbs */
+#endif
dsb
isb
RET
diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c
index af5480c..a44bdbf 100644
--- a/sys/arm/arm/pmap-v6.c
+++ b/sys/arm/arm/pmap-v6.c
@@ -2361,8 +2361,10 @@ pmap_change_attr(vm_offset_t sva, vm_size_t len, int mode)
* Only supported on kernel virtual addresses, including the direct
* map but excluding the recursive map.
*/
- if (base < DMAP_MIN_ADDRESS)
+ if (base < DMAP_MIN_ADDRESS) {
+ PMAP_UNLOCK(kernel_pmap);
return (EINVAL);
+ }
#endif
for (tmpva = base; tmpva < base + size; ) {
next_bucket = L2_NEXT_BUCKET(tmpva);
@@ -2377,8 +2379,10 @@ pmap_change_attr(vm_offset_t sva, vm_size_t len, int mode)
ptep = &l2b->l2b_kva[l2pte_index(tmpva)];
- if (*ptep == 0)
+ if (*ptep == 0) {
+ PMAP_UNLOCK(kernel_pmap);
return(EINVAL);
+ }
pte = *ptep &~ L2_S_CACHE_MASK;
cpu_idcache_wbinv_range(tmpva, PAGE_SIZE);
diff --git a/sys/arm/arm/pmap.c b/sys/arm/arm/pmap.c
index 3d809aa..6a794b7 100644
--- a/sys/arm/arm/pmap.c
+++ b/sys/arm/arm/pmap.c
@@ -165,6 +165,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_map.h>
#include <vm/vm_page.h>
#include <vm/vm_pageout.h>
+#include <vm/vm_phys.h>
#include <vm/vm_extern.h>
#include <machine/md_var.h>
diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c
index f60cdb1..cc87bbe 100644
--- a/sys/arm/arm/vm_machdep.c
+++ b/sys/arm/arm/vm_machdep.c
@@ -651,12 +651,7 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
ret = ((void *)kmem_malloc(kmem_map, bytes, M_NOWAIT));
return (ret);
}
- if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT)
- pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED;
- else
- pflags = VM_ALLOC_SYSTEM | VM_ALLOC_WIRED;
- if (wait & M_ZERO)
- pflags |= VM_ALLOC_ZERO;
+ pflags = malloc2vm_flags(wait) | VM_ALLOC_WIRED;
for (;;) {
m = vm_page_alloc(NULL, 0, pflags | VM_ALLOC_NOOBJ);
if (m == NULL) {
diff --git a/sys/boot/forth/menu-commands.4th b/sys/boot/forth/menu-commands.4th
index 5c76769..a3ee588 100644
--- a/sys/boot/forth/menu-commands.4th
+++ b/sys/boot/forth/menu-commands.4th
@@ -31,6 +31,10 @@ include /boot/menusets.4th
variable kernel_state
variable root_state
+\
+\ ACPI
+\
+
: acpi_enable ( -- )
s" set acpi_load=YES" evaluate \ XXX deprecated but harmless
s" set hint.acpi.0.disabled=0" evaluate
@@ -58,9 +62,38 @@ variable root_state
TRUE \ loop menu again
;
+\
+\ Safe Mode
+\
+
+: safemode_enabled? ( -- flag )
+ s" kern.smp.disabled" getenv -1 <> dup if
+ swap drop ( c-addr flag -- flag )
+ then
+;
+
+: safemode_enable ( -- )
+ s" set kern.smp.disabled=1" evaluate
+ s" set hw.ata.ata_dma=0" evaluate
+ s" set hw.ata.atapi_dma=0" evaluate
+ s" set hw.ata.wc=0" evaluate
+ s" set hw.eisa_slots=0" evaluate
+ s" set kern.eventtimer.periodic=1" evaluate
+ s" set kern.geom.part.check_integrity=0" evaluate
+;
+
+: safemode_disable ( -- )
+ s" kern.smp.disabled" unsetenv
+ s" hw.ata.ata_dma" unsetenv
+ s" hw.ata.atapi_dma" unsetenv
+ s" hw.ata.wc" unsetenv
+ s" hw.eisa_slots" unsetenv
+ s" kern.eventtimer.periodic" unsetenv
+ s" kern.geom.part.check_integrity" unsetenv
+;
+
: init_safemode ( N -- N )
- s" kern.smp.disabled" getenv -1 <> if
- drop ( n c-addr -- n ) \ unused
+ safemode_enabled? if
toggle_menuitem ( n -- n )
then
;
@@ -70,25 +103,10 @@ variable root_state
\ Now we're going to make the change effective
- s" toggle_stateN @" \ base name of toggle state var
- -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral
-
- evaluate 0= if
- s" kern.smp.disabled" unsetenv
- s" hw.ata.ata_dma" unsetenv
- s" hw.ata.atapi_dma" unsetenv
- s" hw.ata.wc" unsetenv
- s" hw.eisa_slots" unsetenv
- s" kern.eventtimer.periodic" unsetenv
- s" kern.geom.part.check_integrity" unsetenv
+ dup toggle_stateN @ 0= if
+ safemode_disable
else
- s" set kern.smp.disabled=1" evaluate
- s" set hw.ata.ata_dma=0" evaluate
- s" set hw.ata.atapi_dma=0" evaluate
- s" set hw.ata.wc=0" evaluate
- s" set hw.eisa_slots=0" evaluate
- s" set kern.eventtimer.periodic=1" evaluate
- s" set kern.geom.part.check_integrity=0" evaluate
+ safemode_enable
then
menu-redraw
@@ -96,9 +114,26 @@ variable root_state
TRUE \ loop menu again
;
+\
+\ Single User Mode
+\
+
+: singleuser_enabled? ( -- flag )
+ s" boot_single" getenv -1 <> dup if
+ swap drop ( c-addr flag -- flag )
+ then
+;
+
+: singleuser_enable ( -- )
+ s" set boot_single=YES" evaluate
+;
+
+: singleuser_disable ( -- )
+ s" boot_single" unsetenv
+;
+
: init_singleuser ( N -- N )
- s" boot_single" getenv -1 <> if
- drop ( n c-addr -- n ) \ unused
+ singleuser_enabled? if
toggle_menuitem ( n -- n )
then
;
@@ -109,21 +144,35 @@ variable root_state
\ Now we're going to make the change effective
- s" toggle_stateN @" \ base name of toggle state var
- -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral
-
- evaluate 0= if
- s" boot_single" unsetenv
+ dup toggle_stateN @ 0= if
+ singleuser_disable
else
- s" set boot_single=YES" evaluate
+ singleuser_enable
then
TRUE \ loop menu again
;
+\
+\ Verbose Boot
+\
+
+: verbose_enabled? ( -- flag )
+ s" boot_verbose" getenv -1 <> dup if
+ swap drop ( c-addr flag -- flag )
+ then
+;
+
+: verbose_enable ( -- )
+ s" set boot_verbose=YES" evaluate
+;
+
+: verbose_disable ( -- )
+ s" boot_verbose" unsetenv
+;
+
: init_verbose ( N -- N )
- s" boot_verbose" getenv -1 <> if
- drop ( n c-addr -- n ) \ unused
+ verbose_enabled? if
toggle_menuitem ( n -- n )
then
;
@@ -134,18 +183,19 @@ variable root_state
\ Now we're going to make the change effective
- s" toggle_stateN @" \ base name of toggle state var
- -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral
-
- evaluate 0= if
- s" boot_verbose" unsetenv
+ dup toggle_stateN @ 0= if
+ verbose_disable
else
- s" set boot_verbose=YES" evaluate
+ verbose_enable
then
TRUE \ loop menu again
;
+\
+\ Escape to Prompt
+\
+
: goto_prompt ( N -- N FALSE )
s" set autoboot_delay=NO" evaluate
@@ -158,11 +208,12 @@ variable root_state
FALSE \ exit the menu
;
+\
+\ Cyclestate (used by kernel/root below)
+\
+
: init_cyclestate ( N K -- N )
- over ( n k -- n k n )
- s" cycle_stateN" ( n k n -- n k n c-addr u )
- -rot tuck 11 + c! swap ( n k n c-addr u -- n k c-addr u )
- evaluate ( n k c-addr u -- n k addr )
+ over cycle_stateN ( n k -- n k addr )
begin
tuck @ ( n k addr -- n addr k c )
over <> ( n addr k c -- n addr k 0|-1 )
@@ -174,6 +225,10 @@ variable root_state
2drop ( n k addr -- n )
;
+\
+\ Kernel
+\
+
: init_kernel ( N -- N )
kernel_state @ ( n -- n k )
init_cyclestate ( n k -- n )
@@ -185,21 +240,21 @@ variable root_state
\ Now we're going to make the change effective
- s" cycle_stateN" \ base name of array state var
- -rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral
- evaluate \ translate name into address
- @ \ dereference address into value
+ dup cycle_stateN @
dup kernel_state ! \ save a copy for re-initialization
48 + \ convert to ASCII numeral
s" set kernel=${kernel_prefix}${kernel[N]}${kernel_suffix}"
- \ command to assemble full kernel-path
- -rot tuck 36 + c! swap \ replace 'N' with array index value
- evaluate \ sets $kernel to full kernel-path
+ 36 +c! \ replace 'N' with ASCII numeral
+ evaluate \ sets $kernel to full kernel-path
TRUE \ loop menu again
;
+\
+\ Root
+\
+
: init_root ( N -- N )
root_state @ ( n -- n k )
init_cyclestate ( n k -- n )
@@ -211,21 +266,21 @@ variable root_state
\ Now we're going to make the change effective
- s" cycle_stateN" \ base name of array state var
- -rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral
- evaluate \ translate name into address
- @ \ dereference address into value
+ dup cycle_stateN @
dup root_state ! \ save a copy for re-initialization
48 + \ convert to ASCII numeral
s" set root=${root_prefix}${root[N]}${root_suffix}"
- \ command to assemble root image-path
- -rot tuck 30 + c! swap \ replace 'N' with array index value
- evaluate \ sets $kernel to full kernel-path
+ 30 +c! \ replace 'N' with ASCII numeral
+ evaluate \ sets $root to full root-path
TRUE \ loop menu again
;
+\
+\ Menusets
+\
+
: goto_menu ( N M -- N TRUE )
menu-unset
menuset-loadsetnum ( n m -- n )
diff --git a/sys/boot/forth/menu.4th b/sys/boot/forth/menu.4th
index c98b4f8..16aa710 100644
--- a/sys/boot/forth/menu.4th
+++ b/sys/boot/forth/menu.4th
@@ -116,6 +116,48 @@ create init_text6 255 allot
create init_text7 255 allot
create init_text8 255 allot
+: +c! ( N C-ADDR/U K -- C-ADDR/U )
+ 3 pick 3 pick ( n c-addr/u k -- n c-addr/u k n c-addr )
+ rot + c! ( n c-addr/u k n c-addr -- n c-addr/u )
+ rot drop ( n c-addr/u -- c-addr/u )
+;
+
+: menukeyN ( N -- ADDR ) s" menukeyN" 7 +c! evaluate ;
+: init_stateN ( N -- ADDR ) s" init_stateN" 10 +c! evaluate ;
+: toggle_stateN ( N -- ADDR ) s" toggle_stateN" 12 +c! evaluate ;
+: cycle_stateN ( N -- ADDR ) s" cycle_stateN" 11 +c! evaluate ;
+: init_textN ( N -- C-ADDR ) s" init_textN" 9 +c! evaluate ;
+
+: str_loader_menu_title ( -- C-ADDR/U ) s" loader_menu_title" ;
+: str_loader_menu_timeout_x ( -- C-ADDR/U ) s" loader_menu_timeout_x" ;
+: str_loader_menu_timeout_y ( -- C-ADDR/U ) s" loader_menu_timeout_y" ;
+: str_menu_init ( -- C-ADDR/U ) s" menu_init" ;
+: str_menu_timeout_command ( -- C-ADDR/U ) s" menu_timeout_command" ;
+: str_menu_reboot ( -- C-ADDR/U ) s" menu_reboot" ;
+: str_menu_acpi ( -- C-ADDR/U ) s" menu_acpi" ;
+: str_menu_options ( -- C-ADDR/U ) s" menu_options" ;
+: str_menu_optionstext ( -- C-ADDR/U ) s" menu_optionstext" ;
+
+: str_menu_init[x] ( -- C-ADDR/U ) s" menu_init[x]" ;
+: str_menu_command[x] ( -- C-ADDR/U ) s" menu_command[x]" ;
+: str_menu_caption[x] ( -- C-ADDR/U ) s" menu_caption[x]" ;
+: str_ansi_caption[x] ( -- C-ADDR/U ) s" ansi_caption[x]" ;
+: str_menu_keycode[x] ( -- C-ADDR/U ) s" menu_keycode[x]" ;
+: str_toggled_text[x] ( -- C-ADDR/U ) s" toggled_text[x]" ;
+: str_toggled_ansi[x] ( -- C-ADDR/U ) s" toggled_ansi[x]" ;
+: str_menu_caption[x][y] ( -- C-ADDR/U ) s" menu_caption[x][y]" ;
+: str_ansi_caption[x][y] ( -- C-ADDR/U ) s" ansi_caption[x][y]" ;
+
+: menu_init[x] ( N -- C-ADDR/U ) str_menu_init[x] 10 +c! ;
+: menu_command[x] ( N -- C-ADDR/U ) str_menu_command[x] 13 +c! ;
+: menu_caption[x] ( N -- C-ADDR/U ) str_menu_caption[x] 13 +c! ;
+: ansi_caption[x] ( N -- C-ADDR/U ) str_ansi_caption[x] 13 +c! ;
+: menu_keycode[x] ( N -- C-ADDR/U ) str_menu_keycode[x] 13 +c! ;
+: toggled_text[x] ( N -- C-ADDR/U ) str_toggled_text[x] 13 +c! ;
+: toggled_ansi[x] ( N -- C-ADDR/U ) str_toggled_ansi[x] 13 +c! ;
+: menu_caption[x][y] ( N M -- C-ADDR/U ) str_menu_caption[x][y] 16 +c! 13 +c! ;
+: ansi_caption[x][y] ( N M -- C-ADDR/U ) str_ansi_caption[x][y] 16 +c! 13 +c! ;
+
: arch-i386? ( -- BOOL ) \ Returns TRUE (-1) on i386, FALSE (0) otherwise.
s" arch-i386" environment? dup if
drop
@@ -172,10 +214,7 @@ create init_text8 255 allot
\ ASCII numeral equal to user-selected menu item must be on the stack.
\ We do not modify the stack, so the ASCII numeral is left on top.
- s" init_textN" \ base name of buffer
- -rot 2dup 9 + c! rot \ replace 'N' with ASCII num
-
- evaluate c@ 0= if
+ dup init_textN c@ 0= if
\ NOTE: no need to check toggle_stateN since the first time we
\ are called, we will populate init_textN. Further, we don't
\ need to test whether menu_caption[x] (ansi_caption[x] when
@@ -183,19 +222,16 @@ create init_text8 255 allot
\ called if the caption was NULL.
\ base name of environment variable
+ dup ( n -- n n ) \ key pressed
loader_color? if
- s" ansi_caption[x]"
+ ansi_caption[x]
else
- s" menu_caption[x]"
+ menu_caption[x]
then
- -rot 2dup 13 + c! rot \ replace 'x' with ASCII numeral
-
getenv dup -1 <> if
- s" init_textN" \ base name of buffer
- 4 pick \ copy ASCII num to top
- rot tuck 9 + c! swap \ replace 'N' with ASCII num
- evaluate
+ 2 pick ( n c-addr/u -- n c-addr/u n )
+ init_textN ( n c-addr/u n -- n c-addr/u c-addr )
\ now we have the buffer c-addr on top
\ ( followed by c-addr/u of current caption )
@@ -227,67 +263,49 @@ create init_text8 255 allot
\ negate the toggled state so that we reverse the flow on subsequent
\ calls.
- s" toggle_stateN @" \ base name of toggle state var
- -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral
-
- evaluate 0= if
+ dup toggle_stateN @ 0= if
\ state is OFF, toggle to ON
- \ base name of toggled text var
+ dup ( n -- n n ) \ key pressed
loader_color? if
- s" toggled_ansi[x]"
+ toggled_ansi[x]
else
- s" toggled_text[x]"
+ toggled_text[x]
then
- -rot 2dup 13 + c! rot \ replace 'x' with ASCII num
-
getenv dup -1 <> if
\ Assign toggled text to menu caption
-
- \ base name of caption var
+ 2 pick ( n c-addr/u -- n c-addr/u n ) \ key pressed
loader_color? if
- s" ansi_caption[x]"
+ ansi_caption[x]
else
- s" menu_caption[x]"
+ menu_caption[x]
then
- 4 pick \ copy ASCII num to top
- rot tuck 13 + c! swap \ replace 'x' with ASCII num
-
- setenv \ set new caption
+ setenv
else
\ No toggled text, keep the same caption
-
- drop
+ drop ( n -1 -- n ) \ getenv cruft
then
true \ new value of toggle state var (to be stored later)
else
\ state is ON, toggle to OFF
- s" init_textN" \ base name of initial text buffer
- -rot 2dup 9 + c! rot \ replace 'N' with ASCII numeral
- evaluate \ convert string to c-addr
- count \ convert c-addr to c-addr/u
+ dup init_textN count ( n -- n c-addr/u )
- \ base name of caption var
+ \ Assign init_textN text to menu caption
+ 2 pick ( n c-addr/u -- n c-addr/u n ) \ key pressed
loader_color? if
- s" ansi_caption[x]"
+ ansi_caption[x]
else
- s" menu_caption[x]"
+ menu_caption[x]
then
- 4 pick \ copy ASCII num to top
- rot tuck 13 + c! swap \ replace 'x' with ASCII numeral
+ setenv
- setenv \ set new caption
- false \ new value of toggle state var (to be stored below)
+ false \ new value of toggle state var (to be stored below)
then
\ now we'll store the new toggle state (on top of stack)
- s" toggle_stateN" \ base name of toggle state var
- 3 pick \ copy ASCII numeral to top
- rot tuck 12 + c! swap \ replace 'N' with ASCII numeral
- evaluate \ convert string to addr
- ! \ store new value
+ over toggle_stateN !
;
: cycle_menuitem ( N -- N ) \ cycles through array of choices for a menuitem
@@ -295,28 +313,23 @@ create init_text8 255 allot
\ ASCII numeral equal to user-selected menu item must be on the stack.
\ We do not modify the stack, so the ASCII numeral is left on top.
- s" cycle_stateN" \ base name of array state var
- -rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral
-
- evaluate \ we now have a pointer to the proper variable
- dup @ \ resolve the pointer (but leave it on the stack)
- 1+ \ increment the value
+ dup cycle_stateN dup @ 1+ \ get value and increment
\ Before assigning the (incremented) value back to the pointer,
\ let's test for the existence of this particular array element.
\ If the element exists, we'll store index value and move on.
\ Otherwise, we'll loop around to zero and store that.
- dup 48 + \ duplicate Array index and convert to ASCII numeral
+ dup 48 + ( n addr k -- n addr k k' )
+ \ duplicate array index and convert to ASCII numeral
- \ base name of array caption text
+ 3 pick swap ( n addr k k' -- n addr k n k' ) \ (n,k') as (x,y)
loader_color? if
- s" ansi_caption[x][y]"
+ ansi_caption[x][y]
else
- s" menu_caption[x][y]"
+ menu_caption[x][y]
then
- -rot tuck 16 + c! swap \ replace 'y' with Array index
- 4 pick rot tuck 13 + c! swap \ replace 'x' with menu choice
+ ( n addr k n k' -- n addr k c-addr/u )
\ Now test for the existence of our incremented array index in the
\ form of $menu_caption[x][y] ($ansi_caption[x][y] with loader_color
@@ -325,49 +338,47 @@ create init_text8 255 allot
getenv dup -1 = if
\ No caption set for this array index. Loop back to zero.
- drop ( getenv cruft )
- drop ( incremented array index )
- 0 ( new array index that will be stored later )
+ drop ( n addr k -1 -- n addr k ) \ getenv cruft
+ drop 0 ( n addr k -- n addr 0 ) \ new value to store later
- \ base name of caption var
+ 2 pick [char] 0 ( n addr 0 -- n addr 0 n 48 ) \ (n,48) as (x,y)
loader_color? if
- s" ansi_caption[x][0]"
+ ansi_caption[x][y]
else
- s" menu_caption[x][0]"
+ menu_caption[x][y]
then
- 4 pick rot tuck 13 + c! swap \ replace 'x' with menu choice
-
+ ( n addr 0 n 48 -- n addr 0 c-addr/u )
getenv dup -1 = if
\ This is highly unlikely to occur, but to make
\ sure that things move along smoothly, allocate
\ a temporary NULL string
- drop ( getenv cruft )
- s" "
+ drop ( n addr 0 -1 -- n addr 0 ) \ getenv cruft
+ s" " ( n addr 0 -- n addr 0 c-addr/u )
then
then
\ At this point, we should have the following on the stack (in order,
\ from bottom to top):
\
- \ N - Ascii numeral representing the menu choice (inherited)
- \ Addr - address of our internal cycle_stateN variable
- \ N - zero-based number we intend to store to the above
- \ C-Addr - string value we intend to store to menu_caption[x]
- \ (or ansi_caption[x] with loader_color enabled)
+ \ n - Ascii numeral representing the menu choice (inherited)
+ \ addr - address of our internal cycle_stateN variable
+ \ k - zero-based number we intend to store to the above
+ \ c-addr/u - string value we intend to store to menu_caption[x]
+ \ (or ansi_caption[x] with loader_color enabled)
\
\ Let's perform what we need to with the above.
- \ base name of menuitem caption var
+ \ Assign array value text to menu caption
+ 4 pick ( n addr k c-addr/u -- n addr k c-addr/u n )
loader_color? if
- s" ansi_caption[x]"
+ ansi_caption[x]
else
- s" menu_caption[x]"
+ menu_caption[x]
then
- 6 pick rot tuck 13 + c! swap \ replace 'x' with menu choice
- setenv \ set the new caption
+ setenv
- swap ! \ update array state variable
+ swap ! ( n addr k -- n ) \ update array state variable
;
: acpipresent? ( -- flag ) \ Returns TRUE if ACPI is present, FALSE otherwise
@@ -401,15 +412,15 @@ create init_text8 255 allot
acpipresent? if
acpienabled? if
loader_color? if
- s" toggled_ansi[x]"
+ str_toggled_ansi[x]
else
- s" toggled_text[x]"
+ str_toggled_text[x]
then
else
loader_color? if
- s" ansi_caption[x]"
+ str_ansi_caption[x]
else
- s" menu_caption[x]"
+ str_menu_caption[x]
then
then
else
@@ -427,7 +438,7 @@ create init_text8 255 allot
: menu-create ( -- )
\ Print the frame caption at (x,y)
- s" loader_menu_title" getenv dup -1 = if
+ str_loader_menu_title getenv dup -1 = if
drop s" Welcome to FreeBSD"
then
24 over 2 / - 9 at-xy type
@@ -436,7 +447,7 @@ create init_text8 255 allot
\ constructed dynamically -- as this function could conceivably set
\ the remaining environment variables to construct the menu entirely).
\
- s" menu_init" getenv dup -1 <> if
+ str_menu_init getenv dup -1 <> if
evaluate
else
drop
@@ -461,7 +472,7 @@ create init_text8 255 allot
\ Initialize the ACPI option status.
\
0 menuacpi !
- s" menu_acpi" getenv -1 <> if
+ str_menu_acpi getenv -1 <> if
c@ dup 48 > over 57 < and if ( '1' <= c1 <= '8' )
menuacpi !
arch-i386? if acpipresent? if
@@ -469,10 +480,7 @@ create init_text8 255 allot
\ Set menu toggle state to active state
\ (required by generic toggle_menuitem)
\
- menuacpi @
- s" acpienabled? toggle_stateN !"
- -rot tuck 25 + c! swap
- evaluate
+ acpienabled? menuacpi @ toggle_stateN !
then then
else
drop
@@ -483,7 +491,7 @@ create init_text8 255 allot
\ Initialize the menu_options visual separator.
\
0 menuoptions !
- s" menu_options" getenv -1 <> if
+ str_menu_options getenv -1 <> if
c@ dup 48 > over 57 < and if ( '1' <= c1 <= '8' )
menuoptions !
else
@@ -503,7 +511,7 @@ create init_text8 255 allot
\ If the "Options:" separator, print it.
dup menuoptions @ = if
\ Optionally add a reboot option to the menu
- s" menu_reboot" getenv -1 <> if
+ str_menu_reboot getenv -1 <> if
drop
s" Reboot" printmenuitem menureboot !
true menurebootadded !
@@ -513,7 +521,7 @@ create init_text8 255 allot
menurow @ 2 + menurow !
menurow @ menuY @ +
at-xy
- s" menu_optionstext" getenv dup -1 <> if
+ str_menu_optionstext getenv dup -1 <> if
type
else
drop ." Options:"
@@ -522,17 +530,21 @@ create init_text8 255 allot
\ If this is the ACPI menu option, act accordingly.
dup menuacpi @ = if
- acpimenuitem ( -- C-Addr/U | -1 )
+ dup acpimenuitem ( n -- n n c-addr/u | n n -1 )
+ dup -1 <> if
+ 13 +c! ( n n c-addr/u -- n c-addr/u )
+ \ replace 'x' with n
+ else
+ swap drop ( n n -1 -- n -1 )
+ over menu_command[x] unsetenv
+ then
else
\ make sure we have not already initialized this item
- s" init_stateN"
- -rot 2dup 10 + c! rot \ repace 'N'
- evaluate dup @ 0= if
+ dup init_stateN dup @ 0= if
1 swap !
\ If this menuitem has an initializer, run it
- s" menu_init[x]"
- -rot 2dup 10 + c! rot \ replace 'x'
+ dup menu_init[x]
getenv dup -1 <> if
evaluate
else
@@ -542,35 +554,24 @@ create init_text8 255 allot
drop
then
+ dup
loader_color? if
- s" ansi_caption[x]"
+ ansi_caption[x]
else
- s" menu_caption[x]"
+ menu_caption[x]
then
then
- ( C-Addr/U | -1 )
dup -1 <> if
- \ replace 'x' with current iteration
- -rot 2dup 13 + c! rot
-
\ test for environment variable
getenv dup -1 <> if
- printmenuitem ( C-Addr/U -- N )
-
- s" menukeyN !" \ generate cmd to store result
- -rot 2dup 7 + c! rot
-
- evaluate
+ printmenuitem ( c-addr/u -- n )
+ dup menukeyN !
else
drop
then
else
drop
-
- s" menu_command[x]"
- -rot 2dup 13 + c! rot ( replace 'x' )
- unsetenv
then
1+ dup 56 > \ add 1 to iterator, continue if less than 57
@@ -579,7 +580,7 @@ create init_text8 255 allot
\ Optionally add a reboot option to the menu
menurebootadded @ true <> if
- s" menu_reboot" getenv -1 <> if
+ str_menu_reboot getenv -1 <> if
drop \ no need for the value
s" Reboot" \ menu caption (required by printmenuitem)
@@ -597,45 +598,22 @@ create init_text8 255 allot
\
: menu-timeout-update ( N -- )
- dup 9 > if ( N N 9 -- N )
- drop ( N -- )
- 9 ( maximum: -- N )
- then
-
- dup 0 < if ( N N 0 -- N )
- drop ( N -- )
- 0 ( minimum: -- N )
- then
-
- 48 + ( convert single-digit numeral to ASCII: N 48 -- N )
-
- s" Autoboot in N seconds. [Space] to pause" ( N -- N Addr C )
-
- 2 pick 48 - 0> if ( N Addr C N 48 -- N Addr C )
-
- \ Modify 'N' (Addr+12) above to reflect time-left
-
- -rot ( N Addr C -- C N Addr )
- tuck ( C N Addr -- C Addr N Addr )
- 12 + ( C Addr N Addr -- C Addr N Addr2 )
- c! ( C Addr N Addr2 -- C Addr )
- swap ( C Addr -- Addr C )
-
- menu_timeout_x @
- menu_timeout_y @
- at-xy ( position cursor: Addr C N N -- Addr C )
-
- type ( print message: Addr C -- )
-
- else ( N Addr C N -- N Addr C )
+ \ Enforce minimum/maximum
+ dup 9 > if drop 9 then
+ dup 0 < if drop 0 then
- menu_timeout_x @
- menu_timeout_y @
- at-xy ( position cursor: N Addr C N N -- N Addr C )
+ s" Autoboot in N seconds. [Space] to pause" ( n -- n c-addr/u )
- spaces ( erase message: N Addr C -- N Addr )
- 2drop ( N Addr -- )
+ 2 pick 0> if
+ rot 48 + -rot ( n c-addr/u -- n' c-addr/u ) \ convert to ASCII
+ 12 +c! ( n' c-addr/u -- c-addr/u ) \ replace 'N' above
+ menu_timeout_x @ menu_timeout_y @ at-xy \ position cursor
+ type ( c-addr/u -- ) \ print message
+ else
+ menu_timeout_x @ menu_timeout_y @ at-xy \ position cursor
+ spaces ( n c-addr/u -- n c-addr ) \ erase message
+ 2drop ( n c-addr -- )
then
0 25 at-xy ( position cursor back at bottom-left )
@@ -683,7 +661,7 @@ create init_text8 255 allot
\ (user did not cancel by pressing ANY
\ key)
- s" menu_timeout_command" getenv dup
+ str_menu_timeout_command getenv dup
-1 = if
drop \ clean-up
else
@@ -766,7 +744,7 @@ create init_text8 255 allot
0 menu_timeout_enabled ! \ start with automatic timeout disabled
\ check indication that automatic execution after delay is requested
- s" menu_timeout_command" getenv -1 <> if ( Addr C -1 -- | Addr )
+ str_menu_timeout_command getenv -1 <> if ( Addr C -1 -- | Addr )
drop ( just testing existence right now: Addr -- )
\ initialize state variables
@@ -802,7 +780,7 @@ create init_text8 255 allot
menu_timeout_enabled @ 1 = if
\ read custom column position (if set)
- s" loader_menu_timeout_x" getenv dup -1 = if
+ str_loader_menu_timeout_x getenv dup -1 = if
drop \ no custom column position
menu_timeout_default_x \ use default setting
else
@@ -814,7 +792,7 @@ create init_text8 255 allot
menu_timeout_x ! ( store value on stack from above )
\ read custom row position (if set)
- s" loader_menu_timeout_y" getenv dup -1 = if
+ str_loader_menu_timeout_y getenv dup -1 = if
drop \ no custom row position
menu_timeout_default_y \ use default setting
else
@@ -853,12 +831,8 @@ create init_text8 255 allot
49 \ Iterator start (loop range 49 to 56; ASCII '1' to '8')
begin
- s" menukeyN @"
-
- \ replace 'N' with current iteration
- -rot 2dup 7 + c! rot
-
- evaluate rot tuck = if
+ dup menukeyN @
+ rot tuck = if
\ Adjust for missing ACPI menuitem on non-i386
arch-i386? true <> menuacpi @ 0<> and if
@@ -869,13 +843,8 @@ create init_text8 255 allot
then
then
- \ base env name for the value (x is a number)
- s" menu_command[x]"
-
- \ Copy ASCII number to string at offset 13
- -rot 2dup 13 + c! rot
-
\ Test for the environment variable
+ dup menu_command[x]
getenv dup -1 <> if
\ Execute the stored procedure
evaluate
@@ -910,16 +879,14 @@ create init_text8 255 allot
\
\ Check for menu keycode shortcut(s)
\
- s" menu_keycode[x]"
- -rot 2dup 13 + c! rot
+ dup menu_keycode[x]
getenv dup -1 = if
drop
else
?number 0<> if
rot tuck = if
swap
- s" menu_command[x]"
- -rot 2dup 13 + c! rot
+ dup menu_command[x]
getenv dup -1 <> if
evaluate
0= if
@@ -951,100 +918,43 @@ create init_text8 255 allot
49 \ Iterator start (loop range 49 to 56; ASCII '1' to '8')
begin
- \ Unset variables in-order of appearance in menu.4th(8)
-
- s" menu_caption[x]" \ basename for caption variable
- -rot 2dup 13 + c! rot \ replace 'x' with current iteration
- unsetenv \ not erroneous to unset unknown var
-
- s" menu_command[x]" \ command basename
- -rot 2dup 13 + c! rot \ replace 'x'
- unsetenv
-
- s" menu_init[x]" \ initializer basename
- -rot 2dup 10 + c! rot \ replace 'x'
- unsetenv
-
- s" menu_keycode[x]" \ keycode basename
- -rot 2dup 13 + c! rot \ replace 'x'
- unsetenv
-
- s" ansi_caption[x]" \ ANSI caption basename
- -rot 2dup 13 + c! rot \ replace 'x'
- unsetenv
-
- s" toggled_text[x]" \ toggle_menuitem caption basename
- -rot 2dup 13 + c! rot \ replace 'x'
- unsetenv
-
- s" toggled_ansi[x]" \ toggle_menuitem ANSI caption basename
- -rot 2dup 13 + c! rot \ replace 'x'
- unsetenv
-
- s" menu_caption[x][y]" \ cycle_menuitem caption
- -rot 2dup 13 + c! rot \ replace 'x'
- 48 -rot
+ dup menu_init[x] unsetenv \ menu initializer
+ dup menu_command[x] unsetenv \ menu command
+ dup menu_caption[x] unsetenv \ menu caption
+ dup ansi_caption[x] unsetenv \ ANSI caption
+ dup menu_keycode[x] unsetenv \ menu keycode
+ dup toggled_text[x] unsetenv \ toggle_menuitem caption
+ dup toggled_ansi[x] unsetenv \ toggle_menuitem ANSI caption
+
+ 48 \ Iterator start (inner range 48 to 57; ASCII '0' to '9')
begin
- 16 2over rot + c! \ replace 'y'
- 2dup unsetenv
-
- rot 1+ dup 57 > 2swap rot
+ \ cycle_menuitem caption and ANSI caption
+ 2dup menu_caption[x][y] unsetenv
+ 2dup ansi_caption[x][y] unsetenv
+ 1+ dup 57 >
until
- 2drop drop
+ drop \ inner iterator
- s" ansi_caption[x][y]" \ cycle_menuitem ANSI caption
- -rot 2dup 13 + c! rot \ replace 'x'
- 48 -rot
- begin
- 16 2over rot + c! \ replace 'y'
- 2dup unsetenv
-
- rot 1+ dup 57 > 2swap rot
- until
- 2drop drop
-
- s" 0 menukeyN !" \ basename for key association var
- -rot 2dup 9 + c! rot \ replace 'N' with current iteration
- evaluate \ assign zero (0) to key assoc. var
-
- s" 0 init_stateN !" \ used by menu-create
- -rot 2dup 12 + c! rot \ replace 'N'
- evaluate
-
- s" 0 toggle_stateN !" \ used by toggle_menuitem
- -rot 2dup 14 + c! rot \ replace 'N'
- evaluate
-
- s" 0 cycle_stateN !" \ used by cycle_menuitem
- -rot 2dup 13 + c! rot \ replace 'N'
- evaluate
-
- s" 0 init_textN c!" \ used by toggle_menuitem
- -rot 2dup 11 + c! rot \ replace 'N'
- evaluate
+ 0 over menukeyN ! \ used by menu-create, menu-display
+ 0 over init_stateN ! \ used by menu-create
+ 0 over toggle_stateN ! \ used by toggle_menuitem
+ 0 over init_textN c! \ used by toggle_menuitem
+ 0 over cycle_stateN ! \ used by cycle_menuitem
1+ dup 56 > \ increment, continue if less than 57
until
drop \ iterator
- \ unset the timeout command
- s" menu_timeout_command" unsetenv
+ str_menu_timeout_command unsetenv \ menu timeout command
+ str_menu_reboot unsetenv \ Reboot menu option flag
+ str_menu_acpi unsetenv \ ACPI menu option flag
+ str_menu_options unsetenv \ Options separator flag
+ str_menu_optionstext unsetenv \ separator display text
+ str_menu_init unsetenv \ menu initializer
- \ clear the "Reboot" menu option flag
- s" menu_reboot" unsetenv
0 menureboot !
-
- \ clear the ACPI menu option flag
- s" menu_acpi" unsetenv
0 menuacpi !
-
- \ clear the "Options" menu separator flag
- s" menu_options" unsetenv
- s" menu_optionstext" unsetenv
0 menuoptions !
-
- \ clear the menu initializer
- s" menu_init" unsetenv
;
\ This function both unsets menu variables and visually erases the menu area
diff --git a/sys/boot/i386/common/edd.h b/sys/boot/i386/common/edd.h
index a33ce8f..4a204f7 100644
--- a/sys/boot/i386/common/edd.h
+++ b/sys/boot/i386/common/edd.h
@@ -62,7 +62,7 @@ struct edd_params {
uint16_t sector_size;
uint16_t edd_params_seg;
uint16_t edd_params_off;
-};
+} __packed;
struct edd_device_path_v3 {
uint16_t key;
@@ -74,12 +74,12 @@ struct edd_device_path_v3 {
uint64_t device_path;
uint8_t reserved2[1];
uint8_t checksum;
-};
+} __packed;
struct edd_params_v3 {
struct edd_params params;
struct edd_device_path_v3 device_path;
-};
+} __packed;
struct edd_device_path_v4 {
uint16_t key;
@@ -91,12 +91,12 @@ struct edd_device_path_v4 {
uint64_t device_path[2];
uint8_t reserved2[1];
uint8_t checksum;
-};
+} __packed;
struct edd_params_v4 {
struct edd_params params;
struct edd_device_path_v4 device_path;
-};
+} __packed;
#define EDD_FLAGS_DMA_BOUNDARY_HANDLING 0x0001
#define EDD_FLAGS_REMOVABLE_MEDIA 0x0002
diff --git a/sys/bsm/audit_kevents.h b/sys/bsm/audit_kevents.h
index f4f77a5..3eb2e3a 100644
--- a/sys/bsm/audit_kevents.h
+++ b/sys/bsm/audit_kevents.h
@@ -602,6 +602,7 @@
#define AUE_PDKILL 43198 /* FreeBSD. */
#define AUE_PDGETPID 43199 /* FreeBSD. */
#define AUE_PDWAIT 43200 /* FreeBSD. */
+#define AUE_WAIT6 43201 /* FreeBSD. */
/*
* Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the
diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/procset.h b/sys/cddl/contrib/opensolaris/uts/common/sys/procset.h
index c367c93..8c5739b 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/sys/procset.h
+++ b/sys/cddl/contrib/opensolaris/uts/common/sys/procset.h
@@ -51,6 +51,7 @@ extern "C" {
#define P_INITUID 0
#define P_INITPGID 0
+#ifndef _IDTYPE_T_DECLARED
/*
* The following defines the values for an identifier type. It
@@ -81,6 +82,9 @@ typedef enum
P_PSETID /* Processor set identifier */
} idtype_t;
+#define _IDTYPE_T_DECLARED
+
+#endif
/*
* The following defines the operations which can be performed to
diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h
index fccdef0..a95b0e5 100644
--- a/sys/compat/freebsd32/freebsd32.h
+++ b/sys/compat/freebsd32/freebsd32.h
@@ -88,6 +88,11 @@ struct rusage32 {
int32_t ru_nivcsw;
};
+struct wrusage32 {
+ struct rusage32 wru_self;
+ struct rusage32 wru_children;
+};
+
struct itimerval32 {
struct timeval32 it_interval;
struct timeval32 it_value;
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index ce8bd7a..934a32d 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -180,6 +180,42 @@ freebsd32_wait4(struct thread *td, struct freebsd32_wait4_args *uap)
return (error);
}
+int
+freebsd32_wait6(struct thread *td, struct freebsd32_wait6_args *uap)
+{
+ struct wrusage32 wru32;
+ struct __wrusage wru, *wrup;
+ struct siginfo32 si32;
+ struct __siginfo si, *sip;
+ int error, status;
+
+ if (uap->wrusage != NULL)
+ wrup = &wru;
+ else
+ wrup = NULL;
+ if (uap->info != NULL) {
+ sip = &si;
+ bzero(sip, sizeof(*sip));
+ } else
+ sip = NULL;
+ error = kern_wait6(td, uap->idtype, uap->id, &status, uap->options,
+ wrup, sip);
+ if (error != 0)
+ return (error);
+ if (uap->status != NULL)
+ error = copyout(&status, uap->status, sizeof(status));
+ if (uap->wrusage != NULL && error == 0) {
+ freebsd32_rusage_out(&wru.wru_self, &wru32.wru_self);
+ freebsd32_rusage_out(&wru.wru_children, &wru32.wru_children);
+ error = copyout(&wru32, uap->wrusage, sizeof(wru32));
+ }
+ if (uap->info != NULL && error == 0) {
+ siginfo_to_siginfo32 (&si, &si32);
+ error = copyout(&si32, uap->info, sizeof(si32));
+ }
+ return (error);
+}
+
#ifdef COMPAT_FREEBSD4
static void
copy_statfs(struct statfs *in, struct statfs32 *out)
diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h
index 8464870..2b241df 100644
--- a/sys/compat/freebsd32/freebsd32_proto.h
+++ b/sys/compat/freebsd32/freebsd32_proto.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 239347 2012-08-17 02:26:31Z davidxu
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 242958 2012-11-13 12:52:31Z kib
*/
#ifndef _FREEBSD32_SYSPROTO_H_
@@ -589,6 +589,14 @@ struct freebsd32_posix_fadvise_args {
char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)];
char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)];
};
+struct freebsd32_wait6_args {
+ char idtype_l_[PADL_(int)]; int idtype; char idtype_r_[PADR_(int)];
+ char id_l_[PADL_(int)]; int id; char id_r_[PADR_(int)];
+ char status_l_[PADL_(int *)]; int * status; char status_r_[PADR_(int *)];
+ char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)];
+ char wrusage_l_[PADL_(struct wrusage32 *)]; struct wrusage32 * wrusage; char wrusage_r_[PADR_(struct wrusage32 *)];
+ char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)];
+};
#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
#define PAD64_REQUIRED
#endif
@@ -700,6 +708,7 @@ int freebsd32_shmctl(struct thread *, struct freebsd32_shmctl_args *);
int freebsd32_pselect(struct thread *, struct freebsd32_pselect_args *);
int freebsd32_posix_fallocate(struct thread *, struct freebsd32_posix_fallocate_args *);
int freebsd32_posix_fadvise(struct thread *, struct freebsd32_posix_fadvise_args *);
+int freebsd32_wait6(struct thread *, struct freebsd32_wait6_args *);
#ifdef COMPAT_43
@@ -1076,6 +1085,7 @@ int freebsd7_freebsd32_shmctl(struct thread *, struct freebsd7_freebsd32_shmctl_
#define FREEBSD32_SYS_AUE_freebsd32_pselect AUE_SELECT
#define FREEBSD32_SYS_AUE_freebsd32_posix_fallocate AUE_NULL
#define FREEBSD32_SYS_AUE_freebsd32_posix_fadvise AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_wait6 AUE_WAIT6
#undef PAD_
#undef PADL_
diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h
index d2881e5..76311ba 100644
--- a/sys/compat/freebsd32/freebsd32_syscall.h
+++ b/sys/compat/freebsd32/freebsd32_syscall.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 239347 2012-08-17 02:26:31Z davidxu
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 242958 2012-11-13 12:52:31Z kib
*/
#define FREEBSD32_SYS_syscall 0
@@ -429,4 +429,5 @@
#define FREEBSD32_SYS_rctl_remove_rule 529
#define FREEBSD32_SYS_freebsd32_posix_fallocate 530
#define FREEBSD32_SYS_freebsd32_posix_fadvise 531
-#define FREEBSD32_SYS_MAXSYSCALL 532
+#define FREEBSD32_SYS_freebsd32_wait6 532
+#define FREEBSD32_SYS_MAXSYSCALL 533
diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c
index a7e0f1d..499b3e8 100644
--- a/sys/compat/freebsd32/freebsd32_syscalls.c
+++ b/sys/compat/freebsd32/freebsd32_syscalls.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 239347 2012-08-17 02:26:31Z davidxu
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 242958 2012-11-13 12:52:31Z kib
*/
const char *freebsd32_syscallnames[] = {
@@ -555,4 +555,5 @@ const char *freebsd32_syscallnames[] = {
"rctl_remove_rule", /* 529 = rctl_remove_rule */
"freebsd32_posix_fallocate", /* 530 = freebsd32_posix_fallocate */
"freebsd32_posix_fadvise", /* 531 = freebsd32_posix_fadvise */
+ "freebsd32_wait6", /* 532 = freebsd32_wait6 */
};
diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c
index 300825c..814d88e 100644
--- a/sys/compat/freebsd32/freebsd32_sysent.c
+++ b/sys/compat/freebsd32/freebsd32_sysent.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 239347 2012-08-17 02:26:31Z davidxu
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 242958 2012-11-13 12:52:31Z kib
*/
#include "opt_compat.h"
@@ -592,4 +592,5 @@ struct sysent freebsd32_sysent[] = {
{ AS(rctl_remove_rule_args), (sy_call_t *)sys_rctl_remove_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 529 = rctl_remove_rule */
{ AS(freebsd32_posix_fallocate_args), (sy_call_t *)freebsd32_posix_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 530 = freebsd32_posix_fallocate */
{ AS(freebsd32_posix_fadvise_args), (sy_call_t *)freebsd32_posix_fadvise, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 531 = freebsd32_posix_fadvise */
+ { AS(freebsd32_wait6_args), (sy_call_t *)freebsd32_wait6, AUE_WAIT6, NULL, 0, 0, 0, SY_THR_STATIC }, /* 532 = freebsd32_wait6 */
};
diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c
index e5588d0..36a646c 100644
--- a/sys/compat/freebsd32/freebsd32_systrace_args.c
+++ b/sys/compat/freebsd32/freebsd32_systrace_args.c
@@ -3076,6 +3076,18 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
*n_args = 6;
break;
}
+ /* freebsd32_wait6 */
+ case 532: {
+ struct freebsd32_wait6_args *p = params;
+ iarg[0] = p->idtype; /* int */
+ iarg[1] = p->id; /* int */
+ uarg[2] = (intptr_t) p->status; /* int * */
+ iarg[3] = p->options; /* int */
+ uarg[4] = (intptr_t) p->wrusage; /* struct wrusage32 * */
+ uarg[5] = (intptr_t) p->info; /* siginfo_t * */
+ *n_args = 6;
+ break;
+ }
default:
*n_args = 0;
break;
@@ -8206,6 +8218,31 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
};
break;
+ /* freebsd32_wait6 */
+ case 532:
+ switch(ndx) {
+ case 0:
+ p = "int";
+ break;
+ case 1:
+ p = "int";
+ break;
+ case 2:
+ p = "int *";
+ break;
+ case 3:
+ p = "int";
+ break;
+ case 4:
+ p = "struct wrusage32 *";
+ break;
+ case 5:
+ p = "siginfo_t *";
+ break;
+ default:
+ break;
+ };
+ break;
default:
break;
};
@@ -9963,6 +10000,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
if (ndx == 0 || ndx == 1)
p = "int";
break;
+ /* freebsd32_wait6 */
+ case 532:
+ if (ndx == 0 || ndx == 1)
+ p = "int";
+ break;
default:
break;
};
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index 478558a..4106447 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -1000,3 +1000,8 @@
uint32_t offset1, uint32_t offset2,\
uint32_t len1, uint32_t len2, \
int advice); }
+532 AUE_WAIT6 STD { int freebsd32_wait6(int idtype, int id, \
+ int *status, int options, \
+ struct wrusage32 *wrusage, \
+ siginfo_t *info); }
+
diff --git a/sys/conf/files b/sys/conf/files
index 134935e..22df87f 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -270,24 +270,18 @@ cddl/contrib/opensolaris/uts/common/zmod/trees.c optional zfs compile-with "${
cddl/contrib/opensolaris/uts/common/zmod/zmod.c optional zfs compile-with "${ZFS_C}"
cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c optional zfs compile-with "${ZFS_C}"
cddl/contrib/opensolaris/uts/common/zmod/zutil.c optional zfs compile-with "${ZFS_C}"
-compat/freebsd32/freebsd32_ioctl.c optional compat_freebsd32
-compat/freebsd32/freebsd32_misc.c optional compat_freebsd32
-compat/freebsd32/freebsd32_syscalls.c optional compat_freebsd32
-compat/freebsd32/freebsd32_sysent.c optional compat_freebsd32
-contrib/altq/altq/altq_cbq.c optional altq \
- compile-with "${NORMAL_C}"
-contrib/altq/altq/altq_cdnr.c optional altq
-contrib/altq/altq/altq_hfsc.c optional altq \
- compile-with "${NORMAL_C}"
-contrib/altq/altq/altq_priq.c optional altq \
- compile-with "${NORMAL_C}"
-contrib/altq/altq/altq_red.c optional altq \
- compile-with "${NORMAL_C}"
-contrib/altq/altq/altq_rio.c optional altq \
- compile-with "${NORMAL_C}"
-contrib/altq/altq/altq_rmclass.c optional altq
-contrib/altq/altq/altq_subr.c optional altq \
- compile-with "${NORMAL_C}"
+compat/freebsd32/freebsd32_ioctl.c optional compat_freebsd32
+compat/freebsd32/freebsd32_misc.c optional compat_freebsd32
+compat/freebsd32/freebsd32_syscalls.c optional compat_freebsd32
+compat/freebsd32/freebsd32_sysent.c optional compat_freebsd32
+contrib/altq/altq/altq_cbq.c optional altq
+contrib/altq/altq/altq_cdnr.c optional altq
+contrib/altq/altq/altq_hfsc.c optional altq
+contrib/altq/altq/altq_priq.c optional altq
+contrib/altq/altq/altq_red.c optional altq
+contrib/altq/altq/altq_rio.c optional altq
+contrib/altq/altq/altq_rmclass.c optional altq
+contrib/altq/altq/altq_subr.c optional altq
contrib/dev/acpica/components/debugger/dbcmds.c optional acpi acpi_debug
contrib/dev/acpica/components/debugger/dbdisply.c optional acpi acpi_debug
contrib/dev/acpica/components/debugger/dbexec.c optional acpi acpi_debug
@@ -468,12 +462,12 @@ contrib/ipfilter/netinet/ip_sync.c optional ipfilter inet \
compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
contrib/ipfilter/netinet/mlfk_ipl.c optional ipfilter inet \
compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
-contrib/libfdt/fdt.c optional fdt
-contrib/libfdt/fdt_ro.c optional fdt
-contrib/libfdt/fdt_rw.c optional fdt
-contrib/libfdt/fdt_strerror.c optional fdt
-contrib/libfdt/fdt_sw.c optional fdt
-contrib/libfdt/fdt_wip.c optional fdt
+contrib/libfdt/fdt.c optional fdt
+contrib/libfdt/fdt_ro.c optional fdt
+contrib/libfdt/fdt_rw.c optional fdt
+contrib/libfdt/fdt_strerror.c optional fdt
+contrib/libfdt/fdt_sw.c optional fdt
+contrib/libfdt/fdt_wip.c optional fdt
contrib/ngatm/netnatm/api/cc_conn.c optional ngatm_ccatm \
compile-with "${NORMAL_C_NOWERROR} -I$S/contrib/ngatm"
contrib/ngatm/netnatm/api/cc_data.c optional ngatm_ccatm \
@@ -518,10 +512,10 @@ contrib/ngatm/netnatm/sig/sig_unimsgcpy.c optional ngatm_uni \
compile-with "${NORMAL_C} -I$S/contrib/ngatm"
contrib/ngatm/netnatm/sig/sig_verify.c optional ngatm_uni \
compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-crypto/blowfish/bf_ecb.c optional ipsec
-crypto/blowfish/bf_skey.c optional crypto | ipsec
-crypto/camellia/camellia.c optional crypto | ipsec
-crypto/camellia/camellia-api.c optional crypto | ipsec
+crypto/blowfish/bf_ecb.c optional ipsec
+crypto/blowfish/bf_skey.c optional crypto | ipsec
+crypto/camellia/camellia.c optional crypto | ipsec
+crypto/camellia/camellia-api.c optional crypto | ipsec
crypto/des/des_ecb.c optional crypto | ipsec
crypto/des/des_setkey.c optional crypto | ipsec
crypto/rc4/rc4.c optional netgraph_mppc_encryption | kgssapi
@@ -533,26 +527,26 @@ crypto/sha1.c optional carp | crypto | ipsec | \
netgraph_mppc_encryption | sctp
crypto/sha2/sha2.c optional crypto | geom_bde | ipsec | random | \
sctp | zfs
-ddb/db_access.c optional ddb
-ddb/db_break.c optional ddb
-ddb/db_capture.c optional ddb
-ddb/db_command.c optional ddb
-ddb/db_examine.c optional ddb
-ddb/db_expr.c optional ddb
-ddb/db_input.c optional ddb
-ddb/db_lex.c optional ddb
-ddb/db_main.c optional ddb
-ddb/db_output.c optional ddb
-ddb/db_print.c optional ddb
-ddb/db_ps.c optional ddb
-ddb/db_run.c optional ddb
-ddb/db_script.c optional ddb
-ddb/db_sym.c optional ddb
-ddb/db_thread.c optional ddb
-ddb/db_textdump.c optional ddb
-ddb/db_variables.c optional ddb
-ddb/db_watch.c optional ddb
-ddb/db_write_cmd.c optional ddb
+ddb/db_access.c optional ddb
+ddb/db_break.c optional ddb
+ddb/db_capture.c optional ddb
+ddb/db_command.c optional ddb
+ddb/db_examine.c optional ddb
+ddb/db_expr.c optional ddb
+ddb/db_input.c optional ddb
+ddb/db_lex.c optional ddb
+ddb/db_main.c optional ddb
+ddb/db_output.c optional ddb
+ddb/db_print.c optional ddb
+ddb/db_ps.c optional ddb
+ddb/db_run.c optional ddb
+ddb/db_script.c optional ddb
+ddb/db_sym.c optional ddb
+ddb/db_thread.c optional ddb
+ddb/db_textdump.c optional ddb
+ddb/db_variables.c optional ddb
+ddb/db_watch.c optional ddb
+ddb/db_write_cmd.c optional ddb
#dev/dpt/dpt_control.c optional dpt
dev/aac/aac.c optional aac
dev/aac/aac_cam.c optional aacp aac
@@ -617,7 +611,7 @@ dev/advansys/adwmcode.c optional adw
dev/ae/if_ae.c optional ae pci
dev/age/if_age.c optional age pci
dev/agp/agp.c optional agp pci
-dev/agp/agp_if.m optional agp pci
+dev/agp/agp_if.m optional agp pci
dev/aha/aha.c optional aha
dev/aha/aha_isa.c optional aha isa
dev/aha/aha_mca.c optional aha mca
@@ -707,9 +701,8 @@ dev/ath/if_ath_pci.c optional ath_pci pci \
dev/ath/if_ath_ahb.c optional ath_ahb \
compile-with "${NORMAL_C} -I$S/dev/ath"
#
-# XXX Work around clang warning, until maintainer approves fix.
dev/ath/if_ath.c optional ath \
- compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED} -I$S/dev/ath"
+ compile-with "${NORMAL_C} -I$S/dev/ath"
dev/ath/if_ath_beacon.c optional ath \
compile-with "${NORMAL_C} -I$S/dev/ath"
dev/ath/if_ath_debug.c optional ath \
@@ -939,30 +932,30 @@ dev/ath/ath_hal/ar9001/ar9160_attach.c optional ath_hal | ath_ar9160 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
# ar9280 (depends on ar5416)
dev/ath/ath_hal/ar9002/ar9280_attach.c optional ath_hal | ath_ar9280 | \
- ath_ar9285 \
+ ath_ar9285 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
dev/ath/ath_hal/ar9002/ar9280_olc.c optional ath_hal | ath_ar9280 | \
- ath_ar9285 \
+ ath_ar9285 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
# ar9285 (depends on ar5416 and ar9280)
-dev/ath/ath_hal/ar9002/ar9285_attach.c optional ath_hal | ath_ar9285 \
+dev/ath/ath_hal/ar9002/ar9285_attach.c optional ath_hal | ath_ar9285 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
-dev/ath/ath_hal/ar9002/ar9285_reset.c optional ath_hal | ath_ar9285 \
+dev/ath/ath_hal/ar9002/ar9285_reset.c optional ath_hal | ath_ar9285 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
-dev/ath/ath_hal/ar9002/ar9285_cal.c optional ath_hal | ath_ar9285 \
+dev/ath/ath_hal/ar9002/ar9285_cal.c optional ath_hal | ath_ar9285 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
-dev/ath/ath_hal/ar9002/ar9285_phy.c optional ath_hal | ath_ar9285 \
+dev/ath/ath_hal/ar9002/ar9285_phy.c optional ath_hal | ath_ar9285 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
-dev/ath/ath_hal/ar9002/ar9285_diversity.c optional ath_hal | ath_ar9285 \
+dev/ath/ath_hal/ar9002/ar9285_diversity.c optional ath_hal | ath_ar9285 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
# ar9287 (depends on ar5416)
-dev/ath/ath_hal/ar9002/ar9287_attach.c optional ath_hal | ath_ar9287 \
+dev/ath/ath_hal/ar9002/ar9287_attach.c optional ath_hal | ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
-dev/ath/ath_hal/ar9002/ar9287_reset.c optional ath_hal | ath_ar9287 \
+dev/ath/ath_hal/ar9002/ar9287_reset.c optional ath_hal | ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
-dev/ath/ath_hal/ar9002/ar9287_cal.c optional ath_hal | ath_ar9287 \
+dev/ath/ath_hal/ar9002/ar9287_cal.c optional ath_hal | ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
-dev/ath/ath_hal/ar9002/ar9287_olc.c optional ath_hal | ath_ar9287 \
+dev/ath/ath_hal/ar9002/ar9287_olc.c optional ath_hal | ath_ar9287 \
compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
# rf backends
@@ -997,9 +990,9 @@ dev/ath/ath_rate/onoe/onoe.c optional ath_rate_onoe \
dev/ath/ath_rate/sample/sample.c optional ath_rate_sample \
compile-with "${NORMAL_C} -I$S/dev/ath"
# ath DFS modules
-dev/ath/ath_dfs/null/dfs_null.c optional ath \
+dev/ath/ath_dfs/null/dfs_null.c optional ath \
compile-with "${NORMAL_C} -I$S/dev/ath"
-#
+#
dev/bce/if_bce.c optional bce
dev/bfe/if_bfe.c optional bfe
dev/bge/if_bge.c optional bge
@@ -1061,7 +1054,7 @@ dev/cxgb/common/cxgb_xgmac.c optional cxgb pci \
dev/cxgb/common/cxgb_t3_hw.c optional cxgb pci \
compile-with "${NORMAL_C} -I$S/dev/cxgb"
dev/cxgb/common/cxgb_tn1010.c optional cxgb pci \
- compile-with "${NORMAL_C} -I$S/dev/cxgb"
+ compile-with "${NORMAL_C} -I$S/dev/cxgb"
dev/cxgb/sys/uipc_mvec.c optional cxgb pci \
compile-with "${NORMAL_C} -I$S/dev/cxgb"
dev/cxgb/cxgb_t3fw.c optional cxgb cxgb_t3fw \
@@ -1261,12 +1254,12 @@ dev/etherswitch/arswitch/arswitch_8216.c optional arswitch
dev/etherswitch/arswitch/arswitch_8226.c optional arswitch
dev/etherswitch/arswitch/arswitch_8316.c optional arswitch
dev/etherswitch/arswitch/arswitch_7240.c optional arswitch
-dev/etherswitch/etherswitch.c optional etherswitch
+dev/etherswitch/etherswitch.c optional etherswitch
dev/etherswitch/etherswitch_if.m optional etherswitch
-dev/etherswitch/mdio_if.m optional miiproxy
-dev/etherswitch/mdio.c optional miiproxy
-dev/etherswitch/miiproxy.c optional miiproxy
-dev/etherswitch/rtl8366/rtl8366rb.c optional rtl8366rb
+dev/etherswitch/mdio_if.m optional miiproxy
+dev/etherswitch/mdio.c optional miiproxy
+dev/etherswitch/miiproxy.c optional miiproxy
+dev/etherswitch/rtl8366/rtl8366rb.c optional rtl8366rb
dev/ex/if_ex.c optional ex
dev/ex/if_ex_isa.c optional ex isa
dev/ex/if_ex_pccard.c optional ex pccard
@@ -1778,7 +1771,7 @@ dev/oce/oce_util.c optional oce pci
dev/ofw/ofw_bus_if.m optional fdt
dev/ofw/ofw_bus_subr.c optional fdt
dev/ofw/ofw_fdt.c optional fdt
-dev/ofw/ofw_if.m optional fdt
+dev/ofw/ofw_if.m optional fdt
dev/ofw/openfirm.c optional fdt
dev/ofw/openfirmio.c optional fdt
dev/patm/if_patm.c optional patm pci
@@ -2579,7 +2572,7 @@ kern/clock_if.m standard
kern/cpufreq_if.m standard
kern/device_if.m standard
kern/imgact_elf.c standard
-kern/imgact_elf32.c optional compat_freebsd32
+kern/imgact_elf32.c optional compat_freebsd32
kern/imgact_shell.c standard
kern/inflate.c optional gzip
kern/init_main.c standard
@@ -3162,9 +3155,9 @@ netnatm/natm_proto.c optional natm
netpfil/ipfw/dn_heap.c optional inet dummynet
netpfil/ipfw/dn_sched_fifo.c optional inet dummynet
netpfil/ipfw/dn_sched_prio.c optional inet dummynet
-netpfil/ipfw/dn_sched_qfq.c optional inet dummynet
+netpfil/ipfw/dn_sched_qfq.c optional inet dummynet
netpfil/ipfw/dn_sched_rr.c optional inet dummynet
-netpfil/ipfw/dn_sched_wf2q.c optional inet dummynet
+netpfil/ipfw/dn_sched_wf2q.c optional inet dummynet
netpfil/ipfw/ip_dummynet.c optional inet dummynet
netpfil/ipfw/ip_dn_io.c optional inet dummynet
netpfil/ipfw/ip_dn_glue.c optional inet dummynet
@@ -3220,7 +3213,7 @@ ofed/include/linux/linux_radix.c optional ofed \
no-depend compile-with "${OFED_C}"
ofed/drivers/infiniband/core/addr.c optional ofed \
no-depend \
- compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
+ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
ofed/drivers/infiniband/core/agent.c optional ofed \
no-depend \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
@@ -3562,9 +3555,9 @@ security/mac/mac_sysv_sem.c optional mac
security/mac/mac_sysv_shm.c optional mac
security/mac/mac_vfs.c optional mac
security/mac_biba/mac_biba.c optional mac_biba
-security/mac_bsdextended/mac_bsdextended.c optional mac_bsdextended
-security/mac_bsdextended/ugidfw_system.c optional mac_bsdextended
-security/mac_bsdextended/ugidfw_vnode.c optional mac_bsdextended
+security/mac_bsdextended/mac_bsdextended.c optional mac_bsdextended
+security/mac_bsdextended/ugidfw_system.c optional mac_bsdextended
+security/mac_bsdextended/ugidfw_vnode.c optional mac_bsdextended
security/mac_ifoff/mac_ifoff.c optional mac_ifoff
security/mac_lomac/mac_lomac.c optional mac_lomac
security/mac_mls/mac_mls.c optional mac_mls
diff --git a/sys/contrib/octeon-sdk/octeon-pci-console.c b/sys/contrib/octeon-sdk/octeon-pci-console.c
index ee260a9..85f0816 100644
--- a/sys/contrib/octeon-sdk/octeon-pci-console.c
+++ b/sys/contrib/octeon-sdk/octeon-pci-console.c
@@ -75,7 +75,7 @@
/* The following code is only used in standalone CVMX applications. It does
not apply for kernel or Linux programming */
-#if defined(OCTEON_TARGET) && !defined(__linux__)
+#if defined(OCTEON_TARGET) && !defined(__linux__) && !defined(CVMX_BUILD_FOR_LINUX_KERNEL)
static int cvmx_pci_console_num = 0;
static int per_core_pci_consoles = 0;
@@ -110,14 +110,14 @@ int __cvmx_pci_console_write (int fd, char *buf, int nbytes)
#if !defined(CONFIG_OCTEON_U_BOOT) || (defined(CONFIG_OCTEON_U_BOOT) && (defined(CFG_PCI_CONSOLE) || defined(CONFIG_SYS_PCI_CONSOLE)))
-int octeon_pci_console_buffer_free_bytes(uint32_t buffer_size, uint32_t wr_idx, uint32_t rd_idx)
+static int octeon_pci_console_buffer_free_bytes(uint32_t buffer_size, uint32_t wr_idx, uint32_t rd_idx)
{
if (rd_idx >= buffer_size || wr_idx >= buffer_size)
return -1;
return (((buffer_size -1) - (wr_idx - rd_idx))%buffer_size);
}
-int octeon_pci_console_buffer_avail_bytes(uint32_t buffer_size, uint32_t wr_idx, uint32_t rd_idx)
+static int octeon_pci_console_buffer_avail_bytes(uint32_t buffer_size, uint32_t wr_idx, uint32_t rd_idx)
{
if (rd_idx >= buffer_size || wr_idx >= buffer_size)
return -1;
@@ -287,7 +287,7 @@ int octeon_pci_console_host_read_avail(uint64_t console_desc_addr, unsigned int
/* This code is only available in a kernel or CVMX standalone. It can't be used
from userspace */
-#if (!defined(CONFIG_OCTEON_U_BOOT) && (!defined(__linux__) || defined(__KERNEL__))) || (defined(CONFIG_OCTEON_U_BOOT) && (defined(CFG_PCI_CONSOLE) || defined(CONFIG_SYS_PCI_CONSOLE)))
+#if (!defined(CONFIG_OCTEON_U_BOOT) && (!defined(__linux__) || defined(__KERNEL__))) || (defined(CONFIG_OCTEON_U_BOOT) && (defined(CFG_PCI_CONSOLE) || defined(CONFIG_SYS_PCI_CONSOLE))) || defined(CVMX_BUILD_FOR_LINUX_KERNEL)
static octeon_pci_console_t *octeon_pci_console_get_ptr(uint64_t console_desc_addr, unsigned int console_num)
{
diff --git a/sys/dev/adb/adb_mouse.c b/sys/dev/adb/adb_mouse.c
index 7eecb7a..70ad5c3 100644
--- a/sys/dev/adb/adb_mouse.c
+++ b/sys/dev/adb/adb_mouse.c
@@ -569,9 +569,9 @@ ams_read(struct cdev *dev, struct uio *uio, int flag)
mtx_unlock(&sc->sc_mtx);
- uiomove(outpacket,len,uio);
+ error = uiomove(outpacket,len,uio);
- return (0);
+ return (error);
}
diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c
index 58931ad..79b2d54 100644
--- a/sys/dev/agp/agp.c
+++ b/sys/dev/agp/agp.c
@@ -28,7 +28,6 @@
__FBSDID("$FreeBSD$");
#include "opt_agp.h"
-#include "opt_bus.h"
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/dev/agp/agp_ali.c b/sys/dev/agp/agp_ali.c
index 09ebb2b..7cd16ba 100644
--- a/sys/dev/agp/agp_ali.c
+++ b/sys/dev/agp/agp_ali.c
@@ -27,8 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_bus.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
diff --git a/sys/dev/agp/agp_amd.c b/sys/dev/agp/agp_amd.c
index fabb9b1..5e0d6d0 100644
--- a/sys/dev/agp/agp_amd.c
+++ b/sys/dev/agp/agp_amd.c
@@ -27,8 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_bus.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
diff --git a/sys/dev/agp/agp_amd64.c b/sys/dev/agp/agp_amd64.c
index e2bfa67..d4d11ac 100644
--- a/sys/dev/agp/agp_amd64.c
+++ b/sys/dev/agp/agp_amd64.c
@@ -27,8 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_bus.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
diff --git a/sys/dev/agp/agp_apple.c b/sys/dev/agp/agp_apple.c
index e16e114..263631d 100644
--- a/sys/dev/agp/agp_apple.c
+++ b/sys/dev/agp/agp_apple.c
@@ -27,8 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_bus.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
diff --git a/sys/dev/agp/agp_ati.c b/sys/dev/agp/agp_ati.c
index 4c56df1..350d846 100644
--- a/sys/dev/agp/agp_ati.c
+++ b/sys/dev/agp/agp_ati.c
@@ -29,8 +29,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_bus.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
diff --git a/sys/dev/agp/agp_i810.c b/sys/dev/agp/agp_i810.c
index 39d6cba..2a7e885 100644
--- a/sys/dev/agp/agp_i810.c
+++ b/sys/dev/agp/agp_i810.c
@@ -40,8 +40,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_bus.h"
-
#if 0
#define KTR_AGP_I810 KTR_DEV
#else
diff --git a/sys/dev/agp/agp_intel.c b/sys/dev/agp/agp_intel.c
index ac10c8e..34ea66c 100644
--- a/sys/dev/agp/agp_intel.c
+++ b/sys/dev/agp/agp_intel.c
@@ -27,8 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_bus.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
diff --git a/sys/dev/agp/agp_nvidia.c b/sys/dev/agp/agp_nvidia.c
index 6db87c6..bb153f9 100644
--- a/sys/dev/agp/agp_nvidia.c
+++ b/sys/dev/agp/agp_nvidia.c
@@ -32,8 +32,6 @@ __FBSDID("$FreeBSD$");
* NVIDIA nForce/nForce2 AGPGART Linux Kernel Patch.
*/
-#include "opt_bus.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
diff --git a/sys/dev/agp/agp_sis.c b/sys/dev/agp/agp_sis.c
index e8f542b..e087ba9 100644
--- a/sys/dev/agp/agp_sis.c
+++ b/sys/dev/agp/agp_sis.c
@@ -27,8 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_bus.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
diff --git a/sys/dev/agp/agp_via.c b/sys/dev/agp/agp_via.c
index c561513..a6f3918 100644
--- a/sys/dev/agp/agp_via.c
+++ b/sys/dev/agp/agp_via.c
@@ -27,8 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_bus.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
diff --git a/sys/dev/aic7xxx/aicasm/aicasm_gram.y b/sys/dev/aic7xxx/aicasm/aicasm_gram.y
index e4ee307..cc7475c 100644
--- a/sys/dev/aic7xxx/aicasm/aicasm_gram.y
+++ b/sys/dev/aic7xxx/aicasm/aicasm_gram.y
@@ -1076,7 +1076,7 @@ conditional:
last_scope = TAILQ_LAST(&scope_context->inner_scope,
scope_tailq);
if (last_scope == NULL
- || last_scope->type == T_ELSE) {
+ || last_scope->type == SCOPE_ELSE) {
stop("'else if' without leading 'if'", EX_DATAERR);
/* NOTREACHED */
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416desc.h b/sys/dev/ath/ath_hal/ar5416/ar5416desc.h
index bc57d89..fab055c 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416desc.h
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416desc.h
@@ -17,12 +17,11 @@
* $FreeBSD$
*/
#ifndef _ATH_AR5416_DESC_H_
-#define _ATH_AR5416_DESC_H
+#define _ATH_AR5416_DESC_H_
/*
* Hardware-specific descriptor structures.
*/
-#include "ah_desc.h"
/* XXX Need to replace this with a dynamic
* method of determining Owl2 if possible
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index 4ef23a2..2d74e3e 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -296,6 +296,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
if (ifp == NULL) {
device_printf(sc->sc_dev, "can not if_alloc()\n");
error = ENOSPC;
+ CURVNET_RESTORE();
goto bad;
}
ic = ifp->if_l2com;
@@ -890,6 +891,11 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
*/
#ifdef ATH_DEBUG_ALQ
if_ath_alq_init(&sc->sc_alq, device_get_nameunit(sc->sc_dev));
+ if_ath_alq_setcfg(&sc->sc_alq,
+ sc->sc_ah->ah_macVersion,
+ sc->sc_ah->ah_macRev,
+ sc->sc_ah->ah_phyRev,
+ sc->sc_ah->ah_magic);
#endif
/*
@@ -3768,6 +3774,14 @@ ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq, int dosched)
ath_printtxbuf(sc, bf, txq->axq_qnum, 0,
status == HAL_OK);
#endif
+#ifdef ATH_DEBUG_ALQ
+ if (if_ath_alq_checkdebug(&sc->sc_alq,
+ ATH_ALQ_EDMA_TXSTATUS)) {
+ if_ath_alq_post(&sc->sc_alq, ATH_ALQ_EDMA_TXSTATUS,
+ sc->sc_tx_statuslen,
+ (char *) ds);
+ }
+#endif
if (status == HAL_EINPROGRESS) {
ATH_KTR(sc, ATH_KTR_TXCOMP, 3,
diff --git a/sys/dev/ath/if_ath_alq.c b/sys/dev/ath/if_ath_alq.c
index b838772..bd83933 100644
--- a/sys/dev/ath/if_ath_alq.c
+++ b/sys/dev/ath/if_ath_alq.c
@@ -43,6 +43,7 @@
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/alq.h>
+#include <sys/endian.h>
#include <dev/ath/if_ath_alq.h>
@@ -77,6 +78,18 @@ if_ath_alq_init(struct if_ath_alq *alq, const char *devname)
}
void
+if_ath_alq_setcfg(struct if_ath_alq *alq, uint32_t macVer,
+ uint32_t macRev, uint32_t phyRev, uint32_t halMagic)
+{
+
+ /* Store these in network order */
+ alq->sc_alq_cfg.sc_mac_version = htobe32(macVer);
+ alq->sc_alq_cfg.sc_mac_revision = htobe32(macRev);
+ alq->sc_alq_cfg.sc_phy_rev = htobe32(phyRev);
+ alq->sc_alq_cfg.sc_hal_magic = htobe32(halMagic);
+}
+
+void
if_ath_alq_tidyup(struct if_ath_alq *alq)
{
@@ -106,6 +119,9 @@ if_ath_alq_start(struct if_ath_alq *alq)
} else {
printf("%s (%s): opened\n", __func__, alq->sc_alq_devname);
alq->sc_alq_isactive = 1;
+ if_ath_alq_post(alq, ATH_ALQ_INIT_STATE,
+ sizeof (struct if_ath_alq_init_state),
+ (char *) &alq->sc_alq_cfg);
}
return (error);
}
@@ -155,17 +171,17 @@ if_ath_alq_post(struct if_ath_alq *alq, uint16_t op, uint16_t len,
return;
ap = (struct if_ath_alq_hdr *) ale->ae_data;
- ap->threadid = (uint64_t) curthread->td_tid;
- ap->tstamp = (uint32_t) ticks;
- ap->op = op;
- ap->len = len;
+ ap->threadid = htobe64((uint64_t) curthread->td_tid);
+ ap->tstamp = htobe32((uint32_t) ticks);
+ ap->op = htobe16(op);
+ ap->len = htobe16(len);
/*
* Copy the payload _after_ the header field.
*/
memcpy(((char *) ap) + sizeof(struct if_ath_alq_hdr),
buf,
- ap->len);
+ len);
alq_post(alq->sc_alq_alq, ale);
}
diff --git a/sys/dev/ath/if_ath_alq.h b/sys/dev/ath/if_ath_alq.h
index aeee12c..2720e63 100644
--- a/sys/dev/ath/if_ath_alq.h
+++ b/sys/dev/ath/if_ath_alq.h
@@ -31,6 +31,23 @@
#ifndef __IF_ATH_ALQ_H__
#define __IF_ATH_ALQ_H__
+#define ATH_ALQ_INIT_STATE 1
+struct if_ath_alq_init_state {
+ uint32_t sc_mac_version;
+ uint32_t sc_mac_revision;
+ uint32_t sc_phy_rev;
+ uint32_t sc_hal_magic;
+};
+
+#define ATH_ALQ_EDMA_TXSTATUS 2
+#define ATH_ALQ_EDMA_RXSTATUS 3
+#define ATH_ALQ_EDMA_TXDESC 4
+
+/*
+ * These will always be logged, regardless.
+ */
+#define ATH_ALQ_LOG_ALWAYS_MASK 0x00000001
+
#define ATH_ALQ_FILENAME_LEN 128
#define ATH_ALQ_DEVNAME_LEN 32
@@ -42,12 +59,9 @@ struct if_ath_alq {
int sc_alq_isactive;
char sc_alq_devname[ATH_ALQ_DEVNAME_LEN];
char sc_alq_filename[ATH_ALQ_FILENAME_LEN];
+ struct if_ath_alq_init_state sc_alq_cfg;
};
-#define ATH_ALQ_EDMA_TXSTATUS 1
-#define ATH_ALQ_EDMA_RXSTATUS 2
-#define ATH_ALQ_EDMA_TXDESC 3
-
/* 128 bytes in total */
#define ATH_ALQ_PAYLOAD_LEN 112
@@ -68,10 +82,13 @@ static inline int
if_ath_alq_checkdebug(struct if_ath_alq *alq, uint16_t op)
{
- return (alq->sc_alq_debug & (1 << (op - 1)));
+ return ((alq->sc_alq_debug | ATH_ALQ_LOG_ALWAYS_MASK)
+ & (1 << (op - 1)));
}
extern void if_ath_alq_init(struct if_ath_alq *alq, const char *devname);
+extern void if_ath_alq_setcfg(struct if_ath_alq *alq, uint32_t macVer,
+ uint32_t macRev, uint32_t phyRev, uint32_t halMagic);
extern void if_ath_alq_tidyup(struct if_ath_alq *alq);
extern int if_ath_alq_start(struct if_ath_alq *alq);
extern int if_ath_alq_stop(struct if_ath_alq *alq);
diff --git a/sys/dev/ath/if_ath_rx.c b/sys/dev/ath/if_ath_rx.c
index ff160b9..3ebfb2f 100644
--- a/sys/dev/ath/if_ath_rx.c
+++ b/sys/dev/ath/if_ath_rx.c
@@ -895,6 +895,13 @@ ath_rx_proc(struct ath_softc *sc, int resched)
if (sc->sc_debug & ATH_DEBUG_RECV_DESC)
ath_printrxbuf(sc, bf, 0, status == HAL_OK);
#endif
+
+#ifdef ATH_DEBUG_ALQ
+ if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_RXSTATUS))
+ if_ath_alq_post(&sc->sc_alq, ATH_ALQ_EDMA_RXSTATUS,
+ sc->sc_rx_statuslen, (char *) ds);
+#endif /* ATH_DEBUG_ALQ */
+
if (status == HAL_EINPROGRESS)
break;
@@ -1120,7 +1127,11 @@ ath_recv_setup_legacy(struct ath_softc *sc)
{
/* Sensible legacy defaults */
- sc->sc_rx_statuslen = 0;
+ /*
+ * XXX this should be changed to properly support the
+ * exact RX descriptor size for each HAL.
+ */
+ sc->sc_rx_statuslen = sizeof(struct ath_desc);
sc->sc_rx.recv_start = ath_legacy_startrecv;
sc->sc_rx.recv_stop = ath_legacy_stoprecv;
diff --git a/sys/dev/ath/if_ath_sysctl.c b/sys/dev/ath/if_ath_sysctl.c
index 1ab627f..5de29af 100644
--- a/sys/dev/ath/if_ath_sysctl.c
+++ b/sys/dev/ath/if_ath_sysctl.c
@@ -569,10 +569,12 @@ ath_sysctlattach(struct ath_softc *sc)
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"regdomain", CTLFLAG_RD, &sc->sc_eerd, 0,
"EEPROM regdomain code");
-#ifdef ATH_DEBUG_ALQ
+#ifdef ATH_DEBUG
SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"debug", CTLFLAG_RW, &sc->sc_debug,
"control debugging printfs");
+#endif
+#ifdef ATH_DEBUG_ALQ
SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"ktrdebug", CTLFLAG_RW, &sc->sc_ktrdebug,
"control debugging KTR");
diff --git a/sys/dev/ath/if_ath_tx.c b/sys/dev/ath/if_ath_tx.c
index e18785e..1eaa6ba 100644
--- a/sys/dev/ath/if_ath_tx.c
+++ b/sys/dev/ath/if_ath_tx.c
@@ -130,6 +130,35 @@ static struct ath_buf *
ath_tx_retry_clone(struct ath_softc *sc, struct ath_node *an,
struct ath_tid *tid, struct ath_buf *bf);
+#ifdef ATH_DEBUG_ALQ
+void
+ath_tx_alq_post(struct ath_softc *sc, struct ath_buf *bf_first)
+{
+ struct ath_buf *bf;
+ int i, n;
+ const char *ds;
+
+ /* XXX we should skip out early if debugging isn't enabled! */
+ bf = bf_first;
+
+ while (bf != NULL) {
+ /* XXX should ensure bf_nseg > 0! */
+ if (bf->bf_nseg == 0)
+ break;
+ n = ((bf->bf_nseg - 1) / sc->sc_tx_nmaps) + 1;
+ for (i = 0, ds = (const char *) bf->bf_desc;
+ i < n;
+ i++, ds += sc->sc_tx_desclen) {
+ if_ath_alq_post(&sc->sc_alq,
+ ATH_ALQ_EDMA_TXDESC,
+ sc->sc_tx_desclen,
+ ds);
+ }
+ bf = bf->bf_next;
+ }
+}
+#endif /* ATH_DEBUG_ALQ */
+
/*
* Whether to use the 11n rate scenario functions or not
*/
@@ -528,11 +557,19 @@ ath_tx_setds_11n(struct ath_softc *sc, struct ath_buf *bf_first)
__func__, bf_first->bf_state.bfs_nframes,
bf_first->bf_state.bfs_al);
+ bf = bf_first;
+
+ if (bf->bf_state.bfs_txrate0 == 0)
+ device_printf(sc->sc_dev, "%s: bf=%p, txrate0=%d\n",
+ __func__, bf, 0);
+ if (bf->bf_state.bfs_rc[0].ratecode == 0)
+ device_printf(sc->sc_dev, "%s: bf=%p, rix0=%d\n",
+ __func__, bf, 0);
+
/*
* Setup all descriptors of all subframes - this will
* call ath_hal_set11naggrmiddle() on every frame.
*/
- bf = bf_first;
while (bf != NULL) {
DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR,
"%s: bf=%p, nseg=%d, pktlen=%d, seqno=%d\n",
@@ -615,6 +652,31 @@ ath_tx_setds_11n(struct ath_softc *sc, struct ath_buf *bf_first)
*/
bf_first->bf_last = bf_prev;
+ /*
+ * For non-AR9300 NICs, which require the rate control
+ * in the final descriptor - let's set that up now.
+ *
+ * This is because the filltxdesc() HAL call doesn't
+ * populate the last segment with rate control information
+ * if firstSeg is also true. For non-aggregate frames
+ * that is fine, as the first frame already has rate control
+ * info. But if the last frame in an aggregate has one
+ * descriptor, both firstseg and lastseg will be true and
+ * the rate info isn't copied.
+ *
+ * This is inefficient on MIPS/ARM platforms that have
+ * non-cachable memory for TX descriptors, but we'll just
+ * make do for now.
+ *
+ * As to why the rate table is stashed in the last descriptor
+ * rather than the first descriptor? Because proctxdesc()
+ * is called on the final descriptor in an MPDU or A-MPDU -
+ * ie, the one that gets updated by the hardware upon
+ * completion. That way proctxdesc() doesn't need to know
+ * about the first _and_ last TX descriptor.
+ */
+ ath_hal_setuplasttxdesc(sc->sc_ah, bf_prev->bf_lastds, ds0);
+
DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: end\n", __func__);
}
@@ -880,6 +942,11 @@ ath_legacy_xmit_handoff(struct ath_softc *sc, struct ath_txq *txq,
{
ATH_TXQ_LOCK_ASSERT(txq);
+#ifdef ATH_DEBUG_ALQ
+ if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_TXDESC))
+ ath_tx_alq_post(sc, bf);
+#endif
+
if (txq->axq_qnum == ATH_TXQ_SWQ)
ath_tx_handoff_mcast(sc, txq, bf);
else
@@ -1236,6 +1303,10 @@ ath_tx_setds(struct ath_softc *sc, struct ath_buf *bf)
struct ath_desc *ds = bf->bf_desc;
struct ath_hal *ah = sc->sc_ah;
+ if (bf->bf_state.bfs_txrate0 == 0)
+ device_printf(sc->sc_dev, "%s: bf=%p, txrate0=%d\n",
+ __func__, bf, 0);
+
ath_hal_setuptxdesc(ah, ds
, bf->bf_state.bfs_pktlen /* packet length */
, bf->bf_state.bfs_hdrlen /* header length */
@@ -5453,7 +5524,7 @@ ath_xmit_setup_legacy(struct ath_softc *sc)
* worry about extracting the real length out of the HAL later.
*/
sc->sc_tx_desclen = sizeof(struct ath_desc);
- sc->sc_tx_statuslen = 0;
+ sc->sc_tx_statuslen = sizeof(struct ath_desc);
sc->sc_tx_nmaps = 1; /* only one buffer per TX desc */
sc->sc_tx.xmit_setup = ath_legacy_dma_txsetup;
diff --git a/sys/dev/ath/if_ath_tx.h b/sys/dev/ath/if_ath_tx.h
index a56b9de..1397faa 100644
--- a/sys/dev/ath/if_ath_tx.h
+++ b/sys/dev/ath/if_ath_tx.h
@@ -131,6 +131,13 @@ extern void ath_tx_node_wakeup(struct ath_softc *sc, struct ath_node *an);
extern int ath_tx_node_is_asleep(struct ath_softc *sc, struct ath_node *an);
/*
+ * Misc debugging stuff
+ */
+#ifdef ATH_DEBUG_ALQ
+extern void ath_tx_alq_post(struct ath_softc *sc, struct ath_buf *bf_first);
+#endif /* ATH_DEBUG_ALQ */
+
+/*
* Setup path
*/
#define ath_txdma_setup(_sc) \
diff --git a/sys/dev/ath/if_ath_tx_edma.c b/sys/dev/ath/if_ath_tx_edma.c
index 8f35907..579e940 100644
--- a/sys/dev/ath/if_ath_tx_edma.c
+++ b/sys/dev/ath/if_ath_tx_edma.c
@@ -136,37 +136,6 @@ MALLOC_DECLARE(M_ATHDEV);
static void ath_edma_tx_processq(struct ath_softc *sc, int dosched);
-#ifdef ATH_DEBUG_ALQ
-static void
-ath_edma_tx_alq_post(struct ath_softc *sc, struct ath_buf *bf_first)
-{
- struct ath_buf *bf;
- int i, n;
- const char *ds;
-
- /* XXX we should skip out early if debugging isn't enabled! */
- bf = bf_first;
-
- while (bf != NULL) {
- /* XXX assume nmaps = 4! */
- /* XXX should ensure bf_nseg > 0! */
- if (bf->bf_nseg == 0)
- break;
- n = ((bf->bf_nseg - 1) / 4) + 1;
- for (i = 0, ds = (const char *) bf->bf_desc;
- i < n;
- i++, ds += sc->sc_tx_desclen) {
- if_ath_alq_post(&sc->sc_alq,
- ATH_ALQ_EDMA_TXDESC,
- 96,
- ds);
- }
-
- bf = bf->bf_next;
- }
-}
-#endif /* ATH_DEBUG_ALQ */
-
static void
ath_edma_tx_fifo_fill(struct ath_softc *sc, struct ath_txq *txq)
{
@@ -187,7 +156,7 @@ ath_edma_tx_fifo_fill(struct ath_softc *sc, struct ath_txq *txq)
#endif/* ATH_DEBUG */
#ifdef ATH_DEBUG_ALQ
if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_TXDESC))
- ath_edma_tx_alq_post(sc, bf);
+ ath_tx_alq_post(sc, bf);
#endif /* ATH_DEBUG_ALQ */
txq->axq_fifo_depth++;
i++;
@@ -260,7 +229,7 @@ ath_edma_xmit_handoff_hw(struct ath_softc *sc, struct ath_txq *txq,
#endif /* ATH_DEBUG */
#ifdef ATH_DEBUG_ALQ
if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_TXDESC))
- ath_edma_tx_alq_post(sc, bf);
+ ath_tx_alq_post(sc, bf);
#endif /* ATH_DEBUG_ALQ */
ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
txq->axq_fifo_depth++;
@@ -271,16 +240,9 @@ ath_edma_xmit_handoff_hw(struct ath_softc *sc, struct ath_txq *txq,
/*
* Hand off this frame to a multicast software queue.
*
- * Unlike legacy DMA, this doesn't chain together frames via the
- * link pointer. Instead, they're just added to the queue.
- * When it comes time to populate the CABQ, these frames should
- * be individually pushed into the FIFO as appropriate.
- *
- * Yes, this does mean that I'll eventually have to flesh out some
- * replacement code to handle populating the CABQ, rather than
- * what's done in ath_beacon_generate(). It'll have to push each
- * frame from the HW CABQ to the FIFO rather than just appending
- * it to the existing TXQ and kicking off DMA.
+ * The EDMA TX CABQ will get a list of chained frames, chained
+ * together using the next pointer. The single head of that
+ * particular queue is pushed to the hardware CABQ.
*/
static void
ath_edma_xmit_handoff_mcast(struct ath_softc *sc, struct ath_txq *txq,
@@ -307,7 +269,13 @@ ath_edma_xmit_handoff_mcast(struct ath_softc *sc, struct ath_txq *txq,
BUS_DMASYNC_PREWRITE);
}
+#ifdef ATH_DEBUG_ALQ
+ if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_TXDESC))
+ ath_tx_alq_post(sc, bf);
+#endif /* ATH_DEBUG_ALQ */
+
ATH_TXQ_INSERT_TAIL(txq, bf, bf_list);
+ ath_hal_gettxdesclinkptr(sc->sc_ah, bf->bf_lastds, &txq->axq_link);
}
/*
diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c
index 05d11b3..84cd1a2 100644
--- a/sys/dev/cxgbe/tom/t4_listen.c
+++ b/sys/dev/cxgbe/tom/t4_listen.c
@@ -559,8 +559,10 @@ t4_syncache_respond(struct toedev *tod, void *arg, struct mbuf *m)
struct tcphdr *th = (void *)(ip + 1);
wr = (struct wrqe *)atomic_readandclear_ptr(&synqe->wr);
- if (wr == NULL)
+ if (wr == NULL) {
+ m_freem(m);
return (EALREADY);
+ }
bzero(&to, sizeof(to));
tcp_dooptions(&to, (void *)(th + 1), (th->th_off << 2) - sizeof(*th),
diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c
index d251555..55084e9 100644
--- a/sys/dev/iicbus/iic.c
+++ b/sys/dev/iicbus/iic.c
@@ -221,7 +221,11 @@ iicwrite(struct cdev *dev, struct uio * uio, int ioflag)
}
count = min(uio->uio_resid, BUFSIZE);
- uiomove(sc->sc_buffer, count, uio);
+ error = uiomove(sc->sc_buffer, count, uio);
+ if (error) {
+ IIC_UNLOCK(sc);
+ return (error);
+ }
error = iicbus_block_write(device_get_parent(iicdev), sc->sc_addr,
sc->sc_buffer, count, &sent);
diff --git a/sys/dev/mfi/mfi_syspd.c b/sys/dev/mfi/mfi_syspd.c
index 0508409..739b866 100644
--- a/sys/dev/mfi/mfi_syspd.c
+++ b/sys/dev/mfi/mfi_syspd.c
@@ -122,8 +122,8 @@ mfi_syspd_attach(device_t dev)
break;
}
mtx_unlock(&sc->pd_controller->mfi_io_lock);
- device_printf(dev, "%juMB (%ju sectors) SYSPD volume\n",
- sectors / (1024 * 1024 / secsize), sectors);
+ device_printf(dev, "%juMB (%ju sectors) SYSPD volume (deviceid: %d)\n",
+ sectors / (1024 * 1024 / secsize), sectors, sc->pd_id);
sc->pd_disk = disk_alloc();
sc->pd_disk->d_drv1 = sc;
sc->pd_disk->d_maxsize = sc->pd_controller->mfi_max_io * secsize;
diff --git a/sys/dev/sio/sio_isa.c b/sys/dev/sio/sio_isa.c
index da8b61c..fd2b49d 100644
--- a/sys/dev/sio/sio_isa.c
+++ b/sys/dev/sio/sio_isa.c
@@ -83,6 +83,7 @@ static struct isa_pnp_id sio_ids[] = {
{0x0034490a, NULL}, /* BRI3400 - Internal ACF Modem */
{0x0094490a, NULL}, /* BRI9400 - Boca K56Flex PnP */
{0x00b4490a, NULL}, /* BRIB400 - Boca 56k PnP */
+ {0x0010320d, NULL}, /* CIR1000 - Cirrus Logic V34 */
{0x0030320d, NULL}, /* CIR3000 - Cirrus Logic V43 */
{0x0100440e, NULL}, /* CRD0001 - Cardinal MVP288IV ? */
{0x01308c0e, NULL}, /* CTL3001 - Creative Labs Phoneblaster */
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index 4135311..75b02d0 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -1037,12 +1037,14 @@ static const struct {
{ "2.0", "2", "stereo", SND_CHN_MATRIX_2_0 },
{ "2.1", NULL, NULL, SND_CHN_MATRIX_2_1 },
{ "3.0", "3", NULL, SND_CHN_MATRIX_3_0 },
+ { "3.1", NULL, NULL, SND_CHN_MATRIX_3_1 },
{ "4.0", "4", "quad", SND_CHN_MATRIX_4_0 },
{ "4.1", NULL, NULL, SND_CHN_MATRIX_4_1 },
{ "5.0", "5", NULL, SND_CHN_MATRIX_5_0 },
{ "5.1", "6", NULL, SND_CHN_MATRIX_5_1 },
{ "6.0", NULL, NULL, SND_CHN_MATRIX_6_0 },
{ "6.1", "7", NULL, SND_CHN_MATRIX_6_1 },
+ { "7.0", NULL, NULL, SND_CHN_MATRIX_7_0 },
{ "7.1", "8", NULL, SND_CHN_MATRIX_7_1 },
{ NULL, NULL, NULL, SND_CHN_MATRIX_UNKNOWN }
};
diff --git a/sys/dev/sound/pcm/feeder_matrix.c b/sys/dev/sound/pcm/feeder_matrix.c
index d2d9595..e59c124 100644
--- a/sys/dev/sound/pcm/feeder_matrix.c
+++ b/sys/dev/sound/pcm/feeder_matrix.c
@@ -86,12 +86,14 @@ static struct pcmchan_matrix feeder_matrix_maps[SND_CHN_MATRIX_MAX] = {
[SND_CHN_MATRIX_2_0] = SND_CHN_MATRIX_MAP_2_0,
[SND_CHN_MATRIX_2_1] = SND_CHN_MATRIX_MAP_2_1,
[SND_CHN_MATRIX_3_0] = SND_CHN_MATRIX_MAP_3_0,
+ [SND_CHN_MATRIX_3_1] = SND_CHN_MATRIX_MAP_3_1,
[SND_CHN_MATRIX_4_0] = SND_CHN_MATRIX_MAP_4_0,
[SND_CHN_MATRIX_4_1] = SND_CHN_MATRIX_MAP_4_1,
[SND_CHN_MATRIX_5_0] = SND_CHN_MATRIX_MAP_5_0,
[SND_CHN_MATRIX_5_1] = SND_CHN_MATRIX_MAP_5_1,
[SND_CHN_MATRIX_6_0] = SND_CHN_MATRIX_MAP_6_0,
[SND_CHN_MATRIX_6_1] = SND_CHN_MATRIX_MAP_6_1,
+ [SND_CHN_MATRIX_7_0] = SND_CHN_MATRIX_MAP_7_0,
[SND_CHN_MATRIX_7_1] = SND_CHN_MATRIX_MAP_7_1
};
diff --git a/sys/dev/sound/pcm/matrix.h b/sys/dev/sound/pcm/matrix.h
index e33d986..6ff1074 100644
--- a/sys/dev/sound/pcm/matrix.h
+++ b/sys/dev/sound/pcm/matrix.h
@@ -134,29 +134,31 @@
#define SND_CHN_MATRIX_3_0 3
#define SND_CHN_MATRIX_3 SND_CHN_MATRIX_3_0
-/* 4 @ 4.0 Quadraphonic */
-#define SND_CHN_MATRIX_4_0 4
+/* 4 @ 3.1 (lfe), 4.0 (Quadraphonic, DEFAULT) */
+#define SND_CHN_MATRIX_3_1 4
+#define SND_CHN_MATRIX_4_0 5
#define SND_CHN_MATRIX_4 SND_CHN_MATRIX_4_0
/* 5 @ 4.1 (lfe), 5.0 (center, DEFAULT) */
-#define SND_CHN_MATRIX_4_1 5
-#define SND_CHN_MATRIX_5_0 6
+#define SND_CHN_MATRIX_4_1 6
+#define SND_CHN_MATRIX_5_0 7
#define SND_CHN_MATRIX_5 SND_CHN_MATRIX_5_0
/* 6 @ 5.1 (lfe, DEFAULT), 6.0 (rear center) */
-#define SND_CHN_MATRIX_5_1 7
-#define SND_CHN_MATRIX_6_0 8
+#define SND_CHN_MATRIX_5_1 8
+#define SND_CHN_MATRIX_6_0 9
#define SND_CHN_MATRIX_6 SND_CHN_MATRIX_5_1
-/* 7 @ 6.1 (lfe) */
-#define SND_CHN_MATRIX_6_1 9
+/* 7 @ 6.1 (lfe, DEFAULT), 7.0 */
+#define SND_CHN_MATRIX_6_1 10
+#define SND_CHN_MATRIX_7_0 11
#define SND_CHN_MATRIX_7 SND_CHN_MATRIX_6_1
/* 8 @ 7.1 (lfe) */
-#define SND_CHN_MATRIX_7_1 10
+#define SND_CHN_MATRIX_7_1 12
#define SND_CHN_MATRIX_8 SND_CHN_MATRIX_7_1
-#define SND_CHN_MATRIX_MAX 11
+#define SND_CHN_MATRIX_MAX 13
#define SND_CHN_MATRIX_BEGIN SND_CHN_MATRIX_1_0
#define SND_CHN_MATRIX_END SND_CHN_MATRIX_7_1
diff --git a/sys/dev/sound/pcm/matrix_map.h b/sys/dev/sound/pcm/matrix_map.h
index c13a051..ff79e95 100644
--- a/sys/dev/sound/pcm/matrix_map.h
+++ b/sys/dev/sound/pcm/matrix_map.h
@@ -195,6 +195,49 @@
-1, -1, -1, -1, -1, -1, -1, -1, -1 } \
}
+#define SND_CHN_MATRIX_MAP_3_1 { \
+ .id = SND_CHN_MATRIX_3_1, \
+ .channels = 4, \
+ .ext = 1, \
+ .map = { \
+ /* Left */ \
+ [0] = { \
+ .type = SND_CHN_T_FL, \
+ .members = \
+ SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FC | \
+ SND_CHN_T_MASK_SL \
+ }, \
+ /* Right */ \
+ [1] = { \
+ .type = SND_CHN_T_FR, \
+ .members = \
+ SND_CHN_T_MASK_FR | SND_CHN_T_MASK_FC | \
+ SND_CHN_T_MASK_SR \
+ }, \
+ /* LFE */ \
+ [2] = { \
+ .type = SND_CHN_T_LF, \
+ .members = SND_CHN_T_MASK_LF \
+ }, \
+ /* Rear Center */ \
+ [3] = { \
+ .type = SND_CHN_T_BC, \
+ .members = \
+ SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR | \
+ SND_CHN_T_MASK_BC | \
+ SND_CHN_T_MASK_SL | SND_CHN_T_MASK_SR \
+ }, \
+ [4] = { \
+ .type = SND_CHN_T_MAX, \
+ .members = 0 \
+ } \
+ }, \
+ .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \
+ SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BC, \
+ .offset = { 0, 1, -1, 2, -1, -1, -1, -1, 3, \
+ -1, -1, -1, -1, -1, -1, -1, -1, -1 } \
+}
+
#define SND_CHN_MATRIX_MAP_4_0 { \
.id = SND_CHN_MATRIX_4_0, \
.channels = 4, \
@@ -504,6 +547,68 @@
-1, -1, -1, -1, -1, -1, -1, -1, -1 } \
}
+#define SND_CHN_MATRIX_MAP_7_0 { \
+ .id = SND_CHN_MATRIX_7_0, \
+ .channels = 7, \
+ .ext = 0, \
+ .map = { \
+ /* Left */ \
+ [0] = { \
+ .type = SND_CHN_T_FL, \
+ .members = \
+ SND_CHN_T_MASK_FL | SND_CHN_T_MASK_LF \
+ }, \
+ /* Right */ \
+ [1] = { \
+ .type = SND_CHN_T_FR, \
+ .members = \
+ SND_CHN_T_MASK_FR | SND_CHN_T_MASK_LF \
+ }, \
+ /* Rear Left */ \
+ [2] = { \
+ .type = SND_CHN_T_BL, \
+ .members = \
+ SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BC | \
+ SND_CHN_T_MASK_LF \
+ }, \
+ /* Rear Right */ \
+ [3] = { \
+ .type = SND_CHN_T_BR, \
+ .members = \
+ SND_CHN_T_MASK_BR | SND_CHN_T_MASK_BC | \
+ SND_CHN_T_MASK_LF \
+ }, \
+ /* Center */ \
+ [4] = { \
+ .type = SND_CHN_T_FC, \
+ .members = \
+ SND_CHN_T_MASK_FC | SND_CHN_T_MASK_LF \
+ }, \
+ /* Side Left */ \
+ [5] = { \
+ .type = SND_CHN_T_SL, \
+ .members = \
+ SND_CHN_T_MASK_SL | SND_CHN_T_MASK_LF \
+ }, \
+ /* Side Right */ \
+ [6] = { \
+ .type = SND_CHN_T_SR, \
+ .members = \
+ SND_CHN_T_MASK_SR | SND_CHN_T_MASK_LF \
+ }, \
+ [7] = { \
+ .type = SND_CHN_T_MAX, \
+ .members = 0 \
+ } \
+ }, \
+ .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \
+ SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR | \
+ SND_CHN_T_MASK_FC | \
+ SND_CHN_T_MASK_SL | SND_CHN_T_MASK_SR, \
+ .offset = { 0, 1, 4, -1, 2, 3, -1, -1, -1, \
+ 5, 6, -1, -1, -1, -1, -1, -1, -1 } \
+}
+
#define SND_CHN_MATRIX_MAP_7_1 { \
.id = SND_CHN_MATRIX_7_1, \
.channels = 8, \
diff --git a/sys/dev/uart/uart_bus_isa.c b/sys/dev/uart/uart_bus_isa.c
index 0f33ea9..1836663 100644
--- a/sys/dev/uart/uart_bus_isa.c
+++ b/sys/dev/uart/uart_bus_isa.c
@@ -79,6 +79,7 @@ static struct isa_pnp_id isa_ns8250_ids[] = {
{0x0034490a, NULL}, /* BRI3400 - Internal ACF Modem */
{0x0094490a, NULL}, /* BRI9400 - Boca K56Flex PnP */
{0x00b4490a, NULL}, /* BRIB400 - Boca 56k PnP */
+ {0x0010320d, NULL}, /* CIR1000 - Cirrus Logic V34 */
{0x0030320d, NULL}, /* CIR3000 - Cirrus Logic V43 */
{0x0100440e, NULL}, /* CRD0001 - Cardinal MVP288IV ? */
{0x01308c0e, NULL}, /* CTL3001 - Creative Labs Phoneblaster */
diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c
index 71caa29..2ce1ca6 100644
--- a/sys/fs/devfs/devfs_devs.c
+++ b/sys/fs/devfs/devfs_devs.c
@@ -121,7 +121,7 @@ devfs_alloc(int flags)
struct cdev *cdev;
struct timespec ts;
- cdp = malloc(sizeof *cdp, M_CDEVP, M_USE_RESERVE | M_ZERO |
+ cdp = malloc(sizeof *cdp, M_CDEVP, M_ZERO |
((flags & MAKEDEV_NOWAIT) ? M_NOWAIT : M_WAITOK));
if (cdp == NULL)
return (NULL);
diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c
index c8c5bf5..0257a4c 100644
--- a/sys/fs/nfsclient/nfs_clport.c
+++ b/sys/fs/nfsclient/nfs_clport.c
@@ -1150,31 +1150,6 @@ nfscl_maperr(struct thread *td, int error, uid_t uid, gid_t gid)
}
/*
- * Locate a process by number; return only "live" processes -- i.e., neither
- * zombies nor newly born but incompletely initialized processes. By not
- * returning processes in the PRS_NEW state, we allow callers to avoid
- * testing for that condition to avoid dereferencing p_ucred, et al.
- * Identical to pfind() in kern_proc.c, except it assume the list is
- * already locked.
- */
-static struct proc *
-pfind_locked(pid_t pid)
-{
- struct proc *p;
-
- LIST_FOREACH(p, PIDHASH(pid), p_hash)
- if (p->p_pid == pid) {
- PROC_LOCK(p);
- if (p->p_state == PRS_NEW) {
- PROC_UNLOCK(p);
- p = NULL;
- }
- break;
- }
- return (p);
-}
-
-/*
* Check to see if the process for this owner exists. Return 1 if it doesn't
* and 0 otherwise.
*/
diff --git a/sys/fs/smbfs/smbfs_node.c b/sys/fs/smbfs/smbfs_node.c
index 8be6edd..66696ca 100644
--- a/sys/fs/smbfs/smbfs_node.c
+++ b/sys/fs/smbfs/smbfs_node.c
@@ -70,18 +70,8 @@ smbfs_name_alloc(const u_char *name, int nmlen)
u_char *cp;
nmlen++;
-#ifdef SMBFS_NAME_DEBUG
- cp = malloc(nmlen + 2 + sizeof(int), M_SMBNODENAME, M_WAITOK);
- *(int*)cp = nmlen;
- cp += sizeof(int);
- cp[0] = 0xfc;
- cp++;
- bcopy(name, cp, nmlen - 1);
- cp[nmlen] = 0xfe;
-#else
cp = malloc(nmlen, M_SMBNODENAME, M_WAITOK);
bcopy(name, cp, nmlen - 1);
-#endif
cp[nmlen - 1] = 0;
return cp;
}
@@ -89,26 +79,8 @@ smbfs_name_alloc(const u_char *name, int nmlen)
static void
smbfs_name_free(u_char *name)
{
-#ifdef SMBFS_NAME_DEBUG
- int nmlen, slen;
- u_char *cp;
- cp = name;
- cp--;
- if (*cp != 0xfc)
- panic("First byte of name entry '%s' corrupted", name);
- cp -= sizeof(int);
- nmlen = *(int*)cp;
- slen = strlen(name) + 1;
- if (nmlen != slen)
- panic("Name length mismatch: was %d, now %d name '%s'",
- nmlen, slen, name);
- if (name[nmlen] != 0xfe)
- panic("Last byte of name entry '%s' corrupted\n", name);
- free(cp, M_SMBNODENAME);
-#else
free(name, M_SMBNODENAME);
-#endif
}
static int __inline
diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c
index cc1e4d0..9b00910 100644
--- a/sys/fs/smbfs/smbfs_vnops.c
+++ b/sys/fs/smbfs/smbfs_vnops.c
@@ -1135,18 +1135,6 @@ smbfs_lookup(ap)
SMBFSERR("invalid '..'\n");
return EIO;
}
-#ifdef SMB_VNODE_DEBUG
- {
- char *cp, c;
-
- cp = name + nmlen;
- c = *cp;
- *cp = 0;
- SMBVDEBUG("%d '%s' in '%s' id=d\n", nameiop, name,
- VTOSMB(dvp)->n_name);
- *cp = c;
- }
-#endif
islastcn = flags & ISLASTCN;
if (islastcn && (mp->mnt_flag & MNT_RDONLY) && (nameiop != LOOKUP))
return EROFS;
@@ -1278,9 +1266,30 @@ smbfs_lookup(ap)
goto out;
}
if (flags & ISDOTDOT) {
+ mp = dvp->v_mount;
+ error = vfs_busy(mp, MBF_NOWAIT);
+ if (error != 0) {
+ vfs_ref(mp);
+ VOP_UNLOCK(dvp, 0);
+ error = vfs_busy(mp, 0);
+ vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
+ vfs_rel(mp);
+ if (error)
+ return (ENOENT);
+ if ((dvp->v_iflag & VI_DOOMED) != 0) {
+ vfs_unbusy(mp);
+ return (ENOENT);
+ }
+ }
VOP_UNLOCK(dvp, 0);
error = smbfs_nget(mp, dvp, name, nmlen, NULL, &vp);
+ vfs_unbusy(mp);
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
+ if ((dvp->v_iflag & VI_DOOMED) != 0) {
+ if (error == 0)
+ vput(vp);
+ error = ENOENT;
+ }
if (error)
goto out;
*vpp = vp;
diff --git a/sys/ia64/ia64/uma_machdep.c b/sys/ia64/ia64/uma_machdep.c
index 37353ff..77791ae 100644
--- a/sys/ia64/ia64/uma_machdep.c
+++ b/sys/ia64/ia64/uma_machdep.c
@@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/lock.h>
+#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/systm.h>
#include <vm/vm.h>
@@ -46,12 +47,7 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
int pflags;
*flags = UMA_SLAB_PRIV;
- if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT)
- pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED;
- else
- pflags = VM_ALLOC_SYSTEM | VM_ALLOC_WIRED;
- if (wait & M_ZERO)
- pflags |= VM_ALLOC_ZERO;
+ pflags = malloc2vm_flags(wait) | VM_ALLOC_WIRED;
for (;;) {
m = vm_page_alloc(NULL, 0, pflags | VM_ALLOC_NOOBJ);
diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c
index 6fcbda7..68c24e0 100644
--- a/sys/kern/init_sysent.c
+++ b/sys/kern/init_sysent.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 239347 2012-08-17 02:26:31Z davidxu
+ * created from FreeBSD: head/sys/kern/syscalls.master 242958 2012-11-13 12:52:31Z kib
*/
#include "opt_compat.h"
@@ -41,7 +41,7 @@ struct sysent sysent[] = {
{ AS(write_args), (sy_call_t *)sys_write, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 4 = write */
{ AS(open_args), (sy_call_t *)sys_open, AUE_OPEN_RWTC, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 5 = open */
{ AS(close_args), (sy_call_t *)sys_close, AUE_CLOSE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 6 = close */
- { AS(wait_args), (sy_call_t *)sys_wait4, AUE_WAIT4, NULL, 0, 0, 0, SY_THR_STATIC }, /* 7 = wait4 */
+ { AS(wait4_args), (sy_call_t *)sys_wait4, AUE_WAIT4, NULL, 0, 0, 0, SY_THR_STATIC }, /* 7 = wait4 */
{ compat(AS(ocreat_args),creat), AUE_CREAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 8 = old creat */
{ AS(link_args), (sy_call_t *)sys_link, AUE_LINK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 9 = link */
{ AS(unlink_args), (sy_call_t *)sys_unlink, AUE_UNLINK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 10 = unlink */
@@ -566,4 +566,5 @@ struct sysent sysent[] = {
{ AS(rctl_remove_rule_args), (sy_call_t *)sys_rctl_remove_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 529 = rctl_remove_rule */
{ AS(posix_fallocate_args), (sy_call_t *)sys_posix_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 530 = posix_fallocate */
{ AS(posix_fadvise_args), (sy_call_t *)sys_posix_fadvise, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 531 = posix_fadvise */
+ { AS(wait6_args), (sy_call_t *)sys_wait6, AUE_WAIT6, NULL, 0, 0, 0, SY_THR_STATIC }, /* 532 = wait6 */
};
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index c04b992..3dd6521 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -143,7 +143,7 @@ exit1(struct thread *td, int rv)
* XXX in case we're rebooting we just let init die in order to
* work around an unsolved stack overflow seen very late during
* shutdown on sparc64 when the gmirror worker process exists.
- */
+ */
if (p == initproc && rebooting == 0) {
printf("init died (signal %d, exit %d)\n",
WTERMSIG(rv), WEXITSTATUS(rv));
@@ -617,7 +617,7 @@ sys_abort2(struct thread *td, struct abort2_args *uap)
sbuf_clear(sb);
sbuf_printf(sb, "%s(pid %d uid %d) aborted: ",
p->p_comm, p->p_pid, td->td_ucred->cr_uid);
- /*
+ /*
* Since we can't return from abort2(), send SIGKILL in cases, where
* abort2() was called improperly
*/
@@ -689,7 +689,7 @@ owait(struct thread *td, struct owait_args *uap __unused)
* The dirty work is handled by kern_wait().
*/
int
-sys_wait4(struct thread *td, struct wait_args *uap)
+sys_wait4(struct thread *td, struct wait4_args *uap)
{
struct rusage ru, *rup;
int error, status;
@@ -706,14 +706,51 @@ sys_wait4(struct thread *td, struct wait_args *uap)
return (error);
}
+int
+sys_wait6(struct thread *td, struct wait6_args *uap)
+{
+ struct __wrusage wru, *wrup;
+ siginfo_t si, *sip;
+ idtype_t idtype;
+ id_t id;
+ int error, status;
+
+ idtype = uap->idtype;
+ id = uap->id;
+
+ if (uap->wrusage != NULL)
+ wrup = &wru;
+ else
+ wrup = NULL;
+
+ if (uap->info != NULL) {
+ sip = &si;
+ bzero(sip, sizeof(*sip));
+ } else
+ sip = NULL;
+
+ /*
+ * We expect all callers of wait6() to know about WEXITED and
+ * WTRAPPED.
+ */
+ error = kern_wait6(td, idtype, id, &status, uap->options, wrup, sip);
+
+ if (uap->status != NULL && error == 0)
+ error = copyout(&status, uap->status, sizeof(status));
+ if (uap->wrusage != NULL && error == 0)
+ error = copyout(&wru, uap->wrusage, sizeof(wru));
+ if (uap->info != NULL && error == 0)
+ error = copyout(&si, uap->info, sizeof(si));
+ return (error);
+}
+
/*
* Reap the remains of a zombie process and optionally return status and
* rusage. Asserts and will release both the proctree_lock and the process
* lock as part of its work.
*/
void
-proc_reap(struct thread *td, struct proc *p, int *status, int options,
- struct rusage *rusage)
+proc_reap(struct thread *td, struct proc *p, int *status, int options)
{
struct proc *q, *t;
@@ -723,10 +760,7 @@ proc_reap(struct thread *td, struct proc *p, int *status, int options,
KASSERT(p->p_state == PRS_ZOMBIE, ("proc_reap: !PRS_ZOMBIE"));
q = td->td_proc;
- if (rusage) {
- *rusage = p->p_ru;
- calcru(p, &rusage->ru_utime, &rusage->ru_stime);
- }
+
PROC_SUNLOCK(p);
td->td_retval[0] = p->p_pid;
if (status)
@@ -839,24 +873,77 @@ proc_reap(struct thread *td, struct proc *p, int *status, int options,
}
static int
-proc_to_reap(struct thread *td, struct proc *p, pid_t pid, int *status,
- int options, struct rusage *rusage)
+proc_to_reap(struct thread *td, struct proc *p, idtype_t idtype, id_t id,
+ int *status, int options, struct __wrusage *wrusage, siginfo_t *siginfo)
{
struct proc *q;
+ struct rusage *rup;
sx_assert(&proctree_lock, SA_XLOCKED);
q = td->td_proc;
PROC_LOCK(p);
- if (pid != WAIT_ANY && p->p_pid != pid && p->p_pgid != -pid) {
+
+ switch (idtype) {
+ case P_ALL:
+ break;
+ case P_PID:
+ if (p->p_pid != (pid_t)id) {
+ PROC_UNLOCK(p);
+ return (0);
+ }
+ break;
+ case P_PGID:
+ if (p->p_pgid != (pid_t)id) {
+ PROC_UNLOCK(p);
+ return (0);
+ }
+ break;
+ case P_SID:
+ if (p->p_session->s_sid != (pid_t)id) {
+ PROC_UNLOCK(p);
+ return (0);
+ }
+ break;
+ case P_UID:
+ if (p->p_ucred->cr_uid != (uid_t)id) {
+ PROC_UNLOCK(p);
+ return (0);
+ }
+ break;
+ case P_GID:
+ if (p->p_ucred->cr_gid != (gid_t)id) {
+ PROC_UNLOCK(p);
+ return (0);
+ }
+ break;
+ case P_JAILID:
+ if (p->p_ucred->cr_prison == NULL ||
+ (p->p_ucred->cr_prison->pr_id != (int)id)) {
+ PROC_UNLOCK(p);
+ return (0);
+ }
+ break;
+ /*
+ * It seems that the thread structures get zeroed out
+ * at process exit. This makes it impossible to
+ * support P_SETID, P_CID or P_CPUID.
+ */
+ default:
PROC_UNLOCK(p);
return (0);
}
+
if (p_canwait(td, p)) {
PROC_UNLOCK(p);
return (0);
}
+ if (((options & WEXITED) == 0) && (p->p_state == PRS_ZOMBIE)) {
+ PROC_UNLOCK(p);
+ return (0);
+ }
+
/*
* This special case handles a kthread spawned by linux_clone
* (see linux_misc.c). The linux_wait4 and linux_waitpid
@@ -872,8 +959,59 @@ proc_to_reap(struct thread *td, struct proc *p, pid_t pid, int *status,
}
PROC_SLOCK(p);
+
+ if (siginfo != NULL) {
+ bzero(siginfo, sizeof(*siginfo));
+ siginfo->si_errno = 0;
+
+ /*
+ * SUSv4 requires that the si_signo value is always
+ * SIGCHLD. Obey it despite the rfork(2) interface
+ * allows to request other signal for child exit
+ * notification.
+ */
+ siginfo->si_signo = SIGCHLD;
+
+ /*
+ * This is still a rough estimate. We will fix the
+ * cases TRAPPED, STOPPED, and CONTINUED later.
+ */
+ if (WCOREDUMP(p->p_xstat))
+ siginfo->si_code = CLD_DUMPED;
+ else if (WIFSIGNALED(p->p_xstat))
+ siginfo->si_code = CLD_KILLED;
+ else
+ siginfo->si_code = CLD_EXITED;
+
+ siginfo->si_pid = p->p_pid;
+ siginfo->si_uid = p->p_ucred->cr_uid;
+ siginfo->si_status = p->p_xstat;
+
+ /*
+ * The si_addr field would be useful additional
+ * detail, but apparently the PC value may be lost
+ * when we reach this point. bzero() above sets
+ * siginfo->si_addr to NULL.
+ */
+ }
+
+ /*
+ * There should be no reason to limit resources usage info to
+ * exited processes only. A snapshot about any resources used
+ * by a stopped process may be exactly what is needed.
+ */
+ if (wrusage != NULL) {
+ rup = &wrusage->wru_self;
+ *rup = p->p_ru;
+ calcru(p, &rup->ru_utime, &rup->ru_stime);
+
+ rup = &wrusage->wru_children;
+ *rup = p->p_stats->p_cru;
+ calccru(p, &rup->ru_utime, &rup->ru_stime);
+ }
+
if (p->p_state == PRS_ZOMBIE) {
- proc_reap(td, p, status, options, rusage);
+ proc_reap(td, p, status, options);
return (-1);
}
PROC_SUNLOCK(p);
@@ -885,21 +1023,75 @@ int
kern_wait(struct thread *td, pid_t pid, int *status, int options,
struct rusage *rusage)
{
+ struct __wrusage wru, *wrup;
+ struct proc *q;
+ idtype_t idtype;
+ id_t id;
+ int ret;
+
+ if (pid == WAIT_ANY) {
+ idtype = P_ALL;
+ id = 0;
+ } else if (pid == WAIT_MYPGRP) {
+ idtype = P_PGID;
+ q = td->td_proc;
+ PROC_LOCK(q);
+ id = (id_t)q->p_pgid;
+ PROC_UNLOCK(q);
+ } else if (pid < 0) {
+ idtype = P_PGID;
+ id = (id_t)-pid;
+ } else {
+ idtype = P_PID;
+ id = (id_t)pid;
+ }
+ if (rusage != NULL)
+ wrup = &wru;
+ else
+ wrup = NULL;
+ /*
+ * For backward compatibility we implicitly add flags WEXITED
+ * and WTRAPPED here.
+ */
+ options |= WEXITED | WTRAPPED;
+ ret = kern_wait6(td, idtype, id, status, options, wrup, NULL);
+ if (rusage != NULL)
+ *rusage = wru.wru_self;
+ return (ret);
+}
+
+int
+kern_wait6(struct thread *td, idtype_t idtype, id_t id, int *status,
+ int options, struct __wrusage *wrusage, siginfo_t *siginfo)
+{
struct proc *p, *q;
int error, nfound, ret;
- AUDIT_ARG_PID(pid);
+ AUDIT_ARG_VALUE((int)idtype); /* XXX - This is likely wrong! */
+ AUDIT_ARG_PID((pid_t)id); /* XXX - This may be wrong! */
AUDIT_ARG_VALUE(options);
q = td->td_proc;
- if (pid == 0) {
- PROC_LOCK(q);
- pid = -q->p_pgid;
- PROC_UNLOCK(q);
+
+ if ((pid_t)id == WAIT_MYPGRP && (idtype == P_PID || idtype == P_PGID)) {
+ id = (id_t)q->p_pgid;
+ idtype = P_PGID;
}
+
/* If we don't know the option, just return. */
- if (options & ~(WUNTRACED|WNOHANG|WCONTINUED|WNOWAIT|WLINUXCLONE))
+ if ((options & ~(WUNTRACED | WNOHANG | WCONTINUED | WNOWAIT |
+ WEXITED | WTRAPPED | WLINUXCLONE)) != 0)
return (EINVAL);
+ if ((options & (WEXITED | WUNTRACED | WCONTINUED | WTRAPPED)) == 0) {
+ /*
+ * We will be unable to find any matching processes,
+ * because there are no known events to look for.
+ * Prefer to return error instead of blocking
+ * indefinitely.
+ */
+ return (EINVAL);
+ }
+
loop:
if (q->p_flag & P_STATCHILD) {
PROC_LOCK(q);
@@ -909,7 +1101,8 @@ loop:
nfound = 0;
sx_xlock(&proctree_lock);
LIST_FOREACH(p, &q->p_children, p_sibling) {
- ret = proc_to_reap(td, p, pid, status, options, rusage);
+ ret = proc_to_reap(td, p, idtype, id, status, options,
+ wrusage, siginfo);
if (ret == 0)
continue;
else if (ret == 1)
@@ -919,37 +1112,77 @@ loop:
PROC_LOCK(p);
PROC_SLOCK(p);
- if ((p->p_flag & P_STOPPED_SIG) &&
+
+ if ((options & WTRAPPED) != 0 &&
+ (p->p_flag & P_TRACED) != 0 &&
+ (p->p_flag & (P_STOPPED_TRACE | P_STOPPED_SIG)) != 0 &&
(p->p_suspcount == p->p_numthreads) &&
- (p->p_flag & P_WAITED) == 0 &&
- (p->p_flag & P_TRACED || options & WUNTRACED)) {
+ ((p->p_flag & P_WAITED) == 0)) {
PROC_SUNLOCK(p);
- p->p_flag |= P_WAITED;
+ if ((options & WNOWAIT) == 0)
+ p->p_flag |= P_WAITED;
sx_xunlock(&proctree_lock);
td->td_retval[0] = p->p_pid;
- if (status)
+
+ if (status != NULL)
*status = W_STOPCODE(p->p_xstat);
+ if (siginfo != NULL) {
+ siginfo->si_status = p->p_xstat;
+ siginfo->si_code = CLD_TRAPPED;
+ }
+ if ((options & WNOWAIT) == 0) {
+ PROC_LOCK(q);
+ sigqueue_take(p->p_ksi);
+ PROC_UNLOCK(q);
+ }
- PROC_LOCK(q);
- sigqueue_take(p->p_ksi);
- PROC_UNLOCK(q);
PROC_UNLOCK(p);
+ return (0);
+ }
+ if ((options & WUNTRACED) != 0 &&
+ (p->p_flag & P_STOPPED_SIG) != 0 &&
+ (p->p_suspcount == p->p_numthreads) &&
+ ((p->p_flag & P_WAITED) == 0)) {
+ PROC_SUNLOCK(p);
+ if ((options & WNOWAIT) == 0)
+ p->p_flag |= P_WAITED;
+ sx_xunlock(&proctree_lock);
+ td->td_retval[0] = p->p_pid;
+
+ if (status != NULL)
+ *status = W_STOPCODE(p->p_xstat);
+ if (siginfo != NULL) {
+ siginfo->si_status = p->p_xstat;
+ siginfo->si_code = CLD_STOPPED;
+ }
+ if ((options & WNOWAIT) == 0) {
+ PROC_LOCK(q);
+ sigqueue_take(p->p_ksi);
+ PROC_UNLOCK(q);
+ }
+ PROC_UNLOCK(p);
return (0);
}
PROC_SUNLOCK(p);
- if (options & WCONTINUED && (p->p_flag & P_CONTINUED)) {
+ if ((options & WCONTINUED) != 0 &&
+ (p->p_flag & P_CONTINUED) != 0) {
sx_xunlock(&proctree_lock);
td->td_retval[0] = p->p_pid;
- p->p_flag &= ~P_CONTINUED;
-
- PROC_LOCK(q);
- sigqueue_take(p->p_ksi);
- PROC_UNLOCK(q);
+ if ((options & WNOWAIT) == 0) {
+ p->p_flag &= ~P_CONTINUED;
+ PROC_LOCK(q);
+ sigqueue_take(p->p_ksi);
+ PROC_UNLOCK(q);
+ }
PROC_UNLOCK(p);
- if (status)
+ if (status != NULL)
*status = SIGCONT;
+ if (siginfo != NULL) {
+ siginfo->si_status = SIGCONT;
+ siginfo->si_code = CLD_CONTINUED;
+ }
return (0);
}
PROC_UNLOCK(p);
@@ -968,7 +1201,8 @@ loop:
* to successfully wait until the child becomes a zombie.
*/
LIST_FOREACH(p, &q->p_orphans, p_orphan) {
- ret = proc_to_reap(td, p, pid, status, options, rusage);
+ ret = proc_to_reap(td, p, idtype, id, status, options,
+ wrusage, siginfo);
if (ret == 0)
continue;
else if (ret == 1)
@@ -994,7 +1228,7 @@ loop:
error = msleep(q, &q->p_mtx, PWAIT | PCATCH, "wait", 0);
PROC_UNLOCK(q);
if (error)
- return (error);
+ return (error);
goto loop;
}
diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c
index 738b05a..6498498 100644
--- a/sys/kern/kern_ktr.c
+++ b/sys/kern/kern_ktr.c
@@ -47,7 +47,11 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/libkern.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <sys/proc.h>
+#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/time.h>
@@ -66,6 +70,9 @@ __FBSDID("$FreeBSD$");
#define KTR_ENTRIES 1024
#endif
+/* Limit the allocations to something manageable. */
+#define KTR_ENTRIES_MAX (8 * 1024 * 1024)
+
#ifndef KTR_MASK
#define KTR_MASK (0)
#endif
@@ -82,30 +89,31 @@ __FBSDID("$FreeBSD$");
#define KTR_CPU PCPU_GET(cpuid)
#endif
-FEATURE(ktr, "Kernel support for KTR kernel tracing facility");
+static MALLOC_DEFINE(M_KTR, "KTR", "KTR");
-static SYSCTL_NODE(_debug, OID_AUTO, ktr, CTLFLAG_RD, 0, "KTR options");
+FEATURE(ktr, "Kernel support for KTR kernel tracing facility");
+volatile int ktr_idx = 0;
int ktr_mask = KTR_MASK;
+int ktr_compile = KTR_COMPILE;
+int ktr_entries = KTR_ENTRIES;
+int ktr_version = KTR_VERSION;
+struct ktr_entry ktr_buf_init[KTR_ENTRIES];
+struct ktr_entry *ktr_buf = ktr_buf_init;
+cpuset_t ktr_cpumask = CPUSET_T_INITIALIZER(KTR_CPUMASK);
+static char ktr_cpumask_str[CPUSETBUFSIZ];
+
TUNABLE_INT("debug.ktr.mask", &ktr_mask);
-SYSCTL_INT(_debug_ktr, OID_AUTO, mask, CTLFLAG_RW,
- &ktr_mask, 0, "Bitmask of KTR event classes for which logging is enabled");
-int ktr_compile = KTR_COMPILE;
-SYSCTL_INT(_debug_ktr, OID_AUTO, compile, CTLFLAG_RD,
- &ktr_compile, 0, "Bitmask of KTR event classes compiled into the kernel");
+TUNABLE_STR("debug.ktr.cpumask", ktr_cpumask_str, sizeof(ktr_cpumask_str));
-int ktr_entries = KTR_ENTRIES;
-SYSCTL_INT(_debug_ktr, OID_AUTO, entries, CTLFLAG_RD,
- &ktr_entries, 0, "Number of entries in the KTR buffer");
+static SYSCTL_NODE(_debug, OID_AUTO, ktr, CTLFLAG_RD, 0, "KTR options");
-int ktr_version = KTR_VERSION;
SYSCTL_INT(_debug_ktr, OID_AUTO, version, CTLFLAG_RD,
&ktr_version, 0, "Version of the KTR interface");
-cpuset_t ktr_cpumask = CPUSET_T_INITIALIZER(KTR_CPUMASK);
-static char ktr_cpumask_str[CPUSETBUFSIZ];
-TUNABLE_STR("debug.ktr.cpumask", ktr_cpumask_str, sizeof(ktr_cpumask_str));
+SYSCTL_INT(_debug_ktr, OID_AUTO, compile, CTLFLAG_RD,
+ &ktr_compile, 0, "Bitmask of KTR event classes compiled into the kernel");
static void
ktr_cpumask_initializer(void *dummy __unused)
@@ -145,9 +153,6 @@ SYSCTL_PROC(_debug_ktr, OID_AUTO, cpumask,
sysctl_debug_ktr_cpumask, "S",
"Bitmask of CPUs on which KTR logging is enabled");
-volatile int ktr_idx = 0;
-struct ktr_entry ktr_buf[KTR_ENTRIES];
-
static int
sysctl_debug_ktr_clear(SYSCTL_HANDLER_ARGS)
{
@@ -159,7 +164,7 @@ sysctl_debug_ktr_clear(SYSCTL_HANDLER_ARGS)
return (error);
if (clear) {
- bzero(ktr_buf, sizeof(ktr_buf));
+ bzero(ktr_buf, sizeof(*ktr_buf) * ktr_entries);
ktr_idx = 0;
}
@@ -168,6 +173,67 @@ sysctl_debug_ktr_clear(SYSCTL_HANDLER_ARGS)
SYSCTL_PROC(_debug_ktr, OID_AUTO, clear, CTLTYPE_INT|CTLFLAG_RW, 0, 0,
sysctl_debug_ktr_clear, "I", "Clear KTR Buffer");
+/*
+ * This is a sysctl proc so that it is serialized as !MPSAFE along with
+ * the other ktr sysctl procs.
+ */
+static int
+sysctl_debug_ktr_mask(SYSCTL_HANDLER_ARGS)
+{
+ int mask, error;
+
+ mask = ktr_mask;
+ error = sysctl_handle_int(oidp, &mask, 0, req);
+ if (error || !req->newptr)
+ return (error);
+ ktr_mask = mask;
+ return (error);
+}
+
+SYSCTL_PROC(_debug_ktr, OID_AUTO, mask, CTLTYPE_INT|CTLFLAG_RW, 0, 0,
+ sysctl_debug_ktr_mask, "I",
+ "Bitmask of KTR event classes for which logging is enabled");
+
+static int
+sysctl_debug_ktr_entries(SYSCTL_HANDLER_ARGS)
+{
+ int entries, error, mask;
+ struct ktr_entry *buf, *oldbuf;
+
+ entries = ktr_entries;
+ error = sysctl_handle_int(oidp, &entries, 0, req);
+ if (error || !req->newptr)
+ return (error);
+ if (entries > KTR_ENTRIES_MAX)
+ return (ERANGE);
+ /* Disable ktr temporarily. */
+ mask = ktr_mask;
+ atomic_store_rel_int(&ktr_mask, 0);
+ /* Wait for threads to go idle. */
+ if ((error = quiesce_all_cpus("ktrent", PCATCH)) != 0) {
+ ktr_mask = mask;
+ return (error);
+ }
+ if (ktr_buf != ktr_buf_init)
+ oldbuf = ktr_buf;
+ else
+ oldbuf = NULL;
+ /* Allocate a new buffer. */
+ buf = malloc(sizeof(*buf) * entries, M_KTR, M_WAITOK | M_ZERO);
+ /* Install the new buffer and restart ktr. */
+ ktr_buf = buf;
+ ktr_entries = entries;
+ ktr_idx = 0;
+ atomic_store_rel_int(&ktr_mask, mask);
+ if (oldbuf != NULL)
+ free(oldbuf, M_KTR);
+
+ return (error);
+}
+
+SYSCTL_PROC(_debug_ktr, OID_AUTO, entries, CTLTYPE_INT|CTLFLAG_RW, 0, 0,
+ sysctl_debug_ktr_entries, "I", "Number of entries in the KTR buffer");
+
#ifdef KTR_VERBOSE
int ktr_verbose = KTR_VERBOSE;
TUNABLE_INT("debug.ktr.verbose", &ktr_verbose);
@@ -249,7 +315,7 @@ ktr_tracepoint(u_int mask, const char *file, int line, const char *format,
if (panicstr)
return;
- if ((ktr_mask & mask) == 0)
+ if ((ktr_mask & mask) == 0 || ktr_buf == NULL)
return;
cpu = KTR_CPU;
if (!CPU_ISSET(cpu, &ktr_cpumask))
@@ -281,7 +347,7 @@ ktr_tracepoint(u_int mask, const char *file, int line, const char *format,
{
do {
saveindex = ktr_idx;
- newindex = (saveindex + 1) % KTR_ENTRIES;
+ newindex = (saveindex + 1) % ktr_entries;
} while (atomic_cmpset_rel_int(&ktr_idx, saveindex, newindex) == 0);
entry = &ktr_buf[saveindex];
}
@@ -336,7 +402,7 @@ static int db_mach_vtrace(void);
DB_SHOW_COMMAND(ktr, db_ktr_all)
{
- tstate.cur = (ktr_idx - 1) % KTR_ENTRIES;
+ tstate.cur = (ktr_idx - 1) % ktr_entries;
tstate.first = -1;
db_ktr_verbose = 0;
db_ktr_verbose |= (strchr(modif, 'v') != NULL) ? 2 : 0;
@@ -358,7 +424,7 @@ db_mach_vtrace(void)
{
struct ktr_entry *kp;
- if (tstate.cur == tstate.first) {
+ if (tstate.cur == tstate.first || ktr_buf == NULL) {
db_printf("--- End of trace buffer ---\n");
return (0);
}
@@ -390,7 +456,7 @@ db_mach_vtrace(void)
tstate.first = tstate.cur;
if (--tstate.cur < 0)
- tstate.cur = KTR_ENTRIES - 1;
+ tstate.cur = ktr_entries - 1;
return (1);
}
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 8ee043e..0ab5568 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -137,6 +137,7 @@ static void proc_dtor(void *mem, int size, void *arg);
static int proc_init(void *mem, int size, int flags);
static void proc_fini(void *mem, int size);
static void pargs_free(struct pargs *pa);
+static struct proc *zpfind_locked(pid_t pid);
/*
* Other process lists
@@ -284,20 +285,13 @@ inferior(p)
return (1);
}
-/*
- * Locate a process by number; return only "live" processes -- i.e., neither
- * zombies nor newly born but incompletely initialized processes. By not
- * returning processes in the PRS_NEW state, we allow callers to avoid
- * testing for that condition to avoid dereferencing p_ucred, et al.
- */
struct proc *
-pfind(pid)
- register pid_t pid;
+pfind_locked(pid_t pid)
{
- register struct proc *p;
+ struct proc *p;
- sx_slock(&allproc_lock);
- LIST_FOREACH(p, PIDHASH(pid), p_hash)
+ sx_assert(&allproc_lock, SX_LOCKED);
+ LIST_FOREACH(p, PIDHASH(pid), p_hash) {
if (p->p_pid == pid) {
PROC_LOCK(p);
if (p->p_state == PRS_NEW) {
@@ -306,17 +300,34 @@ pfind(pid)
}
break;
}
+ }
+ return (p);
+}
+
+/*
+ * Locate a process by number; return only "live" processes -- i.e., neither
+ * zombies nor newly born but incompletely initialized processes. By not
+ * returning processes in the PRS_NEW state, we allow callers to avoid
+ * testing for that condition to avoid dereferencing p_ucred, et al.
+ */
+struct proc *
+pfind(pid_t pid)
+{
+ struct proc *p;
+
+ sx_slock(&allproc_lock);
+ p = pfind_locked(pid);
sx_sunlock(&allproc_lock);
return (p);
}
static struct proc *
-pfind_tid(pid_t tid)
+pfind_tid_locked(pid_t tid)
{
struct proc *p;
struct thread *td;
- sx_slock(&allproc_lock);
+ sx_assert(&allproc_lock, SX_LOCKED);
FOREACH_PROC_IN_SYSTEM(p) {
PROC_LOCK(p);
if (p->p_state == PRS_NEW) {
@@ -330,7 +341,6 @@ pfind_tid(pid_t tid)
PROC_UNLOCK(p);
}
found:
- sx_sunlock(&allproc_lock);
return (p);
}
@@ -364,12 +374,16 @@ pget(pid_t pid, int flags, struct proc **pp)
struct proc *p;
int error;
+ sx_slock(&allproc_lock);
if (pid <= PID_MAX)
- p = pfind(pid);
+ p = pfind_locked(pid);
else if ((flags & PGET_NOTID) == 0)
- p = pfind_tid(pid);
+ p = pfind_tid_locked(pid);
else
p = NULL;
+ if (p == NULL && (flags & PGET_NOTWEXIT) == 0)
+ p = zpfind_locked(pid);
+ sx_sunlock(&allproc_lock);
if (p == NULL)
return (ESRCH);
if ((flags & PGET_CANSEE) != 0) {
@@ -421,17 +435,13 @@ enterpgrp(p, pgid, pgrp, sess)
struct pgrp *pgrp;
struct session *sess;
{
- struct pgrp *pgrp2;
sx_assert(&proctree_lock, SX_XLOCKED);
KASSERT(pgrp != NULL, ("enterpgrp: pgrp == NULL"));
KASSERT(p->p_pid == pgid,
("enterpgrp: new pgrp and pid != pgid"));
-
- pgrp2 = pgfind(pgid);
-
- KASSERT(pgrp2 == NULL,
+ KASSERT(pgfind(pgid) == NULL,
("enterpgrp: pgrp with pgid exists"));
KASSERT(!SESS_LEADER(p),
("enterpgrp: session leader attempted setpgrp"));
@@ -1048,6 +1058,21 @@ pstats_free(struct pstats *ps)
free(ps, M_SUBPROC);
}
+static struct proc *
+zpfind_locked(pid_t pid)
+{
+ struct proc *p;
+
+ sx_assert(&allproc_lock, SX_LOCKED);
+ LIST_FOREACH(p, &zombproc, p_list) {
+ if (p->p_pid == pid) {
+ PROC_LOCK(p);
+ break;
+ }
+ }
+ return (p);
+}
+
/*
* Locate a zombie process by number
*/
@@ -1057,11 +1082,7 @@ zpfind(pid_t pid)
struct proc *p;
sx_slock(&allproc_lock);
- LIST_FOREACH(p, &zombproc, p_list)
- if (p->p_pid == pid) {
- PROC_LOCK(p);
- break;
- }
+ p = zpfind_locked(pid);
sx_sunlock(&allproc_lock);
return (p);
}
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 53af793..f99e053 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -2084,8 +2084,10 @@ sys_getlogin(struct thread *td, struct getlogin_args *uap)
bcopy(p->p_session->s_login, login, uap->namelen);
SESS_UNLOCK(p->p_session);
PROC_UNLOCK(p);
+ if (strlen(login) + 1 > uap->namelen)
+ return (ERANGE);
error = copyout(login, uap->namebuf, uap->namelen);
- return(error);
+ return (error);
}
/*
diff --git a/sys/kern/kern_racct.c b/sys/kern/kern_racct.c
index df1c457..bf8141c 100644
--- a/sys/kern/kern_racct.c
+++ b/sys/kern/kern_racct.c
@@ -385,9 +385,11 @@ racct_add_racct(struct racct *dest, const struct racct *src)
*/
for (i = 0; i <= RACCT_MAX; i++) {
KASSERT(dest->r_resources[i] >= 0,
- ("racct propagation meltdown: dest < 0"));
+ ("%s: resource %d propagation meltdown: dest < 0",
+ __func__, i));
KASSERT(src->r_resources[i] >= 0,
- ("racct propagation meltdown: src < 0"));
+ ("%s: resource %d propagation meltdown: src < 0",
+ __func__, i));
dest->r_resources[i] += src->r_resources[i];
}
}
@@ -403,19 +405,23 @@ racct_sub_racct(struct racct *dest, const struct racct *src)
* Update resource usage in dest.
*/
for (i = 0; i <= RACCT_MAX; i++) {
- if (!RACCT_IS_SLOPPY(i)) {
+ if (!RACCT_IS_SLOPPY(i) && !RACCT_IS_DECAYING(i)) {
KASSERT(dest->r_resources[i] >= 0,
- ("racct propagation meltdown: dest < 0"));
+ ("%s: resource %d propagation meltdown: dest < 0",
+ __func__, i));
KASSERT(src->r_resources[i] >= 0,
- ("racct propagation meltdown: src < 0"));
+ ("%s: resource %d propagation meltdown: src < 0",
+ __func__, i));
KASSERT(src->r_resources[i] <= dest->r_resources[i],
- ("racct propagation meltdown: src > dest"));
+ ("%s: resource %d propagation meltdown: src > dest",
+ __func__, i));
}
if (RACCT_CAN_DROP(i)) {
dest->r_resources[i] -= src->r_resources[i];
if (dest->r_resources[i] < 0) {
- KASSERT(RACCT_IS_SLOPPY(i),
- ("racct_sub_racct: usage < 0"));
+ KASSERT(RACCT_IS_SLOPPY(i) ||
+ RACCT_IS_DECAYING(i),
+ ("%s: resource %d usage < 0", __func__, i));
dest->r_resources[i] = 0;
}
}
@@ -486,7 +492,7 @@ racct_alloc_resource(struct racct *racct, int resource,
racct->r_resources[resource] += amount;
if (racct->r_resources[resource] < 0) {
KASSERT(RACCT_IS_SLOPPY(resource) || RACCT_IS_DECAYING(resource),
- ("racct_alloc_resource: usage < 0"));
+ ("%s: resource %d usage < 0", __func__, resource));
racct->r_resources[resource] = 0;
}
@@ -632,7 +638,7 @@ racct_set_locked(struct proc *p, int resource, uint64_t amount)
diff_cred = diff_proc;
#ifdef notyet
KASSERT(diff_proc >= 0 || RACCT_CAN_DROP(resource),
- ("racct_set: usage of non-droppable resource %d dropping",
+ ("%s: usage of non-droppable resource %d dropping", __func__,
resource));
#endif
#ifdef RCTL
@@ -781,12 +787,12 @@ racct_sub(struct proc *p, int resource, uint64_t amount)
*/
PROC_LOCK_ASSERT(p, MA_OWNED);
KASSERT(RACCT_CAN_DROP(resource),
- ("racct_sub: called for non-droppable resource %d", resource));
+ ("%s: called for non-droppable resource %d", __func__, resource));
mtx_lock(&racct_lock);
KASSERT(amount <= p->p_racct->r_resources[resource],
- ("racct_sub: freeing %ju of resource %d, which is more "
- "than allocated %jd for %s (pid %d)", amount, resource,
+ ("%s: freeing %ju of resource %d, which is more "
+ "than allocated %jd for %s (pid %d)", __func__, amount, resource,
(intmax_t)p->p_racct->r_resources[resource], p->p_comm, p->p_pid));
racct_alloc_resource(p->p_racct, resource, -amount);
@@ -804,7 +810,7 @@ racct_sub_cred_locked(struct ucred *cred, int resource, uint64_t amount)
#ifdef notyet
KASSERT(RACCT_CAN_DROP(resource),
- ("racct_sub_cred: called for resource %d which can not drop",
+ ("%s: called for resource %d which can not drop", __func__,
resource));
#endif
@@ -921,9 +927,12 @@ racct_proc_exit(struct proc *p)
#endif
microuptime(&wallclock);
timevalsub(&wallclock, &p->p_stats->p_start);
- pct_estimate = (1000000 * runtime * 100) /
- ((uint64_t)wallclock.tv_sec * 1000000 +
- wallclock.tv_usec);
+ if (wallclock.tv_sec > 0 || wallclock.tv_usec > 0) {
+ pct_estimate = (1000000 * runtime * 100) /
+ ((uint64_t)wallclock.tv_sec * 1000000 +
+ wallclock.tv_usec);
+ } else
+ pct_estimate = 0;
pct = racct_getpcpu(p, pct_estimate);
mtx_lock(&racct_lock);
@@ -1136,9 +1145,12 @@ racctd(void)
runtime = p->p_prev_runtime;
#endif
p->p_prev_runtime = runtime;
- pct_estimate = (1000000 * runtime * 100) /
- ((uint64_t)wallclock.tv_sec * 1000000 +
- wallclock.tv_usec);
+ if (wallclock.tv_sec > 0 || wallclock.tv_usec > 0) {
+ pct_estimate = (1000000 * runtime * 100) /
+ ((uint64_t)wallclock.tv_sec * 1000000 +
+ wallclock.tv_usec);
+ } else
+ pct_estimate = 0;
pct = racct_getpcpu(p, pct_estimate);
mtx_lock(&racct_lock);
racct_set_force_locked(p, RACCT_PCTCPU, pct);
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 7626de6..107a15d 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -2636,8 +2636,10 @@ sched_idletd(void *dummy)
if (tdq_idled(tdq) == 0)
continue;
}
-#endif
switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt;
+#else
+ oldswitchcnt = switchcnt;
+#endif
/*
* If we're switching very frequently, spin while checking
* for load rather than entering a low power state that
diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c
index b040c7b..6f3682a 100644
--- a/sys/kern/subr_lock.c
+++ b/sys/kern/subr_lock.c
@@ -240,34 +240,13 @@ lock_prof_init(void *arg)
}
SYSINIT(lockprof, SI_SUB_SMP, SI_ORDER_ANY, lock_prof_init, NULL);
-/*
- * To be certain that lock profiling has idled on all cpus before we
- * reset, we schedule the resetting thread on all active cpus. Since
- * all operations happen within critical sections we can be sure that
- * it is safe to zero the profiling structures.
- */
-static void
-lock_prof_idle(void)
-{
- struct thread *td;
- int cpu;
-
- td = curthread;
- thread_lock(td);
- CPU_FOREACH(cpu) {
- sched_bind(td, cpu);
- }
- sched_unbind(td);
- thread_unlock(td);
-}
-
static void
lock_prof_reset_wait(void)
{
/*
- * Spin relinquishing our cpu so that lock_prof_idle may
- * run on it.
+ * Spin relinquishing our cpu so that quiesce_all_cpus may
+ * complete.
*/
while (lock_prof_resetting)
sched_relinquish(curthread);
@@ -289,7 +268,7 @@ lock_prof_reset(void)
atomic_store_rel_int(&lock_prof_resetting, 1);
enabled = lock_prof_enable;
lock_prof_enable = 0;
- lock_prof_idle();
+ quiesce_all_cpus("profreset", 0);
/*
* Some objects may have migrated between CPUs. Clear all links
* before we zero the structures. Some items may still be linked
@@ -401,7 +380,7 @@ dump_lock_prof_stats(SYSCTL_HANDLER_ARGS)
"max", "wait_max", "total", "wait_total", "count", "avg", "wait_avg", "cnt_hold", "cnt_lock", "name");
enabled = lock_prof_enable;
lock_prof_enable = 0;
- lock_prof_idle();
+ quiesce_all_cpus("profstat", 0);
t = ticks;
for (cpu = 0; cpu <= mp_maxid; cpu++) {
if (lp_cpu[cpu] == NULL)
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 4c73b61..3b27dce 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/pcpu.h>
+#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
@@ -734,3 +735,52 @@ smp_no_rendevous_barrier(void *dummy)
KASSERT((!smp_started),("smp_no_rendevous called and smp is started"));
#endif
}
+
+/*
+ * Wait specified idle threads to switch once. This ensures that even
+ * preempted threads have cycled through the switch function once,
+ * exiting their codepaths. This allows us to change global pointers
+ * with no other synchronization.
+ */
+int
+quiesce_cpus(cpuset_t map, const char *wmesg, int prio)
+{
+ struct pcpu *pcpu;
+ u_int gen[MAXCPU];
+ int error;
+ int cpu;
+
+ error = 0;
+ for (cpu = 0; cpu <= mp_maxid; cpu++) {
+ if (!CPU_ISSET(cpu, &map) || CPU_ABSENT(cpu))
+ continue;
+ pcpu = pcpu_find(cpu);
+ gen[cpu] = pcpu->pc_idlethread->td_generation;
+ }
+ for (cpu = 0; cpu <= mp_maxid; cpu++) {
+ if (!CPU_ISSET(cpu, &map) || CPU_ABSENT(cpu))
+ continue;
+ pcpu = pcpu_find(cpu);
+ thread_lock(curthread);
+ sched_bind(curthread, cpu);
+ thread_unlock(curthread);
+ while (gen[cpu] == pcpu->pc_idlethread->td_generation) {
+ error = tsleep(quiesce_cpus, prio, wmesg, 1);
+ if (error)
+ goto out;
+ }
+ }
+out:
+ thread_lock(curthread);
+ sched_unbind(curthread);
+ thread_unlock(curthread);
+
+ return (error);
+}
+
+int
+quiesce_all_cpus(const char *wmesg, int prio)
+{
+
+ return quiesce_cpus(all_cpus, wmesg, prio);
+}
diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c
index ac625f7..f400041 100644
--- a/sys/kern/sys_procdesc.c
+++ b/sys/kern/sys_procdesc.c
@@ -374,7 +374,7 @@ procdesc_close(struct file *fp, struct thread *td)
*/
PROC_LOCK(p);
PROC_SLOCK(p);
- proc_reap(curthread, p, NULL, 0, NULL);
+ proc_reap(curthread, p, NULL, 0);
} else {
/*
* If the process is not yet dead, we need to kill it, but we
diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c
index 63f9a1c..96f2400 100644
--- a/sys/kern/syscalls.c
+++ b/sys/kern/syscalls.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 239347 2012-08-17 02:26:31Z davidxu
+ * created from FreeBSD: head/sys/kern/syscalls.master 242958 2012-11-13 12:52:31Z kib
*/
const char *syscallnames[] = {
@@ -539,4 +539,5 @@ const char *syscallnames[] = {
"rctl_remove_rule", /* 529 = rctl_remove_rule */
"posix_fallocate", /* 530 = posix_fallocate */
"posix_fadvise", /* 531 = posix_fadvise */
+ "wait6", /* 532 = wait6 */
};
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 5cb90f8..148dea3 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -71,8 +71,7 @@
; XXX man page says `mode_t mode'.
6 AUE_CLOSE STD { int close(int fd); }
7 AUE_WAIT4 STD { int wait4(int pid, int *status, \
- int options, struct rusage *rusage); } \
- wait4 wait_args int
+ int options, struct rusage *rusage); }
8 AUE_CREAT COMPAT { int creat(char *path, int mode); }
9 AUE_LINK STD { int link(char *path, char *link); }
10 AUE_UNLINK STD { int unlink(char *path); }
@@ -952,5 +951,9 @@
off_t offset, off_t len); }
531 AUE_NULL STD { int posix_fadvise(int fd, off_t offset, \
off_t len, int advice); }
+532 AUE_WAIT6 STD { int wait6(int idtype, int id, \
+ int *status, int options, \
+ struct __wrusage *wrusage, \
+ siginfo_t *info); }
; Please copy any additions and changes to the following compatability tables:
; sys/compat/freebsd32/syscalls.master
diff --git a/sys/kern/systrace_args.c b/sys/kern/systrace_args.c
index 4c57237..c755f92 100644
--- a/sys/kern/systrace_args.c
+++ b/sys/kern/systrace_args.c
@@ -64,7 +64,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
}
/* wait4 */
case 7: {
- struct wait_args *p = params;
+ struct wait4_args *p = params;
iarg[0] = p->pid; /* int */
uarg[1] = (intptr_t) p->status; /* int * */
iarg[2] = p->options; /* int */
@@ -3274,6 +3274,18 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
*n_args = 4;
break;
}
+ /* wait6 */
+ case 532: {
+ struct wait6_args *p = params;
+ iarg[0] = p->idtype; /* int */
+ iarg[1] = p->id; /* int */
+ uarg[2] = (intptr_t) p->status; /* int * */
+ iarg[3] = p->options; /* int */
+ uarg[4] = (intptr_t) p->wrusage; /* struct __wrusage * */
+ uarg[5] = (intptr_t) p->info; /* siginfo_t * */
+ *n_args = 6;
+ break;
+ }
default:
*n_args = 0;
break;
@@ -8708,6 +8720,31 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
};
break;
+ /* wait6 */
+ case 532:
+ switch(ndx) {
+ case 0:
+ p = "int";
+ break;
+ case 1:
+ p = "int";
+ break;
+ case 2:
+ p = "int *";
+ break;
+ case 3:
+ p = "int";
+ break;
+ case 4:
+ p = "struct __wrusage *";
+ break;
+ case 5:
+ p = "siginfo_t *";
+ break;
+ default:
+ break;
+ };
+ break;
default:
break;
};
@@ -10596,6 +10633,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
if (ndx == 0 || ndx == 1)
p = "int";
break;
+ /* wait6 */
+ case 532:
+ if (ndx == 0 || ndx == 1)
+ p = "int";
+ break;
default:
break;
};
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index cc5360f..99bca99 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -926,7 +926,8 @@ uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
SOCKBUF_LOCK(&so2->so_rcv);
if (unp2->unp_flags & UNP_WANTCRED) {
/*
- * Credentials are passed only once on SOCK_STREAM.
+ * Credentials are passed only once on SOCK_STREAM
+ * and SOCK_SEQPACKET.
*/
unp2->unp_flags &= ~UNP_WANTCRED;
control = unp_addsockcred(td, control);
diff --git a/sys/mips/cavium/files.octeon1 b/sys/mips/cavium/files.octeon1
index 103189c..adffb6a 100644
--- a/sys/mips/cavium/files.octeon1
+++ b/sys/mips/cavium/files.octeon1
@@ -45,6 +45,8 @@ mips/cavium/octe/octebus.c optional octe
mips/cavium/octopci.c optional pci
mips/cavium/octopci_bus_space.c optional pci
+mips/cavium/octeon_pci_console.c optional pci
+contrib/octeon-sdk/octeon-pci-console.c optional pci
mips/cavium/usb/octusb.c optional usb octusb
mips/cavium/usb/octusb_octeon.c optional usb octusb
diff --git a/sys/mips/cavium/octeon_pci_console.c b/sys/mips/cavium/octeon_pci_console.c
new file mode 100644
index 0000000..3558d52
--- /dev/null
+++ b/sys/mips/cavium/octeon_pci_console.c
@@ -0,0 +1,122 @@
+/*-
+ * Copyright (c) 2012 Juli Mallett <jmallett@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$
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/cons.h>
+#include <sys/kernel.h>
+#include <sys/reboot.h>
+
+#include <contrib/octeon-sdk/cvmx.h>
+#include <contrib/octeon-sdk/cvmx-bootmem.h>
+#include <contrib/octeon-sdk/octeon-pci-console.h>
+
+static cn_probe_t opcic_cnprobe;
+static cn_init_t opcic_cninit;
+static cn_term_t opcic_cnterm;
+static cn_getc_t opcic_cngetc;
+static cn_putc_t opcic_cnputc;
+static cn_grab_t opcic_cngrab;
+static cn_ungrab_t opcic_cnungrab;
+
+CONSOLE_DRIVER(opcic);
+
+static void
+opcic_cnprobe(struct consdev *cp)
+{
+ const struct cvmx_bootmem_named_block_desc *pci_console_block;
+
+ cp->cn_pri = CN_DEAD;
+
+ pci_console_block = cvmx_bootmem_find_named_block(OCTEON_PCI_CONSOLE_BLOCK_NAME);
+ if (pci_console_block == NULL)
+ return;
+
+ cp->cn_arg = (void *)(uintptr_t)pci_console_block->base_addr;
+ snprintf(cp->cn_name, sizeof cp->cn_name, "opcic@%p", cp->cn_arg);
+ cp->cn_pri = (boothowto & RB_SERIAL) ? CN_REMOTE : CN_NORMAL;
+}
+
+static void
+opcic_cninit(struct consdev *cp)
+{
+ (void)cp;
+}
+
+static void
+opcic_cnterm(struct consdev *cp)
+{
+ (void)cp;
+}
+
+static int
+opcic_cngetc(struct consdev *cp)
+{
+ uint64_t console_desc_addr;
+ char ch;
+ int rv;
+
+ console_desc_addr = (uintptr_t)cp->cn_arg;
+
+ rv = octeon_pci_console_read(console_desc_addr, 0, &ch, 1, OCT_PCI_CON_FLAG_NONBLOCK);
+ if (rv != 1)
+ return (-1);
+ return (ch);
+}
+
+static void
+opcic_cnputc(struct consdev *cp, int c)
+{
+ uint64_t console_desc_addr;
+ char ch;
+ int rv;
+
+ console_desc_addr = (uintptr_t)cp->cn_arg;
+ ch = c;
+
+ rv = octeon_pci_console_write(console_desc_addr, 0, &ch, 1, 0);
+ if (rv == -1)
+ panic("%s: octeon_pci_console_write failed.", __func__);
+}
+
+static void
+opcic_cngrab(struct consdev *cp)
+{
+ (void)cp;
+}
+
+static void
+opcic_cnungrab(struct consdev *cp)
+{
+ (void)cp;
+}
diff --git a/sys/mips/conf/OCTEON1 b/sys/mips/conf/OCTEON1
index 58ec839..d563512 100644
--- a/sys/mips/conf/OCTEON1
+++ b/sys/mips/conf/OCTEON1
@@ -261,6 +261,9 @@ device firmware # firmware assist module
# Note that 'bpf' is required for DHCP.
device bpf # Berkeley packet filter
+# Hardware watchdog support.
+#device octeon_wdog # Octeon hardware watchdog
+
# USB support
options USB_DEBUG # enable debug msgs
device octusb # Cavium Octeon on-board USB interface (USB 2.0)
@@ -297,3 +300,14 @@ device rum # Ralink Technology RT2501USB wireless NICs
device uath # Atheros AR5523 wireless NICs
device ural # Ralink Technology RT2500USB wireless NICs
device zyd # ZyDAS zd1211/zd1211b wireless NICs
+
+# crypto subsystem
+device crypto # core crypto support
+device cryptodev # /dev/crypto for access to h/w
+device cryptocteon # Octeon coprocessor 2 crypto offload
+
+# GPIO support
+#device gpio
+
+# PMC support
+#device hwpmc
diff --git a/sys/mips/include/pmap.h b/sys/mips/include/pmap.h
index 7b5468c..15b07d3 100644
--- a/sys/mips/include/pmap.h
+++ b/sys/mips/include/pmap.h
@@ -179,7 +179,6 @@ void pmap_kenter_temporary_free(vm_paddr_t pa);
void pmap_flush_pvcache(vm_page_t m);
int pmap_emulate_modified(pmap_t pmap, vm_offset_t va);
void pmap_grow_direct_page_cache(void);
-vm_page_t pmap_alloc_direct_page(unsigned int index, int req);
#endif /* _KERNEL */
diff --git a/sys/mips/mips/pmap.c b/sys/mips/mips/pmap.c
index 608546e..7925b8c 100644
--- a/sys/mips/mips/pmap.c
+++ b/sys/mips/mips/pmap.c
@@ -163,6 +163,7 @@ static vm_page_t pmap_pv_reclaim(pmap_t locked_pmap);
static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va);
static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap,
vm_offset_t va);
+static vm_page_t pmap_alloc_direct_page(unsigned int index, int req);
static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va,
vm_page_t m, vm_prot_t prot, vm_page_t mpte);
static int pmap_remove_pte(struct pmap *pmap, pt_entry_t *ptq, vm_offset_t va,
@@ -1041,7 +1042,7 @@ pmap_grow_direct_page_cache()
#endif
}
-vm_page_t
+static vm_page_t
pmap_alloc_direct_page(unsigned int index, int req)
{
vm_page_t m;
diff --git a/sys/mips/mips/uma_machdep.c b/sys/mips/mips/uma_machdep.c
index 798e632..1c8e6c8 100644
--- a/sys/mips/mips/uma_machdep.c
+++ b/sys/mips/mips/uma_machdep.c
@@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/lock.h>
+#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/systm.h>
#include <vm/vm.h>
@@ -48,14 +49,10 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
void *va;
*flags = UMA_SLAB_PRIV;
-
- if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT)
- pflags = VM_ALLOC_INTERRUPT;
- else
- pflags = VM_ALLOC_SYSTEM;
+ pflags = malloc2vm_flags(wait) | VM_ALLOC_WIRED;
for (;;) {
- m = pmap_alloc_direct_page(0, pflags);
+ m = vm_page_alloc_freelist(VM_FREELIST_DIRECT, pflags);
if (m == NULL) {
if (wait & M_NOWAIT)
return (NULL);
diff --git a/sys/modules/agp/Makefile b/sys/modules/agp/Makefile
index 17c8128..9502a68 100644
--- a/sys/modules/agp/Makefile
+++ b/sys/modules/agp/Makefile
@@ -18,7 +18,7 @@ SRCS+= agp_amd64.c agp_i810.c agp_via.c
SRCS+= agp_apple.c
.endif
SRCS+= device_if.h bus_if.h agp_if.h pci_if.h
-SRCS+= opt_agp.h opt_bus.h
+SRCS+= opt_agp.h
MFILES= kern/device_if.m kern/bus_if.m dev/agp/agp_if.m dev/pci/pci_if.m
WERROR=
diff --git a/sys/netinet/sctp_constants.h b/sys/netinet/sctp_constants.h
index 07f9612..1805700 100644
--- a/sys/netinet/sctp_constants.h
+++ b/sys/netinet/sctp_constants.h
@@ -370,7 +370,7 @@ __FBSDID("$FreeBSD$");
#define SCTP_DATAGRAM_ACKED 10010
#define SCTP_DATAGRAM_MARKED 20010
#define SCTP_FORWARD_TSN_SKIP 30010
-#define SCTP_DATAGRAM_NR_MARKED 40010
+#define SCTP_DATAGRAM_NR_ACKED 40010
/* chunk output send from locations */
#define SCTP_OUTPUT_FROM_USR_SEND 0
diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c
index 7701780..a394de5 100644
--- a/sys/netinet/sctp_indata.c
+++ b/sys/netinet/sctp_indata.c
@@ -2976,7 +2976,7 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
* (leave PR-SCTP ones that are to skip alone though)
*/
if ((tp1->sent != SCTP_FORWARD_TSN_SKIP) &&
- (tp1->sent != SCTP_DATAGRAM_NR_MARKED)) {
+ (tp1->sent != SCTP_DATAGRAM_NR_ACKED)) {
tp1->sent = SCTP_DATAGRAM_MARKED;
}
if (tp1->rec.data.chunk_was_revoked) {
@@ -2985,8 +2985,16 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
tp1->rec.data.chunk_was_revoked = 0;
}
/* NR Sack code here */
- if (nr_sacking) {
- tp1->sent = SCTP_DATAGRAM_NR_MARKED;
+ if (nr_sacking &&
+ (tp1->sent != SCTP_DATAGRAM_NR_ACKED)) {
+ if (stcb->asoc.strmout[tp1->rec.data.stream_number].chunks_on_queues > 0) {
+ stcb->asoc.strmout[tp1->rec.data.stream_number].chunks_on_queues--;
+#ifdef INVARIANTS
+ } else {
+ panic("No chunks on the queues for sid %u.", tp1->rec.data.stream_number);
+#endif
+ }
+ tp1->sent = SCTP_DATAGRAM_NR_ACKED;
if (tp1->data) {
/*
* sa_ignore
@@ -3091,7 +3099,6 @@ sctp_check_for_revoked(struct sctp_tcb *stcb,
uint32_t biggest_tsn_acked)
{
struct sctp_tmit_chunk *tp1;
- int tot_revoked = 0;
TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, cumack)) {
@@ -3126,7 +3133,6 @@ sctp_check_for_revoked(struct sctp_tcb *stcb,
* artificial inflation of the flight_size.
*/
tp1->whoTo->cwnd += tp1->book_size;
- tot_revoked++;
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_LOGGING_ENABLE) {
sctp_log_sack(asoc->last_acked_seq,
cumack,
@@ -3603,13 +3609,13 @@ sctp_try_advance_peer_ack_point(struct sctp_tcb *stcb,
TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) {
if (tp1->sent != SCTP_FORWARD_TSN_SKIP &&
tp1->sent != SCTP_DATAGRAM_RESEND &&
- tp1->sent != SCTP_DATAGRAM_NR_MARKED) {
+ tp1->sent != SCTP_DATAGRAM_NR_ACKED) {
/* no chance to advance, out of here */
break;
}
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) {
if ((tp1->sent == SCTP_FORWARD_TSN_SKIP) ||
- (tp1->sent == SCTP_DATAGRAM_NR_MARKED)) {
+ (tp1->sent == SCTP_DATAGRAM_NR_ACKED)) {
sctp_misc_ints(SCTP_FWD_TSN_CHECK,
asoc->advanced_peer_ack_point,
tp1->rec.data.TSN_seq, 0, 0);
@@ -3658,7 +3664,7 @@ sctp_try_advance_peer_ack_point(struct sctp_tcb *stcb,
* the next chunk.
*/
if ((tp1->sent == SCTP_FORWARD_TSN_SKIP) ||
- (tp1->sent == SCTP_DATAGRAM_NR_MARKED)) {
+ (tp1->sent == SCTP_DATAGRAM_NR_ACKED)) {
/* advance PeerAckPoint goes forward */
if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, asoc->advanced_peer_ack_point)) {
asoc->advanced_peer_ack_point = tp1->rec.data.TSN_seq;
@@ -3963,7 +3969,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
tp1->whoTo->cwnd -= tp1->book_size;
tp1->rec.data.chunk_was_revoked = 0;
}
- if (tp1->sent != SCTP_DATAGRAM_NR_MARKED) {
+ if (tp1->sent != SCTP_DATAGRAM_NR_ACKED) {
if (asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues > 0) {
asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues--;
#ifdef INVARIANTS
@@ -4630,7 +4636,9 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup,
tp1->whoTo->cwnd -= tp1->book_size;
tp1->rec.data.chunk_was_revoked = 0;
}
- tp1->sent = SCTP_DATAGRAM_ACKED;
+ if (tp1->sent != SCTP_DATAGRAM_NR_ACKED) {
+ tp1->sent = SCTP_DATAGRAM_ACKED;
+ }
}
} else {
break;
@@ -4707,7 +4715,7 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup,
if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, cum_ack)) {
break;
}
- if (tp1->sent != SCTP_DATAGRAM_NR_MARKED) {
+ if (tp1->sent != SCTP_DATAGRAM_NR_ACKED) {
if (asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues > 0) {
asoc->strmout[tp1->rec.data.stream_number].chunks_on_queues--;
#ifdef INVARIANTS
diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c
index d1a0ef6..eb4be56 100644
--- a/sys/netinet/sctp_input.c
+++ b/sys/netinet/sctp_input.c
@@ -1948,6 +1948,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
sctp_report_all_outbound(stcb, 0, 1, SCTP_SO_NOT_LOCKED);
for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
+ stcb->asoc.strmout[i].chunks_on_queues = 0;
stcb->asoc.strmout[i].stream_no = i;
stcb->asoc.strmout[i].next_sequence_send = 0;
stcb->asoc.strmout[i].last_msg_incomplete = 0;
diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index 4a77b34..aecf035 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -3513,8 +3513,9 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *er
stcb->asoc.pre_open_streams = stcb->asoc.streamoutcnt;
}
for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
- stcb->asoc.strmout[i].next_sequence_send = 0;
TAILQ_INIT(&stcb->asoc.strmout[i].outqueue);
+ stcb->asoc.strmout[i].chunks_on_queues = 0;
+ stcb->asoc.strmout[i].next_sequence_send = 0;
stcb->asoc.strmout[i].stream_no = i;
stcb->asoc.strmout[i].last_msg_incomplete = 0;
stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], NULL);
@@ -7494,6 +7495,7 @@ dont_do_it:
*locked = 1;
}
asoc->chunks_on_out_queue++;
+ strq->chunks_on_queues++;
TAILQ_INSERT_TAIL(&asoc->send_queue, chk, sctp_next);
asoc->send_queue_cnt++;
out_of:
@@ -10153,7 +10155,7 @@ sctp_fill_in_rest:
TAILQ_FOREACH(at, &asoc->sent_queue, sctp_next) {
if ((at->sent != SCTP_FORWARD_TSN_SKIP) &&
- (at->sent != SCTP_DATAGRAM_NR_MARKED)) {
+ (at->sent != SCTP_DATAGRAM_NR_ACKED)) {
/* no more to look at */
break;
}
@@ -11793,6 +11795,7 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb,
stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0, 1);
for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
TAILQ_INIT(&stcb->asoc.strmout[i].outqueue);
+ stcb->asoc.strmout[i].chunks_on_queues = oldstream[i].chunks_on_queues;
stcb->asoc.strmout[i].next_sequence_send = oldstream[i].next_sequence_send;
stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete;
stcb->asoc.strmout[i].stream_no = i;
@@ -11813,8 +11816,9 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb,
/* now the new streams */
stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1);
for (i = stcb->asoc.streamoutcnt; i < (stcb->asoc.streamoutcnt + adding_o); i++) {
- stcb->asoc.strmout[i].next_sequence_send = 0x0;
TAILQ_INIT(&stcb->asoc.strmout[i].outqueue);
+ stcb->asoc.strmout[i].chunks_on_queues = 0;
+ stcb->asoc.strmout[i].next_sequence_send = 0x0;
stcb->asoc.strmout[i].stream_no = i;
stcb->asoc.strmout[i].last_msg_incomplete = 0;
stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], NULL);
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c
index 93115f8..fb32635 100644
--- a/sys/netinet/sctp_pcb.c
+++ b/sys/netinet/sctp_pcb.c
@@ -4925,6 +4925,13 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
}
/* pending send queue SHOULD be empty */
TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) {
+ if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) {
+ asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--;
+#ifdef INVARIANTS
+ } else {
+ panic("No chunks on the queues for sid %u.", chk->rec.data.stream_number);
+#endif
+ }
TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next);
if (chk->data) {
if (so) {
@@ -4949,7 +4956,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
}
/* sent queue SHOULD be empty */
TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) {
- if (chk->sent != SCTP_DATAGRAM_NR_MARKED) {
+ if (chk->sent != SCTP_DATAGRAM_NR_ACKED) {
if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) {
asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--;
#ifdef INVARIANTS
@@ -4977,6 +4984,13 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
SCTP_DECR_CHK_COUNT();
/* sa_ignore FREED_MEMORY */
}
+#ifdef INVARIANTS
+ for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
+ if (stcb->asoc.strmout[i].chunks_on_queues > 0) {
+ panic("%u chunks left for stream %u.", stcb->asoc.strmout[i].chunks_on_queues, i);
+ }
+ }
+#endif
/* control queue MAY not be empty */
TAILQ_FOREACH_SAFE(chk, &asoc->control_send_queue, sctp_next, nchk) {
TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c
index fe7f754..3444923 100644
--- a/sys/netinet/sctp_timer.c
+++ b/sys/netinet/sctp_timer.c
@@ -440,7 +440,7 @@ sctp_recover_sent_list(struct sctp_tcb *stcb)
if (SCTP_TSN_GE(asoc->last_acked_seq, chk->rec.data.TSN_seq)) {
SCTP_PRINTF("Found chk:%p tsn:%x <= last_acked_seq:%x\n",
(void *)chk, chk->rec.data.TSN_seq, asoc->last_acked_seq);
- if (chk->sent != SCTP_DATAGRAM_NR_MARKED) {
+ if (chk->sent != SCTP_DATAGRAM_NR_ACKED) {
if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) {
asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--;
}
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c
index 72dc34e..007b138 100644
--- a/sys/netinet/sctputil.c
+++ b/sys/netinet/sctputil.c
@@ -1054,6 +1054,7 @@ sctp_init_asoc(struct sctp_inpcb *m, struct sctp_tcb *stcb,
*/
asoc->strmout[i].next_sequence_send = 0x0;
TAILQ_INIT(&asoc->strmout[i].outqueue);
+ asoc->strmout[i].chunks_on_queues = 0;
asoc->strmout[i].stream_no = i;
asoc->strmout[i].last_msg_incomplete = 0;
asoc->ss_functions.sctp_ss_init_stream(&asoc->strmout[i], NULL);
@@ -3727,7 +3728,7 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock,
TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) {
TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next);
asoc->sent_queue_cnt--;
- if (chk->sent != SCTP_DATAGRAM_NR_MARKED) {
+ if (chk->sent != SCTP_DATAGRAM_NR_ACKED) {
if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) {
asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--;
#ifdef INVARIANTS
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 9c2daa7..d9ea93e 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -2677,9 +2677,9 @@ icmp6_redirect_output(struct mbuf *m0, struct rtentry *rt)
struct nd_opt_hdr *nd_opt;
char *lladdr;
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
ln = nd6_lookup(router_ll6, 0, ifp);
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
if (ln == NULL)
goto nolladdropt;
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index e028517..fb7e6f0 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -609,9 +609,9 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
rt = ron->ro_rt;
ifp = rt->rt_ifp;
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
la = lla_lookup(LLTABLE6(ifp), 0, (struct sockaddr *)&sin6_next->sin6_addr);
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
if (la != NULL)
LLE_RUNLOCK(la);
else {
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index 3b50143..1b90c75 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -686,10 +686,10 @@ passin:
dst6.sin6_len = sizeof(struct sockaddr_in6);
dst6.sin6_addr = ip6->ip6_dst;
ifp = m->m_pkthdr.rcvif;
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
lle = lla_lookup(LLTABLE6(ifp), 0,
(struct sockaddr *)&dst6);
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
if ((lle != NULL) && (lle->la_flags & LLE_IFADDR)) {
struct ifaddr *ifa;
struct in6_ifaddr *ia6;
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 0ce7378..9993c77 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -975,12 +975,12 @@ nd6_is_addr_neighbor(struct sockaddr_in6 *addr, struct ifnet *ifp)
* Even if the address matches none of our addresses, it might be
* in the neighbor cache.
*/
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
if ((lle = nd6_lookup(&addr->sin6_addr, 0, ifp)) != NULL) {
LLE_RUNLOCK(lle);
rc = 1;
}
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
return (rc);
}
@@ -1480,9 +1480,9 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
if ((error = in6_setscope(&nb_addr, ifp, NULL)) != 0)
return (error);
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
ln = nd6_lookup(&nb_addr, 0, ifp);
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
if (ln == NULL) {
error = EINVAL;
@@ -2198,9 +2198,9 @@ nd6_storelladdr(struct ifnet *ifp, struct mbuf *m,
/*
* the entry should have been created in nd6_store_lladdr
*/
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
ln = lla_lookup(LLTABLE6(ifp), 0, dst);
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
if ((ln == NULL) || !(ln->la_flags & LLE_VALID)) {
if (ln != NULL)
LLE_RUNLOCK(ln);
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index f346cdb..f6bae0c 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -637,13 +637,13 @@ defrouter_select(void)
* the ordering rule of the list described in defrtrlist_update().
*/
TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) {
- IF_AFDATA_LOCK(dr->ifp);
+ IF_AFDATA_RLOCK(dr->ifp);
if (selected_dr == NULL &&
(ln = nd6_lookup(&dr->rtaddr, 0, dr->ifp)) &&
ND6_IS_LLINFO_PROBREACH(ln)) {
selected_dr = dr;
}
- IF_AFDATA_UNLOCK(dr->ifp);
+ IF_AFDATA_RUNLOCK(dr->ifp);
if (ln != NULL) {
LLE_RUNLOCK(ln);
ln = NULL;
@@ -671,13 +671,13 @@ defrouter_select(void)
else
selected_dr = TAILQ_NEXT(installed_dr, dr_entry);
} else if (installed_dr) {
- IF_AFDATA_LOCK(installed_dr->ifp);
+ IF_AFDATA_RLOCK(installed_dr->ifp);
if ((ln = nd6_lookup(&installed_dr->rtaddr, 0, installed_dr->ifp)) &&
ND6_IS_LLINFO_PROBREACH(ln) &&
rtpref(selected_dr) <= rtpref(installed_dr)) {
selected_dr = installed_dr;
}
- IF_AFDATA_UNLOCK(installed_dr->ifp);
+ IF_AFDATA_RUNLOCK(installed_dr->ifp);
if (ln != NULL)
LLE_RUNLOCK(ln);
}
@@ -1301,9 +1301,9 @@ find_pfxlist_reachable_router(struct nd_prefix *pr)
int canreach;
LIST_FOREACH(pfxrtr, &pr->ndpr_advrtrs, pfr_entry) {
- IF_AFDATA_LOCK(pfxrtr->router->ifp);
+ IF_AFDATA_RLOCK(pfxrtr->router->ifp);
ln = nd6_lookup(&pfxrtr->router->rtaddr, 0, pfxrtr->router->ifp);
- IF_AFDATA_UNLOCK(pfxrtr->router->ifp);
+ IF_AFDATA_RUNLOCK(pfxrtr->router->ifp);
if (ln == NULL)
continue;
canreach = ND6_IS_LLINFO_PROBREACH(ln);
diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c
index 7a1a04b..1cfe103 100644
--- a/sys/netinet6/scope6.c
+++ b/sys/netinet6/scope6.c
@@ -121,11 +121,11 @@ scope6_set(struct ifnet *ifp, struct scope6_id *idlist)
int error = 0;
struct scope6_id *sid = NULL;
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_WLOCK(ifp);
sid = SID(ifp);
if (!sid) { /* paranoid? */
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_WUNLOCK(ifp);
return (EINVAL);
}
@@ -139,7 +139,6 @@ scope6_set(struct ifnet *ifp, struct scope6_id *idlist)
* interface addresses, routing table entries, PCB entries...
*/
- SCOPE6_LOCK();
for (i = 0; i < 16; i++) {
if (idlist->s6id_list[i] &&
idlist->s6id_list[i] != sid->s6id_list[i]) {
@@ -149,8 +148,7 @@ scope6_set(struct ifnet *ifp, struct scope6_id *idlist)
*/
if (i == IPV6_ADDR_SCOPE_INTFACELOCAL &&
idlist->s6id_list[i] != ifp->if_index) {
- IF_AFDATA_UNLOCK(ifp);
- SCOPE6_UNLOCK();
+ IF_AFDATA_WUNLOCK(ifp);
return (EINVAL);
}
@@ -162,8 +160,7 @@ scope6_set(struct ifnet *ifp, struct scope6_id *idlist)
* IDs, but we check the consistency for
* safety in later use.
*/
- IF_AFDATA_UNLOCK(ifp);
- SCOPE6_UNLOCK();
+ IF_AFDATA_WUNLOCK(ifp);
return (EINVAL);
}
@@ -175,8 +172,7 @@ scope6_set(struct ifnet *ifp, struct scope6_id *idlist)
sid->s6id_list[i] = idlist->s6id_list[i];
}
}
- SCOPE6_UNLOCK();
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_WUNLOCK(ifp);
return (error);
}
@@ -184,20 +180,19 @@ scope6_set(struct ifnet *ifp, struct scope6_id *idlist)
int
scope6_get(struct ifnet *ifp, struct scope6_id *idlist)
{
- /* We only need to lock the interface's afdata for SID() to work. */
- IF_AFDATA_LOCK(ifp);
- struct scope6_id *sid = SID(ifp);
+ struct scope6_id *sid;
+ /* We only need to lock the interface's afdata for SID() to work. */
+ IF_AFDATA_RLOCK(ifp);
+ sid = SID(ifp);
if (sid == NULL) { /* paranoid? */
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
return (EINVAL);
}
- SCOPE6_LOCK();
*idlist = *sid;
- SCOPE6_UNLOCK();
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
return (0);
}
@@ -388,7 +383,7 @@ sa6_recoverscope(struct sockaddr_in6 *sin6)
zoneid = ntohs(sin6->sin6_addr.s6_addr16[1]);
if (zoneid) {
/* sanity check */
- if (zoneid < 0 || V_if_index < zoneid)
+ if (V_if_index < zoneid)
return (ENXIO);
if (!ifnet_byindex(zoneid))
return (ENXIO);
@@ -414,7 +409,7 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, u_int32_t *ret_id)
u_int32_t zoneid = 0;
struct scope6_id *sid;
- IF_AFDATA_LOCK(ifp);
+ IF_AFDATA_RLOCK(ifp);
sid = SID(ifp);
@@ -431,19 +426,17 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, u_int32_t *ret_id)
*/
if (IN6_IS_ADDR_LOOPBACK(in6)) {
if (!(ifp->if_flags & IFF_LOOPBACK)) {
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
return (EINVAL);
} else {
if (ret_id != NULL)
*ret_id = 0; /* there's no ambiguity */
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
return (0);
}
}
scope = in6_addrscope(in6);
-
- SCOPE6_LOCK();
switch (scope) {
case IPV6_ADDR_SCOPE_INTFACELOCAL: /* should be interface index */
zoneid = sid->s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL];
@@ -465,8 +458,7 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, u_int32_t *ret_id)
zoneid = 0; /* XXX: treat as global. */
break;
}
- SCOPE6_UNLOCK();
- IF_AFDATA_UNLOCK(ifp);
+ IF_AFDATA_RUNLOCK(ifp);
if (ret_id != NULL)
*ret_id = zoneid;
diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c
index a491680..00dab9b 100644
--- a/sys/powerpc/aim/mmu_oea64.c
+++ b/sys/powerpc/aim/mmu_oea64.c
@@ -119,6 +119,7 @@ __FBSDID("$FreeBSD$");
#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/msgbuf.h>
+#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/rwlock.h>
@@ -1368,13 +1369,7 @@ moea64_uma_page_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
*flags = UMA_SLAB_PRIV;
needed_lock = !PMAP_LOCKED(kernel_pmap);
-
- if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT)
- pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED;
- else
- pflags = VM_ALLOC_SYSTEM | VM_ALLOC_WIRED;
- if (wait & M_ZERO)
- pflags |= VM_ALLOC_ZERO;
+ pflags = malloc2vm_flags(wait) | VM_ALLOC_WIRED;
for (;;) {
m = vm_page_alloc(NULL, 0, pflags | VM_ALLOC_NOOBJ);
diff --git a/sys/powerpc/aim/slb.c b/sys/powerpc/aim/slb.c
index 162c7fb..9d60b2b 100644
--- a/sys/powerpc/aim/slb.c
+++ b/sys/powerpc/aim/slb.c
@@ -29,6 +29,7 @@
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/lock.h>
+#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/systm.h>
@@ -483,12 +484,7 @@ slb_uma_real_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
realmax = platform_real_maxaddr();
*flags = UMA_SLAB_PRIV;
- if ((wait & (M_NOWAIT | M_USE_RESERVE)) == M_NOWAIT)
- pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED;
- else
- pflags = VM_ALLOC_SYSTEM | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED;
- if (wait & M_ZERO)
- pflags |= VM_ALLOC_ZERO;
+ pflags = malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED;
for (;;) {
m = vm_page_alloc_contig(NULL, 0, pflags, 1, 0, realmax,
diff --git a/sys/powerpc/aim/uma_machdep.c b/sys/powerpc/aim/uma_machdep.c
index 39deb43..255826e 100644
--- a/sys/powerpc/aim/uma_machdep.c
+++ b/sys/powerpc/aim/uma_machdep.c
@@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/lock.h>
+#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
@@ -56,12 +57,7 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
int pflags;
*flags = UMA_SLAB_PRIV;
- if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT)
- pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED;
- else
- pflags = VM_ALLOC_SYSTEM | VM_ALLOC_WIRED;
- if (wait & M_ZERO)
- pflags |= VM_ALLOC_ZERO;
+ pflags = malloc2vm_flags(wait) | VM_ALLOC_WIRED;
for (;;) {
m = vm_page_alloc(NULL, 0, pflags | VM_ALLOC_NOOBJ);
diff --git a/sys/sparc64/include/ktr.h b/sys/sparc64/include/ktr.h
index f13865f..0a7f0e1 100644
--- a/sys/sparc64/include/ktr.h
+++ b/sys/sparc64/include/ktr.h
@@ -58,6 +58,7 @@ l2: add r2, 1, r3 ; \
bne %icc, l2 ## b ; \
mov r3, r2 ; \
SET(ktr_buf, r3, r1) ; \
+ ldx [r1], r1 ; \
mulx r2, KTR_SIZEOF, r2 ; \
add r1, r2, r1 ; \
rd %tick, r2 ; \
diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c
index d20d69f..08f008c 100644
--- a/sys/sparc64/sparc64/pmap.c
+++ b/sys/sparc64/sparc64/pmap.c
@@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_extern.h>
#include <vm/vm_pageout.h>
#include <vm/vm_pager.h>
+#include <vm/vm_phys.h>
#include <machine/cache.h>
#include <machine/frame.h>
diff --git a/sys/sparc64/sparc64/vm_machdep.c b/sys/sparc64/sparc64/vm_machdep.c
index cdb94c7..0196ec2 100644
--- a/sys/sparc64/sparc64/vm_machdep.c
+++ b/sys/sparc64/sparc64/vm_machdep.c
@@ -501,14 +501,7 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
PMAP_STATS_INC(uma_nsmall_alloc);
*flags = UMA_SLAB_PRIV;
-
- if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT)
- pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED;
- else
- pflags = VM_ALLOC_SYSTEM | VM_ALLOC_WIRED;
-
- if (wait & M_ZERO)
- pflags |= VM_ALLOC_ZERO;
+ pflags = malloc2vm_flags(wait) | VM_ALLOC_WIRED;
for (;;) {
m = vm_page_alloc(NULL, 0, pflags | VM_ALLOC_NOOBJ);
diff --git a/sys/sys/ktr.h b/sys/sys/ktr.h
index 7885b22..c440a41 100644
--- a/sys/sys/ktr.h
+++ b/sys/sys/ktr.h
@@ -116,7 +116,7 @@ extern int ktr_entries;
extern int ktr_verbose;
extern volatile int ktr_idx;
-extern struct ktr_entry ktr_buf[];
+extern struct ktr_entry *ktr_buf;
#ifdef KTR
diff --git a/sys/sys/lock.h b/sys/sys/lock.h
index 303717f..ab0122d 100644
--- a/sys/sys/lock.h
+++ b/sys/sys/lock.h
@@ -304,16 +304,5 @@ void witness_thread_exit(struct thread *);
#define WITNESS_LINE(lock) (0)
#endif /* WITNESS */
-/*
- * Helper macros to allow developers to add explicit lock order checks
- * wherever they please without having to actually grab a lock to do so.
- */
-#define witness_check(l) \
- WITNESS_CHECKORDER(&(l)->lock_object, LOP_EXCLUSIVE, LOCK_FILE, \
- LOCK_LINE, NULL)
-
-#define witness_check_shared(l) \
- WITNESS_CHECKORDER(&(l)->lock_object, 0, LOCK_FILE, LOCK_LINE, NULL)
-
#endif /* _KERNEL */
#endif /* _SYS_LOCK_H_ */
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 0d16ddf..1ff52c1 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -96,7 +96,7 @@
#define MAXCOMLEN 19 /* max command name remembered */
#define MAXINTERP PATH_MAX /* max interpreter file name length */
-#define MAXLOGNAME 17 /* max login name length (incl. NUL) */
+#define MAXLOGNAME 33 /* max login name length (incl. NUL) */
#define MAXUPRC CHILD_MAX /* max simultaneous processes */
#define NCARGS ARG_MAX /* max bytes for an exec function */
#define NGROUPS (NGROUPS_MAX+1) /* max number groups */
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 567cb63..78af5c0 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -835,6 +835,7 @@ extern struct proc *initproc, *pageproc; /* Process slots for init, pager. */
extern struct uma_zone *proc_zone;
struct proc *pfind(pid_t); /* Find process by id. */
+struct proc *pfind_locked(pid_t pid);
struct pgrp *pgfind(pid_t); /* Find process group by id. */
struct proc *zpfind(pid_t); /* Find zombie process by id. */
@@ -885,8 +886,7 @@ int proc_getenvv(struct thread *td, struct proc *p, struct sbuf *sb);
void procinit(void);
void proc_linkup0(struct proc *p, struct thread *td);
void proc_linkup(struct proc *p, struct thread *td);
-void proc_reap(struct thread *td, struct proc *p, int *status, int options,
- struct rusage *rusage);
+void proc_reap(struct thread *td, struct proc *p, int *status, int options);
void proc_reparent(struct proc *child, struct proc *newparent);
struct pstats *pstats_alloc(void);
void pstats_fork(struct pstats *src, struct pstats *dst);
diff --git a/sys/sys/resource.h b/sys/sys/resource.h
index c5e912b..89dc967 100644
--- a/sys/sys/resource.h
+++ b/sys/sys/resource.h
@@ -79,6 +79,13 @@ struct rusage {
#define ru_last ru_nivcsw
};
+#if __BSD_VISIBLE
+struct __wrusage {
+ struct rusage wru_self;
+ struct rusage wru_children;
+};
+#endif
+
/*
* Resource limits
*/
diff --git a/sys/sys/smp.h b/sys/sys/smp.h
index a506669..4abd2ce 100644
--- a/sys/sys/smp.h
+++ b/sys/sys/smp.h
@@ -167,10 +167,14 @@ int stop_cpus_hard(cpuset_t);
#if defined(__amd64__) || defined(__i386__)
int suspend_cpus(cpuset_t);
#endif
+
void smp_rendezvous_action(void);
extern struct mtx smp_ipi_mtx;
#endif /* SMP */
+
+int quiesce_all_cpus(const char *, int);
+int quiesce_cpus(cpuset_t, const char *, int);
void smp_no_rendevous_barrier(void *);
void smp_rendezvous(void (*)(void *),
void (*)(void *),
diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h
index a875083..6b0cd67 100644
--- a/sys/sys/syscall.h
+++ b/sys/sys/syscall.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 239347 2012-08-17 02:26:31Z davidxu
+ * created from FreeBSD: head/sys/kern/syscalls.master 242958 2012-11-13 12:52:31Z kib
*/
#define SYS_syscall 0
@@ -451,4 +451,5 @@
#define SYS_rctl_remove_rule 529
#define SYS_posix_fallocate 530
#define SYS_posix_fadvise 531
-#define SYS_MAXSYSCALL 532
+#define SYS_wait6 532
+#define SYS_MAXSYSCALL 533
diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk
index 53a3590..25f0470 100644
--- a/sys/sys/syscall.mk
+++ b/sys/sys/syscall.mk
@@ -1,7 +1,7 @@
# FreeBSD system call names.
# DO NOT EDIT-- this file is automatically generated.
# $FreeBSD$
-# created from FreeBSD: head/sys/kern/syscalls.master 239347 2012-08-17 02:26:31Z davidxu
+# created from FreeBSD: head/sys/kern/syscalls.master 242958 2012-11-13 12:52:31Z kib
MIASM = \
syscall.o \
exit.o \
@@ -399,4 +399,5 @@ MIASM = \
rctl_add_rule.o \
rctl_remove_rule.o \
posix_fallocate.o \
- posix_fadvise.o
+ posix_fadvise.o \
+ wait6.o
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index 4335550..75feec7 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -35,24 +35,26 @@
#include <sys/mount.h>
struct file;
+enum idtype;
struct itimerval;
struct image_args;
struct jail;
+struct kevent;
+struct kevent_copyops;
+struct kld_file_stat;
+struct ksiginfo;
struct mbuf;
struct msghdr;
struct msqid_ds;
+struct ogetdirentries_args;
struct rlimit;
struct rusage;
union semun;
+struct sendfile_args;
struct sockaddr;
struct stat;
-struct kevent;
-struct kevent_copyops;
-struct kld_file_stat;
-struct ksiginfo;
-struct sendfile_args;
struct thr_param;
-struct ogetdirentries_args;
+struct __wrusage;
int kern___getcwd(struct thread *td, u_char *buf, enum uio_seg bufseg,
u_int buflen);
@@ -234,6 +236,8 @@ int kern_utimesat(struct thread *td, int fd, char *path,
enum uio_seg pathseg, struct timeval *tptr, enum uio_seg tptrseg);
int kern_wait(struct thread *td, pid_t pid, int *status, int options,
struct rusage *rup);
+int kern_wait6(struct thread *td, enum idtype idtype, id_t id, int *status,
+ int options, struct __wrusage *wrup, siginfo_t *sip);
int kern_writev(struct thread *td, int fd, struct uio *auio);
int kern_socketpair(struct thread *td, int domain, int type, int protocol,
int *rsv);
diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h
index 7da3aad..ef59ad5 100644
--- a/sys/sys/sysproto.h
+++ b/sys/sys/sysproto.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 239347 2012-08-17 02:26:31Z davidxu
+ * created from FreeBSD: head/sys/kern/syscalls.master 242958 2012-11-13 12:52:31Z kib
*/
#ifndef _SYS_SYSPROTO_H_
@@ -60,7 +60,7 @@ struct open_args {
struct close_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
};
-struct wait_args {
+struct wait4_args {
char pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)];
char status_l_[PADL_(int *)]; int * status; char status_r_[PADR_(int *)];
char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)];
@@ -1754,6 +1754,14 @@ struct posix_fadvise_args {
char len_l_[PADL_(off_t)]; off_t len; char len_r_[PADR_(off_t)];
char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)];
};
+struct wait6_args {
+ char idtype_l_[PADL_(int)]; int idtype; char idtype_r_[PADR_(int)];
+ char id_l_[PADL_(int)]; int id; char id_r_[PADR_(int)];
+ char status_l_[PADL_(int *)]; int * status; char status_r_[PADR_(int *)];
+ char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)];
+ char wrusage_l_[PADL_(struct __wrusage *)]; struct __wrusage * wrusage; char wrusage_r_[PADR_(struct __wrusage *)];
+ char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)];
+};
int nosys(struct thread *, struct nosys_args *);
void sys_sys_exit(struct thread *, struct sys_exit_args *);
int sys_fork(struct thread *, struct fork_args *);
@@ -1761,7 +1769,7 @@ int sys_read(struct thread *, struct read_args *);
int sys_write(struct thread *, struct write_args *);
int sys_open(struct thread *, struct open_args *);
int sys_close(struct thread *, struct close_args *);
-int sys_wait4(struct thread *, struct wait_args *);
+int sys_wait4(struct thread *, struct wait4_args *);
int sys_link(struct thread *, struct link_args *);
int sys_unlink(struct thread *, struct unlink_args *);
int sys_chdir(struct thread *, struct chdir_args *);
@@ -2135,6 +2143,7 @@ int sys_rctl_add_rule(struct thread *, struct rctl_add_rule_args *);
int sys_rctl_remove_rule(struct thread *, struct rctl_remove_rule_args *);
int sys_posix_fallocate(struct thread *, struct posix_fallocate_args *);
int sys_posix_fadvise(struct thread *, struct posix_fadvise_args *);
+int sys_wait6(struct thread *, struct wait6_args *);
#ifdef COMPAT_43
@@ -2830,6 +2839,7 @@ int freebsd7_shmctl(struct thread *, struct freebsd7_shmctl_args *);
#define SYS_AUE_rctl_remove_rule AUE_NULL
#define SYS_AUE_posix_fallocate AUE_NULL
#define SYS_AUE_posix_fadvise AUE_NULL
+#define SYS_AUE_wait6 AUE_WAIT6
#undef PAD_
#undef PADL_
diff --git a/sys/sys/vmmeter.h b/sys/sys/vmmeter.h
index c66016c..1a29ec1 100644
--- a/sys/sys/vmmeter.h
+++ b/sys/sys/vmmeter.h
@@ -46,7 +46,7 @@
* c - constant after initialization
* f - locked by vm_page_queue_free_mtx
* p - locked by being in the PCPU and atomicity respect to interrupts
- * q - locked by vm_page_queue_mtx
+ * q - changes are synchronized by the corresponding vm_pagequeue lock
*/
struct vmmeter {
/*
@@ -76,7 +76,7 @@ struct vmmeter {
u_int v_intrans; /* (p) intransit blocking page faults */
u_int v_reactivated; /* (f) pages reactivated from free list */
u_int v_pdwakeups; /* (f) times daemon has awaken from sleep */
- u_int v_pdpages; /* (q) pages analyzed by daemon */
+ u_int v_pdpages; /* (p) pages analyzed by daemon */
u_int v_tcached; /* (p) total pages cached */
u_int v_dfree; /* (p) pages freed by daemon */
diff --git a/sys/sys/wait.h b/sys/sys/wait.h
index 0e23c23..d71e8a0 100644
--- a/sys/sys/wait.h
+++ b/sys/sys/wait.h
@@ -80,13 +80,58 @@
#define WSTOPPED WUNTRACED /* SUS compatibility */
#define WCONTINUED 4 /* Report a job control continued process. */
#define WNOWAIT 8 /* Poll only. Don't delete the proc entry. */
+#define WEXITED 16 /* Wait for exited processes. */
+#define WTRAPPED 32 /* Wait for a process to hit a trap or
+ a breakpoint. */
#if __BSD_VISIBLE
#define WLINUXCLONE 0x80000000 /* Wait for kthread spawned from linux_clone. */
#endif
+#ifndef _IDTYPE_T_DECLARED
+typedef enum
+#if __BSD_VISIBLE
+ idtype /* pollutes XPG4.2 namespace */
+#endif
+ {
+ /*
+ * These names were mostly lifted from Solaris source code and
+ * still use Solaris style naming to avoid breaking any
+ * OpenSolaris code which has been ported to FreeBSD. There
+ * is no clear FreeBSD counterpart for all of the names, but
+ * some have a clear correspondence to FreeBSD entities.
+ *
+ * The numerical values are kept synchronized with the Solaris
+ * values.
+ */
+ P_PID, /* A process identifier. */
+ P_PPID, /* A parent process identifier. */
+ P_PGID, /* A process group identifier. */
+ P_SID, /* A session identifier. */
+ P_CID, /* A scheduling class identifier. */
+ P_UID, /* A user identifier. */
+ P_GID, /* A group identifier. */
+ P_ALL, /* All processes. */
+ P_LWPID, /* An LWP identifier. */
+ P_TASKID, /* A task identifier. */
+ P_PROJID, /* A project identifier. */
+ P_POOLID, /* A pool identifier. */
+ P_JAILID, /* A zone identifier. */
+ P_CTID, /* A (process) contract identifier. */
+ P_CPUID, /* CPU identifier. */
+ P_PSETID /* Processor set identifier. */
+} idtype_t; /* The type of id_t we are using. */
+
+#if __BSD_VISIBLE
+#define P_ZONEID P_JAILID
+#endif
+#define _IDTYPE_T_DECLARED
+#endif
+
/*
* Tokens for special values of the "pid" parameter to wait4.
+ * Extended struct __wrusage to collect rusage for both the target
+ * process and its children within one wait6() call.
*/
#if __BSD_VISIBLE
#define WAIT_ANY (-1) /* any process */
@@ -97,12 +142,19 @@
#include <sys/types.h>
__BEGIN_DECLS
+struct __siginfo;
pid_t wait(int *);
pid_t waitpid(pid_t, int *, int);
+#if __POSIX_VISIBLE >= 200112
+int waitid(idtype_t, id_t, struct __siginfo *, int);
+#endif
#if __BSD_VISIBLE
struct rusage;
+struct __wrusage;
pid_t wait3(int *, int, struct rusage *);
pid_t wait4(pid_t, int *, int, struct rusage *);
+pid_t wait6(idtype_t, id_t, int *, int, struct __wrusage *,
+ struct __siginfo *);
#endif
__END_DECLS
#endif /* !_KERNEL */
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index d188761..55f9468 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
#include <sys/buf.h>
#include <sys/kdb.h>
#include <sys/kthread.h>
+#include <sys/ktr.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
@@ -92,6 +93,8 @@ __FBSDID("$FreeBSD$");
#include <ddb/ddb.h>
+#define KTR_SUJ 0 /* Define to KTR_SPARE. */
+
#ifndef SOFTUPDATES
int
@@ -770,6 +773,34 @@ struct pagedep_hashhead;
struct bmsafemap_hashhead;
/*
+ * Private journaling structures.
+ */
+struct jblocks {
+ struct jseglst jb_segs; /* TAILQ of current segments. */
+ struct jseg *jb_writeseg; /* Next write to complete. */
+ struct jseg *jb_oldestseg; /* Oldest segment with valid entries. */
+ struct jextent *jb_extent; /* Extent array. */
+ uint64_t jb_nextseq; /* Next sequence number. */
+ uint64_t jb_oldestwrseq; /* Oldest written sequence number. */
+ uint8_t jb_needseg; /* Need a forced segment. */
+ uint8_t jb_suspended; /* Did journal suspend writes? */
+ int jb_avail; /* Available extents. */
+ int jb_used; /* Last used extent. */
+ int jb_head; /* Allocator head. */
+ int jb_off; /* Allocator extent offset. */
+ int jb_blocks; /* Total disk blocks covered. */
+ int jb_free; /* Total disk blocks free. */
+ int jb_min; /* Minimum free space. */
+ int jb_low; /* Low on space. */
+ int jb_age; /* Insertion time of oldest rec. */
+};
+
+struct jextent {
+ ufs2_daddr_t je_daddr; /* Disk block address. */
+ int je_blocks; /* Disk block count. */
+};
+
+/*
* Internal function prototypes.
*/
static void softdep_error(char *, int);
@@ -2268,19 +2299,15 @@ static void
indirblk_insert(freework)
struct freework *freework;
{
- struct freeblks *freeblks;
- struct jsegdep *jsegdep;
- struct worklist *wk;
+ struct jblocks *jblocks;
+ struct jseg *jseg;
- freeblks = freework->fw_freeblks;
- LIST_FOREACH(wk, &freeblks->fb_jwork, wk_list)
- if (wk->wk_type == D_JSEGDEP)
- break;
- if (wk == NULL)
+ jblocks = VFSTOUFS(freework->fw_list.wk_mp)->softdep_jblocks;
+ jseg = TAILQ_LAST(&jblocks->jb_segs, jseglst);
+ if (jseg == NULL)
return;
- jsegdep = WK_JSEGDEP(wk);
- LIST_INSERT_HEAD(&jsegdep->jd_seg->js_indirs, freework, fw_segs);
+ LIST_INSERT_HEAD(&jseg->js_indirs, freework, fw_segs);
TAILQ_INSERT_HEAD(INDIR_HASH(freework->fw_list.wk_mp,
freework->fw_blkno), freework, fw_next);
freework->fw_state &= ~DEPCOMPLETE;
@@ -2433,31 +2460,6 @@ softdep_unmount(mp)
journal_unmount(mp);
}
-struct jblocks {
- struct jseglst jb_segs; /* TAILQ of current segments. */
- struct jseg *jb_writeseg; /* Next write to complete. */
- struct jseg *jb_oldestseg; /* Oldest segment with valid entries. */
- struct jextent *jb_extent; /* Extent array. */
- uint64_t jb_nextseq; /* Next sequence number. */
- uint64_t jb_oldestwrseq; /* Oldest written sequence number. */
- uint8_t jb_needseg; /* Need a forced segment. */
- uint8_t jb_suspended; /* Did journal suspend writes? */
- int jb_avail; /* Available extents. */
- int jb_used; /* Last used extent. */
- int jb_head; /* Allocator head. */
- int jb_off; /* Allocator extent offset. */
- int jb_blocks; /* Total disk blocks covered. */
- int jb_free; /* Total disk blocks free. */
- int jb_min; /* Minimum free space. */
- int jb_low; /* Low on space. */
- int jb_age; /* Insertion time of oldest rec. */
-};
-
-struct jextent {
- ufs2_daddr_t je_daddr; /* Disk block address. */
- int je_blocks; /* Disk block count. */
-};
-
static struct jblocks *
jblocks_create(void)
{
@@ -3663,7 +3665,7 @@ handle_written_jnewblk(jnewblk)
*/
freefrag = WK_FREEFRAG(jnewblk->jn_dep);
freefrag->ff_jdep = NULL;
- WORKLIST_INSERT(&freefrag->ff_jwork, &jsegdep->jd_list);
+ jwork_insert(&freefrag->ff_jwork, jsegdep);
break;
case D_FREEWORK:
/*
@@ -3671,8 +3673,7 @@ handle_written_jnewblk(jnewblk)
*/
freework = WK_FREEWORK(jnewblk->jn_dep);
freework->fw_jnewblk = NULL;
- WORKLIST_INSERT(&freework->fw_freeblks->fb_jwork,
- &jsegdep->jd_list);
+ jwork_insert(&freework->fw_freeblks->fb_jwork, jsegdep);
break;
default:
panic("handle_written_jnewblk: Unknown type %d.",
@@ -3702,6 +3703,7 @@ cancel_jfreefrag(jfreefrag)
jfreefrag->fr_freefrag = NULL;
free_jfreefrag(jfreefrag);
freefrag->ff_state |= DEPCOMPLETE;
+ CTR1(KTR_SUJ, "cancel_jfreefrag: blkno %jd", freefrag->ff_blkno);
}
/*
@@ -3765,7 +3767,7 @@ handle_written_jblkdep(jblkdep)
jblkdep->jb_jsegdep = NULL;
freeblks = jblkdep->jb_freeblks;
LIST_REMOVE(jblkdep, jb_deps);
- WORKLIST_INSERT(&freeblks->fb_jwork, &jsegdep->jd_list);
+ jwork_insert(&freeblks->fb_jwork, jsegdep);
/*
* If the freeblks is all journaled, we can add it to the worklist.
*/
@@ -3968,6 +3970,7 @@ cancel_jfreeblk(freeblks, blkno)
}
if (jblkdep == NULL)
return;
+ CTR1(KTR_SUJ, "cancel_jfreeblk: blkno %jd", blkno);
free_jsegdep(jblkdep->jb_jsegdep);
LIST_REMOVE(jblkdep, jb_deps);
WORKITEM_FREE(jfreeblk, D_JFREEBLK);
@@ -4208,6 +4211,7 @@ cancel_jnewblk(jnewblk, wkhd)
{
struct jsegdep *jsegdep;
+ CTR1(KTR_SUJ, "cancel_jnewblk: blkno %jd", jnewblk->jn_blkno);
jsegdep = jnewblk->jn_jsegdep;
if (jnewblk->jn_jsegdep == NULL || jnewblk->jn_dep == NULL)
panic("cancel_jnewblk: Invalid state");
@@ -4899,6 +4903,10 @@ softdep_setup_blkmapdep(bp, mp, newblkno, frags, oldfrags)
}
#endif
}
+
+ CTR3(KTR_SUJ,
+ "softdep_setup_blkmapdep: blkno %jd frags %d oldfrags %d",
+ newblkno, frags, oldfrags);
ACQUIRE_LOCK(&lk);
if (newblk_lookup(mp, newblkno, DEPALLOC, &newblk) != 0)
panic("softdep_setup_blkmapdep: found block");
@@ -5060,6 +5068,10 @@ softdep_setup_allocdirect(ip, off, newblkno, oldblkno, newsize, oldsize, bp)
else
freefrag = NULL;
+ CTR6(KTR_SUJ,
+ "softdep_setup_allocdirect: ino %d blkno %jd oldblkno %jd "
+ "off %jd newsize %ld oldsize %d",
+ ip->i_number, newblkno, oldblkno, off, newsize, oldsize);
ACQUIRE_LOCK(&lk);
if (off >= NDADDR) {
if (lbn > 0)
@@ -5338,6 +5350,8 @@ newfreefrag(ip, blkno, size, lbn)
struct freefrag *freefrag;
struct fs *fs;
+ CTR4(KTR_SUJ, "newfreefrag: ino %d blkno %jd size %ld lbn %jd",
+ ip->i_number, blkno, size, lbn);
fs = ip->i_fs;
if (fragnum(fs, blkno) + numfrags(fs, size) > fs->fs_frag)
panic("newfreefrag: frag size");
@@ -5373,6 +5387,9 @@ handle_workitem_freefrag(freefrag)
struct ufsmount *ump = VFSTOUFS(freefrag->ff_list.wk_mp);
struct workhead wkhd;
+ CTR3(KTR_SUJ,
+ "handle_workitem_freefrag: ino %d blkno %jd size %ld",
+ freefrag->ff_inum, freefrag->ff_blkno, freefrag->ff_fragsize);
/*
* It would be illegal to add new completion items to the
* freefrag after it was schedule to be done so it must be
@@ -5591,6 +5608,9 @@ softdep_setup_allocindir_page(ip, lbn, bp, ptrno, newblkno, oldblkno, nbp)
if (lbn != nbp->b_lblkno)
panic("softdep_setup_allocindir_page: lbn %jd != lblkno %jd",
lbn, bp->b_lblkno);
+ CTR4(KTR_SUJ,
+ "softdep_setup_allocindir_page: ino %d blkno %jd oldblkno %jd "
+ "lbn %jd", ip->i_number, newblkno, oldblkno, lbn);
ASSERT_VOP_LOCKED(ITOV(ip), "softdep_setup_allocindir_page");
mp = UFSTOVFS(ip->i_ump);
aip = newallocindir(ip, ptrno, newblkno, oldblkno, lbn);
@@ -5629,6 +5649,9 @@ softdep_setup_allocindir_meta(nbp, ip, bp, ptrno, newblkno)
ufs_lbn_t lbn;
int dflags;
+ CTR3(KTR_SUJ,
+ "softdep_setup_allocindir_meta: ino %d blkno %jd ptrno %d",
+ ip->i_number, newblkno, ptrno);
lbn = nbp->b_lblkno;
ASSERT_VOP_LOCKED(ITOV(ip), "softdep_setup_allocindir_meta");
aip = newallocindir(ip, ptrno, newblkno, 0, lbn);
@@ -6233,6 +6256,7 @@ softdep_journal_freeblocks(ip, cred, length, flags)
int flags; /* IO_EXT and/or IO_NORMAL */
{
struct freeblks *freeblks, *fbn;
+ struct worklist *wk, *wkn;
struct inodedep *inodedep;
struct jblkdep *jblkdep;
struct allocdirect *adp, *adpn;
@@ -6267,6 +6291,8 @@ softdep_journal_freeblocks(ip, cred, length, flags)
if ((inodedep->id_state & (UNLINKED | DEPCOMPLETE)) == UNLINKED &&
length == 0)
needj = 0;
+ CTR3(KTR_SUJ, "softdep_journal_freeblks: ip %d length %ld needj %d",
+ ip->i_number, length, needj);
FREE_LOCK(&lk);
/*
* Calculate the lbn that we are truncating to. This results in -1
@@ -6420,6 +6446,21 @@ softdep_journal_freeblocks(ip, cred, length, flags)
cancel_allocdirect(&inodedep->id_extupdt, adp,
freeblks);
/*
+ * Scan the bufwait list for newblock dependencies that will never
+ * make it to disk.
+ */
+ LIST_FOREACH_SAFE(wk, &inodedep->id_bufwait, wk_list, wkn) {
+ if (wk->wk_type != D_ALLOCDIRECT)
+ continue;
+ adp = WK_ALLOCDIRECT(wk);
+ if (((flags & IO_NORMAL) != 0 && (adp->ad_offset > iboff)) ||
+ ((flags & IO_EXT) != 0 && (adp->ad_state & EXTDATA))) {
+ cancel_jfreeblk(freeblks, adp->ad_newblkno);
+ cancel_newblk(WK_NEWBLK(wk), NULL, &freeblks->fb_jwork);
+ WORKLIST_INSERT(&freeblks->fb_freeworkhd, wk);
+ }
+ }
+ /*
* Add journal work.
*/
LIST_FOREACH(jblkdep, &freeblks->fb_jblkdephd, jb_deps)
@@ -6558,6 +6599,8 @@ softdep_setup_freeblocks(ip, length, flags)
ufs_lbn_t tmpval;
ufs_lbn_t lbn;
+ CTR2(KTR_SUJ, "softdep_setup_freeblks: ip %d length %ld",
+ ip->i_number, length);
fs = ip->i_fs;
mp = UFSTOVFS(ip->i_ump);
if (length != 0)
@@ -7083,6 +7126,8 @@ cancel_newblk(newblk, wk, wkhd)
{
struct jnewblk *jnewblk;
+ CTR1(KTR_SUJ, "cancel_newblk: blkno %jd", newblk->nb_newblkno);
+
newblk->nb_state |= GOINGAWAY;
/*
* Previously we traversed the completedhd on each indirdep
@@ -7451,6 +7496,9 @@ freework_freeblock(freework)
}
FREE_LOCK(&lk);
freeblks_free(ump, freeblks, btodb(bsize));
+ CTR4(KTR_SUJ,
+ "freework_freeblock: ino %d blkno %jd lbn %jd size %ld",
+ freeblks->fb_inum, freework->fw_blkno, freework->fw_lbn, bsize);
ffs_blkfree(ump, fs, freeblks->fb_devvp, freework->fw_blkno, bsize,
freeblks->fb_inum, freeblks->fb_vtype, &wkhd);
ACQUIRE_LOCK(&lk);
@@ -7884,6 +7932,9 @@ indir_trunc(freework, dbn, lbn)
&freedep->fd_list);
freedeps++;
}
+ CTR3(KTR_SUJ,
+ "indir_trunc: ino %d blkno %jd size %ld",
+ freeblks->fb_inum, nb, fs->fs_bsize);
ffs_blkfree(ump, fs, freeblks->fb_devvp, nb,
fs->fs_bsize, freeblks->fb_inum,
freeblks->fb_vtype, &wkhd);
@@ -7919,6 +7970,9 @@ indir_trunc(freework, dbn, lbn)
* If we're not journaling we can free the indirect now.
*/
dbn = dbtofsb(fs, dbn);
+ CTR3(KTR_SUJ,
+ "indir_trunc 2: ino %d blkno %jd size %ld",
+ freeblks->fb_inum, dbn, fs->fs_bsize);
ffs_blkfree(ump, fs, freeblks->fb_devvp, dbn, fs->fs_bsize,
freeblks->fb_inum, freeblks->fb_vtype, NULL);
/* Non SUJ softdep does single-threaded truncations. */
@@ -10356,6 +10410,10 @@ softdep_setup_blkfree(mp, bp, blkno, frags, wkhd)
int i;
#endif
+ CTR3(KTR_SUJ,
+ "softdep_setup_blkfree: blkno %jd frags %d wk head %p",
+ blkno, frags, wkhd);
+
ACQUIRE_LOCK(&lk);
/* Lookup the bmsafemap so we track when it is dirty. */
fs = VFSTOUFS(mp)->um_fs;
@@ -10367,6 +10425,9 @@ softdep_setup_blkfree(mp, bp, blkno, frags, wkhd)
*/
if (wkhd) {
while ((wk = LIST_FIRST(wkhd)) != NULL) {
+ CTR2(KTR_SUJ,
+ "softdep_setup_blkfree: blkno %jd wk type %d",
+ blkno, wk->wk_type);
WORKLIST_REMOVE(wk);
if (wk->wk_type != D_JNEWBLK) {
WORKLIST_INSERT(&bmsafemap->sm_freehd, wk);
diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c
index 546c9bd..ba70571 100644
--- a/sys/vm/device_pager.c
+++ b/sys/vm/device_pager.c
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_object.h>
#include <vm/vm_page.h>
#include <vm/vm_pager.h>
+#include <vm/vm_phys.h>
#include <vm/uma.h>
static void dev_pager_init(void);
diff --git a/sys/vm/sg_pager.c b/sys/vm/sg_pager.c
index c8b14bd..097039e 100644
--- a/sys/vm/sg_pager.c
+++ b/sys/vm/sg_pager.c
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_object.h>
#include <vm/vm_page.h>
#include <vm/vm_pager.h>
+#include <vm/vm_phys.h>
#include <vm/uma.h>
static vm_object_t sg_pager_alloc(void *, vm_ooffset_t, vm_prot_t,
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index ddc1119..516138af 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -388,7 +388,7 @@ RetryFault:;
vm_object_deallocate(fs.first_object);
goto RetryFault;
}
- vm_pageq_remove(fs.m);
+ vm_page_remque(fs.m);
vm_page_unlock(fs.m);
/*
diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c
index 46e7f1c..f731895 100644
--- a/sys/vm/vm_kern.c
+++ b/sys/vm/vm_kern.c
@@ -222,12 +222,7 @@ kmem_alloc_attr(vm_map_t map, vm_size_t size, int flags, vm_paddr_t low,
vm_object_reference(object);
vm_map_insert(map, object, offset, addr, addr + size, VM_PROT_ALL,
VM_PROT_ALL, 0);
- if ((flags & (M_NOWAIT | M_USE_RESERVE)) == M_NOWAIT)
- pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOBUSY;
- else
- pflags = VM_ALLOC_SYSTEM | VM_ALLOC_NOBUSY;
- if (flags & M_ZERO)
- pflags |= VM_ALLOC_ZERO;
+ pflags = malloc2vm_flags(flags) | VM_ALLOC_NOBUSY;
VM_OBJECT_LOCK(object);
end_offset = offset + size;
for (; offset < end_offset; offset += PAGE_SIZE) {
@@ -296,14 +291,7 @@ kmem_alloc_contig(vm_map_t map, vm_size_t size, int flags, vm_paddr_t low,
vm_object_reference(object);
vm_map_insert(map, object, offset, addr, addr + size, VM_PROT_ALL,
VM_PROT_ALL, 0);
- if ((flags & (M_NOWAIT | M_USE_RESERVE)) == M_NOWAIT)
- pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOBUSY;
- else
- pflags = VM_ALLOC_SYSTEM | VM_ALLOC_NOBUSY;
- if (flags & M_ZERO)
- pflags |= VM_ALLOC_ZERO;
- if (flags & M_NODUMP)
- pflags |= VM_ALLOC_NODUMP;
+ pflags = malloc2vm_flags(flags) | VM_ALLOC_NOBUSY;
VM_OBJECT_LOCK(object);
tries = 0;
retry:
@@ -487,15 +475,7 @@ kmem_back(vm_map_t map, vm_offset_t addr, vm_size_t size, int flags)
entry->wired_count == 0 && (entry->eflags & MAP_ENTRY_IN_TRANSITION)
== 0, ("kmem_back: entry not found or misaligned"));
- if ((flags & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT)
- pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED;
- else
- pflags = VM_ALLOC_SYSTEM | VM_ALLOC_WIRED;
-
- if (flags & M_ZERO)
- pflags |= VM_ALLOC_ZERO;
- if (flags & M_NODUMP)
- pflags |= VM_ALLOC_NODUMP;
+ pflags = malloc2vm_flags(flags) | VM_ALLOC_WIRED;
VM_OBJECT_LOCK(kmem_object);
for (i = 0; i < size; i += PAGE_SIZE) {
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index ef9fb85..5758ffe 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -63,10 +63,16 @@
/*
* GENERAL RULES ON VM_PAGE MANIPULATION
*
- * - a pageq mutex is required when adding or removing a page from a
- * page queue (vm_page_queue[]), regardless of other mutexes or the
+ * - A page queue lock is required when adding or removing a page from a
+ * page queue (vm_pagequeues[]), regardless of other locks or the
* busy state of a page.
*
+ * * In general, no thread besides the page daemon can acquire or
+ * hold more than one page queue lock at a time.
+ *
+ * * The page daemon can acquire and hold any pair of page queue
+ * locks in any order.
+ *
* - The object mutex is held when inserting or removing
* pages from an object (vm_page_insert() or vm_page_remove()).
*
@@ -115,8 +121,20 @@ __FBSDID("$FreeBSD$");
* page structure.
*/
-struct vpgqueues vm_page_queues[PQ_COUNT];
-struct mtx_padalign vm_page_queue_mtx;
+struct vm_pagequeue vm_pagequeues[PQ_COUNT] = {
+ [PQ_INACTIVE] = {
+ .pq_pl = TAILQ_HEAD_INITIALIZER(
+ vm_pagequeues[PQ_INACTIVE].pq_pl),
+ .pq_cnt = &cnt.v_inactive_count,
+ .pq_name = "vm inactive pagequeue"
+ },
+ [PQ_ACTIVE] = {
+ .pq_pl = TAILQ_HEAD_INITIALIZER(
+ vm_pagequeues[PQ_ACTIVE].pq_pl),
+ .pq_cnt = &cnt.v_active_count,
+ .pq_name = "vm active pagequeue"
+ }
+};
struct mtx_padalign vm_page_queue_free_mtx;
struct mtx_padalign pa_lock[PA_LOCK_COUNT];
@@ -139,7 +157,6 @@ static uma_zone_t fakepg_zone;
static struct vnode *vm_page_alloc_init(vm_page_t m);
static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits);
-static void vm_page_queue_remove(int queue, vm_page_t m);
static void vm_page_enqueue(int queue, vm_page_t m);
static void vm_page_init_fakepg(void *dummy);
@@ -294,20 +311,11 @@ vm_page_startup(vm_offset_t vaddr)
/*
* Initialize the page and queue locks.
*/
- mtx_init(&vm_page_queue_mtx, "vm page queue", NULL, MTX_DEF |
- MTX_RECURSE);
mtx_init(&vm_page_queue_free_mtx, "vm page free queue", NULL, MTX_DEF);
for (i = 0; i < PA_LOCK_COUNT; i++)
mtx_init(&pa_lock[i], "vm page", NULL, MTX_DEF);
-
- /*
- * Initialize the queue headers for the hold queue, the active queue,
- * and the inactive queue.
- */
for (i = 0; i < PQ_COUNT; i++)
- TAILQ_INIT(&vm_page_queues[i].pl);
- vm_page_queues[PQ_INACTIVE].cnt = &cnt.v_inactive_count;
- vm_page_queues[PQ_ACTIVE].cnt = &cnt.v_active_count;
+ vm_pagequeue_init_lock(&vm_pagequeues[i]);
/*
* Allocate memory for use when boot strapping the kernel memory
@@ -1867,61 +1875,109 @@ vm_waitpfault(void)
}
/*
- * vm_page_queue_remove:
+ * vm_page_dequeue:
*
- * Remove the given page from the specified queue.
+ * Remove the given page from its current page queue.
*
- * The page and page queues must be locked.
+ * The page must be locked.
*/
-static __inline void
-vm_page_queue_remove(int queue, vm_page_t m)
+void
+vm_page_dequeue(vm_page_t m)
{
- struct vpgqueues *pq;
+ struct vm_pagequeue *pq;
- mtx_assert(&vm_page_queue_mtx, MA_OWNED);
vm_page_lock_assert(m, MA_OWNED);
- pq = &vm_page_queues[queue];
- TAILQ_REMOVE(&pq->pl, m, pageq);
- (*pq->cnt)--;
+ KASSERT(m->queue != PQ_NONE,
+ ("vm_page_dequeue: page %p is not queued", m));
+ pq = &vm_pagequeues[m->queue];
+ vm_pagequeue_lock(pq);
+ m->queue = PQ_NONE;
+ TAILQ_REMOVE(&pq->pq_pl, m, pageq);
+ (*pq->pq_cnt)--;
+ vm_pagequeue_unlock(pq);
}
/*
- * vm_pageq_remove:
+ * vm_page_dequeue_locked:
*
- * Remove a page from its queue.
+ * Remove the given page from its current page queue.
*
- * The given page must be locked.
+ * The page and page queue must be locked.
*/
void
-vm_pageq_remove(vm_page_t m)
+vm_page_dequeue_locked(vm_page_t m)
{
- int queue;
+ struct vm_pagequeue *pq;
vm_page_lock_assert(m, MA_OWNED);
- if ((queue = m->queue) != PQ_NONE) {
- vm_page_lock_queues();
- m->queue = PQ_NONE;
- vm_page_queue_remove(queue, m);
- vm_page_unlock_queues();
- }
+ pq = &vm_pagequeues[m->queue];
+ vm_pagequeue_assert_locked(pq);
+ m->queue = PQ_NONE;
+ TAILQ_REMOVE(&pq->pq_pl, m, pageq);
+ (*pq->pq_cnt)--;
}
/*
* vm_page_enqueue:
*
- * Add the given page to the specified queue.
+ * Add the given page to the specified page queue.
*
- * The page queues must be locked.
+ * The page must be locked.
*/
static void
vm_page_enqueue(int queue, vm_page_t m)
{
- struct vpgqueues *vpq;
+ struct vm_pagequeue *pq;
- vpq = &vm_page_queues[queue];
+ vm_page_lock_assert(m, MA_OWNED);
+ pq = &vm_pagequeues[queue];
+ vm_pagequeue_lock(pq);
m->queue = queue;
- TAILQ_INSERT_TAIL(&vpq->pl, m, pageq);
- ++*vpq->cnt;
+ TAILQ_INSERT_TAIL(&pq->pq_pl, m, pageq);
+ ++*pq->pq_cnt;
+ vm_pagequeue_unlock(pq);
+}
+
+/*
+ * vm_page_requeue:
+ *
+ * Move the given page to the tail of its current page queue.
+ *
+ * The page must be locked.
+ */
+void
+vm_page_requeue(vm_page_t m)
+{
+ struct vm_pagequeue *pq;
+
+ vm_page_lock_assert(m, MA_OWNED);
+ KASSERT(m->queue != PQ_NONE,
+ ("vm_page_requeue: page %p is not queued", m));
+ pq = &vm_pagequeues[m->queue];
+ vm_pagequeue_lock(pq);
+ TAILQ_REMOVE(&pq->pq_pl, m, pageq);
+ TAILQ_INSERT_TAIL(&pq->pq_pl, m, pageq);
+ vm_pagequeue_unlock(pq);
+}
+
+/*
+ * vm_page_requeue_locked:
+ *
+ * Move the given page to the tail of its current page queue.
+ *
+ * The page queue must be locked.
+ */
+void
+vm_page_requeue_locked(vm_page_t m)
+{
+ struct vm_pagequeue *pq;
+
+ KASSERT(m->queue != PQ_NONE,
+ ("vm_page_requeue_locked: page %p is not queued", m));
+ pq = &vm_pagequeues[m->queue];
+ vm_pagequeue_assert_locked(pq);
+ TAILQ_REMOVE(&pq->pq_pl, m, pageq);
+ TAILQ_INSERT_TAIL(&pq->pq_pl, m, pageq);
}
/*
@@ -1944,11 +2000,9 @@ vm_page_activate(vm_page_t m)
if (m->wire_count == 0 && (m->oflags & VPO_UNMANAGED) == 0) {
if (m->act_count < ACT_INIT)
m->act_count = ACT_INIT;
- vm_page_lock_queues();
if (queue != PQ_NONE)
- vm_page_queue_remove(queue, m);
+ vm_page_dequeue(m);
vm_page_enqueue(PQ_ACTIVE, m);
- vm_page_unlock_queues();
} else
KASSERT(queue == PQ_NONE,
("vm_page_activate: wired page %p is queued", m));
@@ -2008,7 +2062,9 @@ vm_page_free_toq(vm_page_t m)
vm_page_lock_assert(m, MA_OWNED);
KASSERT(!pmap_page_is_mapped(m),
("vm_page_free_toq: freeing mapped page %p", m));
- }
+ } else
+ KASSERT(m->queue == PQ_NONE,
+ ("vm_page_free_toq: unmanaged page %p is queued", m));
PCPU_INC(cnt.v_tfree);
if (VM_PAGE_IS_FREE(m))
@@ -2022,8 +2078,7 @@ vm_page_free_toq(vm_page_t m)
* callback routine until after we've put the page on the
* appropriate free queue.
*/
- if ((m->oflags & VPO_UNMANAGED) == 0)
- vm_pageq_remove(m);
+ vm_page_remque(m);
vm_page_remove(m);
/*
@@ -2101,8 +2156,10 @@ vm_page_wire(vm_page_t m)
return;
}
if (m->wire_count == 0) {
- if ((m->oflags & VPO_UNMANAGED) == 0)
- vm_pageq_remove(m);
+ KASSERT((m->oflags & VPO_UNMANAGED) == 0 ||
+ m->queue == PQ_NONE,
+ ("vm_page_wire: unmanaged page %p is queued", m));
+ vm_page_remque(m);
atomic_add_int(&cnt.v_wire_count, 1);
}
m->wire_count++;
@@ -2145,9 +2202,7 @@ vm_page_unwire(vm_page_t m, int activate)
return;
if (!activate)
m->flags &= ~PG_WINATCFLS;
- vm_page_lock_queues();
vm_page_enqueue(activate ? PQ_ACTIVE : PQ_INACTIVE, m);
- vm_page_unlock_queues();
}
} else
panic("vm_page_unwire: page %p's wire count is zero", m);
@@ -2176,6 +2231,7 @@ vm_page_unwire(vm_page_t m, int activate)
static inline void
_vm_page_deactivate(vm_page_t m, int athead)
{
+ struct vm_pagequeue *pq;
int queue;
vm_page_lock_assert(m, MA_OWNED);
@@ -2186,19 +2242,18 @@ _vm_page_deactivate(vm_page_t m, int athead)
if ((queue = m->queue) == PQ_INACTIVE)
return;
if (m->wire_count == 0 && (m->oflags & VPO_UNMANAGED) == 0) {
- m->flags &= ~PG_WINATCFLS;
- vm_page_lock_queues();
if (queue != PQ_NONE)
- vm_page_queue_remove(queue, m);
+ vm_page_dequeue(m);
+ m->flags &= ~PG_WINATCFLS;
+ pq = &vm_pagequeues[PQ_INACTIVE];
+ vm_pagequeue_lock(pq);
+ m->queue = PQ_INACTIVE;
if (athead)
- TAILQ_INSERT_HEAD(&vm_page_queues[PQ_INACTIVE].pl, m,
- pageq);
+ TAILQ_INSERT_HEAD(&pq->pq_pl, m, pageq);
else
- TAILQ_INSERT_TAIL(&vm_page_queues[PQ_INACTIVE].pl, m,
- pageq);
- m->queue = PQ_INACTIVE;
+ TAILQ_INSERT_TAIL(&pq->pq_pl, m, pageq);
cnt.v_inactive_count++;
- vm_page_unlock_queues();
+ vm_pagequeue_unlock(pq);
}
}
@@ -2298,7 +2353,7 @@ vm_page_cache(vm_page_t m)
/*
* Remove the page from the paging queues.
*/
- vm_pageq_remove(m);
+ vm_page_remque(m);
/*
* Remove the page from the object's collection of resident
@@ -3039,7 +3094,7 @@ DB_SHOW_COMMAND(pageq, vm_page_print_pageq_info)
db_printf("\n");
db_printf("PQ_ACTIVE: %d, PQ_INACTIVE: %d\n",
- *vm_page_queues[PQ_ACTIVE].cnt,
- *vm_page_queues[PQ_INACTIVE].cnt);
+ *vm_pagequeues[PQ_ACTIVE].pq_cnt,
+ *vm_pagequeues[PQ_INACTIVE].pq_cnt);
}
#endif /* DDB */
diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h
index 70b8416..f8a4f70 100644
--- a/sys/vm/vm_page.h
+++ b/sys/vm/vm_page.h
@@ -92,7 +92,7 @@
* In general, operations on this structure's mutable fields are
* synchronized using either one of or a combination of the lock on the
* object that the page belongs to (O), the pool lock for the page (P),
- * or the lock for either the free or paging queues (Q). If a field is
+ * or the lock for either the free or paging queue (Q). If a field is
* annotated below with two of these locks, then holding either lock is
* sufficient for read access, but both locks are required for write
* access.
@@ -111,8 +111,6 @@
* field is encapsulated in vm_page_clear_dirty_mask().
*/
-TAILQ_HEAD(pglist, vm_page);
-
#if PAGE_SIZE == 4096
#define VM_PAGE_BITS_ALL 0xffu
typedef uint8_t vm_page_bits_t;
@@ -128,7 +126,7 @@ typedef uint64_t vm_page_bits_t;
#endif
struct vm_page {
- TAILQ_ENTRY(vm_page) pageq; /* queue info for FIFO queue or free list (Q) */
+ TAILQ_ENTRY(vm_page) pageq; /* page queue or free list (Q) */
TAILQ_ENTRY(vm_page) listq; /* pages in same object (O) */
struct vm_page *left; /* splay tree link (O) */
struct vm_page *right; /* splay tree link (O) */
@@ -180,12 +178,22 @@ struct vm_page {
#define PQ_ACTIVE 1
#define PQ_COUNT 2
-struct vpgqueues {
- struct pglist pl;
- int *cnt;
-};
+TAILQ_HEAD(pglist, vm_page);
+
+struct vm_pagequeue {
+ struct mtx pq_mutex;
+ struct pglist pq_pl;
+ int *const pq_cnt;
+ const char *const pq_name;
+} __aligned(CACHE_LINE_SIZE);
+
+extern struct vm_pagequeue vm_pagequeues[PQ_COUNT];
-extern struct vpgqueues vm_page_queues[PQ_COUNT];
+#define vm_pagequeue_assert_locked(pq) mtx_assert(&(pq)->pq_mutex, MA_OWNED)
+#define vm_pagequeue_init_lock(pq) mtx_init(&(pq)->pq_mutex, \
+ (pq)->pq_name, "vm pagequeue", MTX_DEF | MTX_DUPOK);
+#define vm_pagequeue_lock(pq) mtx_lock(&(pq)->pq_mutex)
+#define vm_pagequeue_unlock(pq) mtx_unlock(&(pq)->pq_mutex)
extern struct mtx_padalign vm_page_queue_free_mtx;
extern struct mtx_padalign pa_lock[];
@@ -316,15 +324,8 @@ extern long first_page; /* first physical page number */
#define VM_PAGE_TO_PHYS(entry) ((entry)->phys_addr)
-vm_page_t vm_phys_paddr_to_vm_page(vm_paddr_t pa);
-
vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa);
-extern struct mtx_padalign vm_page_queue_mtx;
-
-#define vm_page_lock_queues() mtx_lock(&vm_page_queue_mtx)
-#define vm_page_unlock_queues() mtx_unlock(&vm_page_queue_mtx)
-
/* page allocation classes: */
#define VM_ALLOC_NORMAL 0
#define VM_ALLOC_INTERRUPT 1
@@ -344,6 +345,25 @@ extern struct mtx_padalign vm_page_queue_mtx;
#define VM_ALLOC_COUNT_SHIFT 16
#define VM_ALLOC_COUNT(count) ((count) << VM_ALLOC_COUNT_SHIFT)
+#ifdef M_NOWAIT
+static inline int
+malloc2vm_flags(int malloc_flags)
+{
+ int pflags;
+
+ KASSERT((malloc_flags & M_USE_RESERVE) == 0 ||
+ (malloc_flags & M_NOWAIT) != 0,
+ ("M_USE_RESERVE requires M_NOWAIT"));
+ pflags = (malloc_flags & M_USE_RESERVE) != 0 ? VM_ALLOC_INTERRUPT :
+ VM_ALLOC_SYSTEM;
+ if ((malloc_flags & M_ZERO) != 0)
+ pflags |= VM_ALLOC_ZERO;
+ if ((malloc_flags & M_NODUMP) != 0)
+ pflags |= VM_ALLOC_NODUMP;
+ return (pflags);
+}
+#endif
+
void vm_page_busy(vm_page_t m);
void vm_page_flash(vm_page_t m);
void vm_page_io_start(vm_page_t m);
@@ -354,8 +374,6 @@ void vm_page_free(vm_page_t m);
void vm_page_free_zero(vm_page_t m);
void vm_page_wakeup(vm_page_t m);
-void vm_pageq_remove(vm_page_t m);
-
void vm_page_activate (vm_page_t);
vm_page_t vm_page_alloc (vm_object_t, vm_pindex_t, int);
vm_page_t vm_page_alloc_contig(vm_object_t object, vm_pindex_t pindex, int req,
@@ -370,6 +388,8 @@ int vm_page_try_to_cache (vm_page_t);
int vm_page_try_to_free (vm_page_t);
void vm_page_dontneed(vm_page_t);
void vm_page_deactivate (vm_page_t);
+void vm_page_dequeue(vm_page_t m);
+void vm_page_dequeue_locked(vm_page_t m);
vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t);
vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr);
void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr);
@@ -384,6 +404,8 @@ void vm_page_readahead_finish(vm_page_t m);
void vm_page_reference(vm_page_t m);
void vm_page_remove (vm_page_t);
void vm_page_rename (vm_page_t, vm_object_t, vm_pindex_t);
+void vm_page_requeue(vm_page_t m);
+void vm_page_requeue_locked(vm_page_t m);
void vm_page_set_valid_range(vm_page_t m, int base, int size);
void vm_page_sleep(vm_page_t m, const char *msg);
vm_page_t vm_page_splay(vm_pindex_t, vm_page_t);
@@ -512,6 +534,22 @@ vm_page_dirty(vm_page_t m)
}
/*
+ * vm_page_remque:
+ *
+ * If the given page is in a page queue, then remove it from that page
+ * queue.
+ *
+ * The page must be locked.
+ */
+static inline void
+vm_page_remque(vm_page_t m)
+{
+
+ if (m->queue != PQ_NONE)
+ vm_page_dequeue(m);
+}
+
+/*
* vm_page_sleep_if_busy:
*
* Sleep and release the page queues lock if VPO_BUSY is set or,
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index 9f3ea6c..610f6e0 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -218,7 +218,6 @@ static void vm_req_vmdaemon(int req);
#endif
static boolean_t vm_pageout_page_lock(vm_page_t, vm_page_t *);
static void vm_pageout_page_stats(void);
-static void vm_pageout_requeue(vm_page_t m);
/*
* Initialize a dummy page for marking the caller's place in the specified
@@ -255,29 +254,29 @@ static boolean_t
vm_pageout_fallback_object_lock(vm_page_t m, vm_page_t *next)
{
struct vm_page marker;
+ struct vm_pagequeue *pq;
boolean_t unchanged;
u_short queue;
vm_object_t object;
queue = m->queue;
vm_pageout_init_marker(&marker, queue);
+ pq = &vm_pagequeues[queue];
object = m->object;
- TAILQ_INSERT_AFTER(&vm_page_queues[queue].pl,
- m, &marker, pageq);
- vm_page_unlock_queues();
+ TAILQ_INSERT_AFTER(&pq->pq_pl, m, &marker, pageq);
+ vm_pagequeue_unlock(pq);
vm_page_unlock(m);
VM_OBJECT_LOCK(object);
vm_page_lock(m);
- vm_page_lock_queues();
+ vm_pagequeue_lock(pq);
/* Page queue might have changed. */
*next = TAILQ_NEXT(&marker, pageq);
unchanged = (m->queue == queue &&
m->object == object &&
&marker == TAILQ_NEXT(m, pageq));
- TAILQ_REMOVE(&vm_page_queues[queue].pl,
- &marker, pageq);
+ TAILQ_REMOVE(&pq->pq_pl, &marker, pageq);
return (unchanged);
}
@@ -294,27 +293,27 @@ static boolean_t
vm_pageout_page_lock(vm_page_t m, vm_page_t *next)
{
struct vm_page marker;
+ struct vm_pagequeue *pq;
boolean_t unchanged;
u_short queue;
vm_page_lock_assert(m, MA_NOTOWNED);
- mtx_assert(&vm_page_queue_mtx, MA_OWNED);
-
if (vm_page_trylock(m))
return (TRUE);
queue = m->queue;
vm_pageout_init_marker(&marker, queue);
+ pq = &vm_pagequeues[queue];
- TAILQ_INSERT_AFTER(&vm_page_queues[queue].pl, m, &marker, pageq);
- vm_page_unlock_queues();
+ TAILQ_INSERT_AFTER(&pq->pq_pl, m, &marker, pageq);
+ vm_pagequeue_unlock(pq);
vm_page_lock(m);
- vm_page_lock_queues();
+ vm_pagequeue_lock(pq);
/* Page queue might have changed. */
*next = TAILQ_NEXT(&marker, pageq);
unchanged = (m->queue == queue && &marker == TAILQ_NEXT(m, pageq));
- TAILQ_REMOVE(&vm_page_queues[queue].pl, &marker, pageq);
+ TAILQ_REMOVE(&pq->pq_pl, &marker, pageq);
return (unchanged);
}
@@ -565,13 +564,15 @@ static boolean_t
vm_pageout_launder(int queue, int tries, vm_paddr_t low, vm_paddr_t high)
{
struct mount *mp;
+ struct vm_pagequeue *pq;
struct vnode *vp;
vm_object_t object;
vm_paddr_t pa;
vm_page_t m, m_tmp, next;
- vm_page_lock_queues();
- TAILQ_FOREACH_SAFE(m, &vm_page_queues[queue].pl, pageq, next) {
+ pq = &vm_pagequeues[queue];
+ vm_pagequeue_lock(pq);
+ TAILQ_FOREACH_SAFE(m, &pq->pq_pl, pageq, next) {
KASSERT(m->queue == queue,
("vm_pageout_launder: page %p's queue is not %d", m,
queue));
@@ -603,7 +604,7 @@ vm_pageout_launder(int queue, int tries, vm_paddr_t low, vm_paddr_t high)
continue;
}
if (object->type == OBJT_VNODE) {
- vm_page_unlock_queues();
+ vm_pagequeue_unlock(pq);
vp = object->handle;
vm_object_reference_locked(object);
VM_OBJECT_UNLOCK(object);
@@ -618,7 +619,7 @@ vm_pageout_launder(int queue, int tries, vm_paddr_t low, vm_paddr_t high)
return (TRUE);
} else if (object->type == OBJT_SWAP ||
object->type == OBJT_DEFAULT) {
- vm_page_unlock_queues();
+ vm_pagequeue_unlock(pq);
m_tmp = m;
vm_pageout_flush(&m_tmp, 1, VM_PAGER_PUT_SYNC,
0, NULL, NULL);
@@ -626,12 +627,17 @@ vm_pageout_launder(int queue, int tries, vm_paddr_t low, vm_paddr_t high)
return (TRUE);
}
} else {
+ /*
+ * Dequeue here to prevent lock recursion in
+ * vm_page_cache().
+ */
+ vm_page_dequeue_locked(m);
vm_page_cache(m);
vm_page_unlock(m);
}
VM_OBJECT_UNLOCK(object);
}
- vm_page_unlock_queues();
+ vm_pagequeue_unlock(pq);
return (FALSE);
}
@@ -745,19 +751,14 @@ vm_pageout_object_deactivate_pages(pmap_t pmap, vm_object_t first_object,
p->act_count == 0)) {
pmap_remove_all(p);
vm_page_deactivate(p);
- } else {
- vm_page_lock_queues();
- vm_pageout_requeue(p);
- vm_page_unlock_queues();
- }
+ } else
+ vm_page_requeue(p);
} else {
vm_page_activate(p);
if (p->act_count < ACT_MAX -
ACT_ADVANCE)
p->act_count += ACT_ADVANCE;
- vm_page_lock_queues();
- vm_pageout_requeue(p);
- vm_page_unlock_queues();
+ vm_page_requeue(p);
}
} else if (p->queue == PQ_INACTIVE)
pmap_remove_all(p);
@@ -853,26 +854,6 @@ vm_pageout_map_deactivate_pages(map, desired)
#endif /* !defined(NO_SWAPPING) */
/*
- * vm_pageout_requeue:
- *
- * Move the specified page to the tail of its present page queue.
- *
- * The page queues must be locked.
- */
-static void
-vm_pageout_requeue(vm_page_t m)
-{
- struct vpgqueues *vpq;
-
- mtx_assert(&vm_page_queue_mtx, MA_OWNED);
- KASSERT(m->queue != PQ_NONE,
- ("vm_pageout_requeue: page %p is not queued", m));
- vpq = &vm_page_queues[m->queue];
- TAILQ_REMOVE(&vpq->pl, m, pageq);
- TAILQ_INSERT_TAIL(&vpq->pl, m, pageq);
-}
-
-/*
* vm_pageout_scan does the dirty work for the pageout daemon.
*/
static void
@@ -880,6 +861,7 @@ vm_pageout_scan(int pass)
{
vm_page_t m, next;
struct vm_page marker;
+ struct vm_pagequeue *pq;
int page_shortage, maxscan, pcount;
int addl_page_shortage;
vm_object_t object;
@@ -888,6 +870,8 @@ vm_pageout_scan(int pass)
int maxlaunder;
boolean_t queues_locked;
+ vm_pageout_init_marker(&marker, PQ_INACTIVE);
+
/*
* Decrease registered cache sizes.
*/
@@ -911,15 +895,7 @@ vm_pageout_scan(int pass)
*/
page_shortage = vm_paging_target() + addl_page_shortage;
- vm_pageout_init_marker(&marker, PQ_INACTIVE);
-
/*
- * Start scanning the inactive queue for pages we can move to the
- * cache or free. The scan will stop when the target is reached or
- * we have scanned the entire inactive queue. Note that m->act_count
- * is not used to form decisions for the inactive queue, only for the
- * active queue.
- *
* maxlaunder limits the number of dirty pages we flush per scan.
* For most systems a smaller value (16 or 32) is more robust under
* extreme memory and disk pressure because any unnecessary writes
@@ -933,18 +909,27 @@ vm_pageout_scan(int pass)
maxlaunder = 1;
if (pass)
maxlaunder = 10000;
- vm_page_lock_queues();
- queues_locked = TRUE;
+
maxscan = cnt.v_inactive_count;
- for (m = TAILQ_FIRST(&vm_page_queues[PQ_INACTIVE].pl);
+ /*
+ * Start scanning the inactive queue for pages we can move to the
+ * cache or free. The scan will stop when the target is reached or
+ * we have scanned the entire inactive queue. Note that m->act_count
+ * is not used to form decisions for the inactive queue, only for the
+ * active queue.
+ */
+ pq = &vm_pagequeues[PQ_INACTIVE];
+ vm_pagequeue_lock(pq);
+ queues_locked = TRUE;
+ for (m = TAILQ_FIRST(&pq->pq_pl);
m != NULL && maxscan-- > 0 && page_shortage > 0;
m = next) {
+ vm_pagequeue_assert_locked(pq);
KASSERT(queues_locked, ("unlocked queues"));
- mtx_assert(&vm_page_queue_mtx, MA_OWNED);
KASSERT(m->queue == PQ_INACTIVE, ("Inactive queue %p", m));
- cnt.v_pdpages++;
+ PCPU_INC(cnt.v_pdpages);
next = TAILQ_NEXT(m, pageq);
/*
@@ -991,13 +976,12 @@ vm_pageout_scan(int pass)
}
/*
- * We unlock vm_page_queue_mtx, invalidating the
+ * We unlock the inactive page queue, invalidating the
* 'next' pointer. Use our marker to remember our
* place.
*/
- TAILQ_INSERT_AFTER(&vm_page_queues[PQ_INACTIVE].pl,
- m, &marker, pageq);
- vm_page_unlock_queues();
+ TAILQ_INSERT_AFTER(&pq->pq_pl, m, &marker, pageq);
+ vm_pagequeue_unlock(pq);
queues_locked = FALSE;
/*
@@ -1098,9 +1082,9 @@ vm_pageout_scan(int pass)
* the thrash point for a heavily loaded machine.
*/
m->flags |= PG_WINATCFLS;
- vm_page_lock_queues();
+ vm_pagequeue_lock(pq);
queues_locked = TRUE;
- vm_pageout_requeue(m);
+ vm_page_requeue_locked(m);
} else if (maxlaunder > 0) {
/*
* We always want to try to flush some dirty pages if
@@ -1127,11 +1111,11 @@ vm_pageout_scan(int pass)
* Those objects are in a "rundown" state.
*/
if (!swap_pageouts_ok || (object->flags & OBJ_DEAD)) {
- vm_page_lock_queues();
+ vm_pagequeue_lock(pq);
vm_page_unlock(m);
VM_OBJECT_UNLOCK(object);
queues_locked = TRUE;
- vm_pageout_requeue(m);
+ vm_page_requeue_locked(m);
goto relock_queues;
}
@@ -1184,7 +1168,7 @@ vm_pageout_scan(int pass)
}
VM_OBJECT_LOCK(object);
vm_page_lock(m);
- vm_page_lock_queues();
+ vm_pagequeue_lock(pq);
queues_locked = TRUE;
/*
* The page might have been moved to another
@@ -1218,12 +1202,12 @@ vm_pageout_scan(int pass)
*/
if (m->hold_count) {
vm_page_unlock(m);
- vm_pageout_requeue(m);
+ vm_page_requeue_locked(m);
if (object->flags & OBJ_MIGHTBEDIRTY)
vnodes_skipped++;
goto unlock_and_continue;
}
- vm_page_unlock_queues();
+ vm_pagequeue_unlock(pq);
queues_locked = FALSE;
}
@@ -1246,7 +1230,7 @@ unlock_and_continue:
VM_OBJECT_UNLOCK(object);
if (mp != NULL) {
if (queues_locked) {
- vm_page_unlock_queues();
+ vm_pagequeue_unlock(pq);
queues_locked = FALSE;
}
if (vp != NULL)
@@ -1261,13 +1245,13 @@ unlock_and_continue:
VM_OBJECT_UNLOCK(object);
relock_queues:
if (!queues_locked) {
- vm_page_lock_queues();
+ vm_pagequeue_lock(pq);
queues_locked = TRUE;
}
next = TAILQ_NEXT(&marker, pageq);
- TAILQ_REMOVE(&vm_page_queues[PQ_INACTIVE].pl,
- &marker, pageq);
+ TAILQ_REMOVE(&pq->pq_pl, &marker, pageq);
}
+ vm_pagequeue_unlock(pq);
/*
* Compute the number of pages we want to try to move from the
@@ -1283,9 +1267,9 @@ relock_queues:
* deactivation candidates.
*/
pcount = cnt.v_active_count;
- m = TAILQ_FIRST(&vm_page_queues[PQ_ACTIVE].pl);
- mtx_assert(&vm_page_queue_mtx, MA_OWNED);
-
+ pq = &vm_pagequeues[PQ_ACTIVE];
+ vm_pagequeue_lock(pq);
+ m = TAILQ_FIRST(&pq->pq_pl);
while ((m != NULL) && (pcount-- > 0) && (page_shortage > 0)) {
KASSERT(m->queue == PQ_ACTIVE,
@@ -1322,7 +1306,7 @@ relock_queues:
(m->hold_count != 0)) {
vm_page_unlock(m);
VM_OBJECT_UNLOCK(object);
- vm_pageout_requeue(m);
+ vm_page_requeue_locked(m);
m = next;
continue;
}
@@ -1331,7 +1315,7 @@ relock_queues:
* The count for pagedaemon pages is done after checking the
* page for eligibility...
*/
- cnt.v_pdpages++;
+ PCPU_INC(cnt.v_pdpages);
/*
* Check to see "how much" the page has been used.
@@ -1358,14 +1342,16 @@ relock_queues:
* Only if an object is currently being used, do we use the
* page activation count stats.
*/
- if (actcount && (object->ref_count != 0)) {
- vm_pageout_requeue(m);
- } else {
+ if (actcount != 0 && object->ref_count != 0)
+ vm_page_requeue_locked(m);
+ else {
m->act_count -= min(m->act_count, ACT_DECLINE);
if (vm_pageout_algorithm ||
object->ref_count == 0 ||
m->act_count == 0) {
page_shortage--;
+ /* Dequeue to avoid later lock recursion. */
+ vm_page_dequeue_locked(m);
if (object->ref_count == 0) {
KASSERT(!pmap_page_is_mapped(m),
("vm_pageout_scan: page %p is mapped", m));
@@ -1376,15 +1362,14 @@ relock_queues:
} else {
vm_page_deactivate(m);
}
- } else {
- vm_pageout_requeue(m);
- }
+ } else
+ vm_page_requeue_locked(m);
}
vm_page_unlock(m);
VM_OBJECT_UNLOCK(object);
m = next;
}
- vm_page_unlock_queues();
+ vm_pagequeue_unlock(pq);
#if !defined(NO_SWAPPING)
/*
* Idle process swapout -- run once per second.
@@ -1529,6 +1514,7 @@ vm_pageout_oom(int shortage)
static void
vm_pageout_page_stats()
{
+ struct vm_pagequeue *pq;
vm_object_t object;
vm_page_t m,next;
int pcount,tpcount; /* Number of pages to check */
@@ -1542,7 +1528,6 @@ vm_pageout_page_stats()
if (page_shortage <= 0)
return;
- vm_page_lock_queues();
pcount = cnt.v_active_count;
fullintervalcount += vm_pageout_stats_interval;
if (fullintervalcount < vm_pageout_full_stats_interval) {
@@ -1554,7 +1539,9 @@ vm_pageout_page_stats()
fullintervalcount = 0;
}
- m = TAILQ_FIRST(&vm_page_queues[PQ_ACTIVE].pl);
+ pq = &vm_pagequeues[PQ_ACTIVE];
+ vm_pagequeue_lock(pq);
+ m = TAILQ_FIRST(&pq->pq_pl);
while ((m != NULL) && (pcount-- > 0)) {
int actcount;
@@ -1589,7 +1576,7 @@ vm_pageout_page_stats()
(m->hold_count != 0)) {
vm_page_unlock(m);
VM_OBJECT_UNLOCK(object);
- vm_pageout_requeue(m);
+ vm_page_requeue_locked(m);
m = next;
continue;
}
@@ -1605,7 +1592,7 @@ vm_pageout_page_stats()
m->act_count += ACT_ADVANCE + actcount;
if (m->act_count > ACT_MAX)
m->act_count = ACT_MAX;
- vm_pageout_requeue(m);
+ vm_page_requeue_locked(m);
} else {
if (m->act_count == 0) {
/*
@@ -1618,17 +1605,19 @@ vm_pageout_page_stats()
* of doing the operation.
*/
pmap_remove_all(m);
+ /* Dequeue to avoid later lock recursion. */
+ vm_page_dequeue_locked(m);
vm_page_deactivate(m);
} else {
m->act_count -= min(m->act_count, ACT_DECLINE);
- vm_pageout_requeue(m);
+ vm_page_requeue_locked(m);
}
}
vm_page_unlock(m);
VM_OBJECT_UNLOCK(object);
m = next;
}
- vm_page_unlock_queues();
+ vm_pagequeue_unlock(pq);
}
/*
diff --git a/sys/vm/vm_phys.h b/sys/vm/vm_phys.h
index 902659b..7b7b33b 100644
--- a/sys/vm/vm_phys.h
+++ b/sys/vm/vm_phys.h
@@ -64,6 +64,7 @@ vm_page_t vm_phys_fictitious_to_vm_page(vm_paddr_t pa);
void vm_phys_free_contig(vm_page_t m, u_long npages);
void vm_phys_free_pages(vm_page_t m, int order);
void vm_phys_init(void);
+vm_page_t vm_phys_paddr_to_vm_page(vm_paddr_t pa);
void vm_phys_set_pool(int pool, vm_page_t m, int order);
boolean_t vm_phys_unfree_page(vm_page_t m);
boolean_t vm_phys_zero_pages_idle(void);
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index 7125018..018596c 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -133,6 +133,7 @@ OLD_FILES+=usr/share/man/man3/atf-sh-api.3.gz
OLD_FILES+=usr/share/man/man4/atf-test-case.4.gz
OLD_FILES+=usr/share/man/man5/atf-formats.5.gz
OLD_FILES+=usr/share/man/man7/atf.7.gz
+OLD_FILES+=usr/share/mk/atf.test.mk
OLD_DIRS+=usr/share/xml/atf
OLD_FILES+=usr/share/xml/atf/tests-results.dtd
OLD_DIRS+=usr/share/xsl/atf
diff --git a/usr.bin/bc/bc.y b/usr.bin/bc/bc.y
index f7425f2..a802f5a 100644
--- a/usr.bin/bc/bc.y
+++ b/usr.bin/bc/bc.y
@@ -1084,7 +1084,7 @@ escape(const char *str)
}
/* ARGSUSED */
-void
+static void
sigchld(int signo)
{
pid_t pid;
diff --git a/usr.bin/bmake/Makefile b/usr.bin/bmake/Makefile
index 44ce56f..7ae5e5f 100644
--- a/usr.bin/bmake/Makefile
+++ b/usr.bin/bmake/Makefile
@@ -13,7 +13,7 @@ CFLAGS+= -I${.CURDIR}
# $NetBSD: Makefile,v 1.56 2012/05/30 21:54:23 sjg Exp $
# @(#)Makefile 5.2 (Berkeley) 12/28/90
-# $Id: Makefile.in,v 1.174 2012/10/10 18:46:24 sjg Exp $
+# $Id: Makefile.in,v 1.178 2012/11/15 16:48:59 sjg Exp $
PROG?= ${.CURDIR:T}
SRCS= arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \
@@ -33,7 +33,7 @@ srcdir= ${SRCTOP}/contrib/bmake
CC?= gcc
# Base version on src date
-MAKE_VERSION= 20121010
+MAKE_VERSION= 20121111
DEFAULT_SYS_PATH = .../share/mk:/usr/share/mk
CPPFLAGS+=
diff --git a/usr.bin/bmake/Makefile.inc b/usr.bin/bmake/Makefile.inc
index 4b126c7..c8ca110 100644
--- a/usr.bin/bmake/Makefile.inc
+++ b/usr.bin/bmake/Makefile.inc
@@ -11,4 +11,8 @@
PROG= make
.endif
+.if ${MK_SHARED_TOOLCHAIN} == "no"
+NO_SHARED?= YES
+.endif
+
WARNS=3
diff --git a/usr.bin/bmake/unit-tests/Makefile b/usr.bin/bmake/unit-tests/Makefile
index c22dbc5..89c7fe0 100644
--- a/usr.bin/bmake/unit-tests/Makefile
+++ b/usr.bin/bmake/unit-tests/Makefile
@@ -5,9 +5,9 @@
SRCTOP?= ${.CURDIR:H:H:H}
-# $Id: Makefile.in,v 1.38 2012/06/19 23:38:48 sjg Exp $
+# $Id: Makefile.in,v 1.39 2012/11/09 19:16:10 sjg Exp $
#
-# $NetBSD: Makefile,v 1.34 2012/06/19 23:25:53 sjg Exp $
+# $NetBSD: Makefile,v 1.35 2012/11/09 19:08:28 sjg Exp $
#
# Unit tests for make(1)
# The main targets are:
@@ -47,6 +47,7 @@ SUBFILES= \
modorder \
modts \
modword \
+ order \
phony-end \
posix \
qequals \
@@ -59,6 +60,7 @@ SUBFILES= \
all: ${SUBFILES}
flags.doterror=
+flags.order=-j1
# the tests are actually done with sub-makes.
.PHONY: ${SUBFILES}
diff --git a/usr.bin/chpass/chpass.c b/usr.bin/chpass/chpass.c
index 2504e68..9f9be53 100644
--- a/usr.bin/chpass/chpass.c
+++ b/usr.bin/chpass/chpass.c
@@ -241,8 +241,11 @@ main(int argc, char *argv[])
#ifdef YP
case _PWF_NIS:
ypclnt = ypclnt_new(yp_domain, "passwd.byname", yp_host);
- if (ypclnt == NULL ||
- ypclnt_connect(ypclnt) == -1 ||
+ if (ypclnt == NULL) {
+ warnx("ypclnt_new failed");
+ exit(1);
+ }
+ if (ypclnt_connect(ypclnt) == -1 ||
ypclnt_passwd(ypclnt, pw, password) == -1) {
warnx("%s", ypclnt->error);
ypclnt_free(ypclnt);
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index 3e897d7..336df97 100644
--- a/usr.bin/fetch/fetch.c
+++ b/usr.bin/fetch/fetch.c
@@ -115,11 +115,13 @@ sig_handler(int sig)
struct xferstat {
char name[64];
- struct timeval start;
- struct timeval last;
- off_t size;
- off_t offset;
- off_t rcvd;
+ struct timeval start; /* start of transfer */
+ struct timeval last; /* time of last update */
+ struct timeval last2; /* time of previous last update */
+ off_t size; /* size of file per HTTP hdr */
+ off_t offset; /* starting offset in file */
+ off_t rcvd; /* bytes already received */
+ off_t lastrcvd; /* bytes received since last update */
};
/*
@@ -139,9 +141,12 @@ stat_eta(struct xferstat *xs)
if (eta > 3600)
snprintf(str, sizeof str, "%02ldh%02ldm",
eta / 3600, (eta % 3600) / 60);
- else
+ else if (eta > 0)
snprintf(str, sizeof str, "%02ldm%02lds",
eta / 60, eta % 60);
+ else
+ snprintf(str, sizeof str, "%02ldm%02lds",
+ elapsed / 60, elapsed % 60);
return (str);
}
@@ -173,11 +178,12 @@ stat_bps(struct xferstat *xs)
double delta, bps;
delta = (xs->last.tv_sec + (xs->last.tv_usec / 1.e6))
- - (xs->start.tv_sec + (xs->start.tv_usec / 1.e6));
+ - (xs->last2.tv_sec + (xs->last2.tv_usec / 1.e6));
+
if (delta == 0.0) {
snprintf(str, sizeof str, "?? Bps");
} else {
- bps = (xs->rcvd - xs->offset) / delta;
+ bps = (xs->rcvd - xs->lastrcvd - xs->offset) / delta;
snprintf(str, sizeof str, "%sps", stat_bytes((off_t)bps));
}
return (str);
@@ -200,6 +206,7 @@ stat_display(struct xferstat *xs, int force)
gettimeofday(&now, NULL);
if (!force && now.tv_sec <= xs->last.tv_sec)
return;
+ xs->last2 = xs->last;
xs->last = now;
fprintf(stderr, "\r%-46.46s", xs->name);
@@ -214,10 +221,16 @@ stat_display(struct xferstat *xs, int force)
(int)((100.0 * xs->rcvd) / xs->size),
stat_bytes(xs->size));
}
+ if (force == 2) {
+ xs->lastrcvd = xs->offset;
+ xs->last2 = xs->start;
+ }
fprintf(stderr, " %s", stat_bps(xs));
- if (xs->size > 0 && xs->rcvd > 0 &&
- xs->last.tv_sec >= xs->start.tv_sec + 10)
+ if ((xs->size > 0 && xs->rcvd > 0 &&
+ xs->last.tv_sec >= xs->start.tv_sec + 3) ||
+ force == 2)
fprintf(stderr, " %s", stat_eta(xs));
+ xs->lastrcvd = xs->rcvd;
}
/*
@@ -232,6 +245,7 @@ stat_start(struct xferstat *xs, const char *name, off_t size, off_t offset)
xs->size = size;
xs->offset = offset;
xs->rcvd = offset;
+ xs->lastrcvd = offset;
if (v_tty && v_level > 0)
stat_display(xs, 1);
else if (v_level > 0)
@@ -257,7 +271,7 @@ stat_end(struct xferstat *xs)
{
gettimeofday(&xs->last, NULL);
if (v_tty && v_level > 0) {
- stat_display(xs, 1);
+ stat_display(xs, 2);
putc('\n', stderr);
} else if (v_level > 0) {
fprintf(stderr, " %s %s\n",
diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c
index d74b979..77ae522 100644
--- a/usr.bin/ktrdump/ktrdump.c
+++ b/usr.bin/ktrdump/ktrdump.c
@@ -86,6 +86,7 @@ main(int ac, char **av)
u_long parms[KTR_PARMS];
struct ktr_entry *buf;
uintmax_t tlast, tnow;
+ unsigned long bufptr;
struct stat sb;
kvm_t *kd;
FILE *out;
@@ -179,8 +180,9 @@ main(int ac, char **av)
if ((buf = malloc(sizeof(*buf) * entries)) == NULL)
err(1, NULL);
if (kvm_read(kd, nl[2].n_value, &index, sizeof(index)) == -1 ||
- kvm_read(kd, nl[3].n_value, buf, sizeof(*buf) * entries)
- == -1)
+ kvm_read(kd, nl[3].n_value, &bufptr,
+ sizeof(bufptr)) == -1 ||
+ kvm_read(kd, bufptr, buf, sizeof(*buf) * entries) == -1)
errx(1, "%s", kvm_geterr(kd));
}
diff --git a/usr.bin/ministat/ministat.1 b/usr.bin/ministat/ministat.1
index 88d5324..ea31c23 100644
--- a/usr.bin/ministat/ministat.1
+++ b/usr.bin/ministat/ministat.1
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 28, 2010
+.Dd November 10, 2012
.Dt MINISTAT 1
.Os
.Sh NAME
@@ -33,7 +33,7 @@
.Nd statistics utility
.Sh SYNOPSIS
.Nm
-.Op Fl ns
+.Op Fl Ans
.Op Fl C Ar column
.Op Fl c Ar confidence_level
.Op Fl d Ar delimiter
@@ -47,6 +47,9 @@ in the specified files or, if no file is specified, standard input.
.Pp
The options are as follows:
.Bl -tag -width Fl
+.It Fl A
+Just report the statistics of the input and relative comparisons,
+suppress the ASCII-art plot.
.It Fl n
Just report the raw statistics of the input, suppress the ASCII-art plot
and the relative comparisons.
diff --git a/usr.bin/ministat/ministat.c b/usr.bin/ministat/ministat.c
index 3b51e40..218715c 100644
--- a/usr.bin/ministat/ministat.c
+++ b/usr.bin/ministat/ministat.c
@@ -509,7 +509,7 @@ usage(char const *whine)
fprintf(stderr, "%s\n", whine);
fprintf(stderr,
- "Usage: ministat [-C column] [-c confidence] [-d delimiter(s)] [-ns] [-w width] [file [file ...]]\n");
+ "Usage: ministat [-C column] [-c confidence] [-d delimiter(s)] [-Ans] [-w width] [file [file ...]]\n");
fprintf(stderr, "\tconfidence = {");
for (i = 0; i < NCONF; i++) {
fprintf(stderr, "%s%g%%",
@@ -517,6 +517,7 @@ usage(char const *whine)
studentpct[i]);
}
fprintf(stderr, "}\n");
+ fprintf(stderr, "\t-A : print statistics only. suppress the graph.\n");
fprintf(stderr, "\t-C : column number to extract (starts and defaults to 1)\n");
fprintf(stderr, "\t-d : delimiter(s) string, default to \" \\t\"\n");
fprintf(stderr, "\t-n : print summary statistics only, no graph/test\n");
@@ -538,6 +539,7 @@ main(int argc, char **argv)
int flag_s = 0;
int flag_n = 0;
int termwidth = 74;
+ int suppress_plot = 0;
if (isatty(STDOUT_FILENO)) {
struct winsize wsz;
@@ -550,8 +552,11 @@ main(int argc, char **argv)
}
ci = -1;
- while ((c = getopt(argc, argv, "C:c:d:snw:")) != -1)
+ while ((c = getopt(argc, argv, "AC:c:d:snw:")) != -1)
switch (c) {
+ case 'A':
+ suppress_plot = 1;
+ break;
case 'C':
column = strtol(optarg, &p, 10);
if (p != NULL && *p != '\0')
@@ -610,7 +615,7 @@ main(int argc, char **argv)
for (i = 0; i < nds; i++)
printf("%c %s\n", symbol[i+1], ds[i]->name);
- if (!flag_n) {
+ if (!flag_n && !suppress_plot) {
SetupPlot(termwidth, flag_s, nds);
for (i = 0; i < nds; i++)
DimPlot(ds[i]);
diff --git a/usr.bin/mkcsmapper/Makefile.inc b/usr.bin/mkcsmapper/Makefile.inc
index ca8a675..e0acc9b 100644
--- a/usr.bin/mkcsmapper/Makefile.inc
+++ b/usr.bin/mkcsmapper/Makefile.inc
@@ -1,7 +1,11 @@
# $FreeBSD$
+.include <bsd.compiler.mk>
+
SRCS+= lex.l yacc.y
CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../mkcsmapper \
-I${.CURDIR}/../../lib/libc/iconv \
- -I${.CURDIR}/../../lib/libiconv_modules/mapper_std \
- --param max-inline-insns-single=64
+ -I${.CURDIR}/../../lib/libiconv_modules/mapper_std
+.if ${COMPILER_TYPE} == "gcc"
+CFLAGS+= --param max-inline-insns-single=64
+.endif
diff --git a/usr.bin/ssh-copy-id/ssh-copy-id.1 b/usr.bin/ssh-copy-id/ssh-copy-id.1
index caefe5c..2c95d5a 100644
--- a/usr.bin/ssh-copy-id/ssh-copy-id.1
+++ b/usr.bin/ssh-copy-id/ssh-copy-id.1
@@ -73,6 +73,9 @@ The remaining arguments are a list of remote hosts to connect to,
each one optionally qualified by a user name.
.Sh EXIT STATUS
.Ex -std
+.Sh EXAMPLES
+To send a specific key to multiple hosts:
+.Dl $ ssh-copy-id -i /path/to/keyfile.pub user@host1 user@host2 user@host3
.Sh HISTORY
The
.Nm
diff --git a/usr.sbin/bsdconfig/bsdconfig b/usr.sbin/bsdconfig/bsdconfig
index f80e5a9..8d8245a 100755
--- a/usr.sbin/bsdconfig/bsdconfig
+++ b/usr.sbin/bsdconfig/bsdconfig
@@ -202,6 +202,16 @@ dialog_menu_main()
############################################################ MAIN
#
+# If $0 is not "bsdconfig", interpret it as a keyword to a menuitem
+#
+if [ "$pgm" != "bsdconfig" ] &&
+ indexfile=$( f_index_file "$pgm" ) &&
+ cmd=$( f_index_menusel_command "$indexfile" "$pgm" )
+then
+ exec "$cmd" "$@" || exit 1
+fi
+
+#
# Process command-line arguments
#
while getopts hSX flag; do
@@ -244,51 +254,18 @@ if [ "$1" ]; then
esac
#
- # Find the INDEX (possibly i18n) claiming this keyword
+ # Find the INDEX (possibly i18n) claiming this keyword and get the
+ # command to execute from the menu_selection line.
#
- lang="${LANG:-$LC_ALL}"
- if [ "$lang" ]; then
- sel=$( grep "^menu_selection=\"$1|" */INDEX.$lang \
- 2> /dev/null | tail -1 )
-
- # Fall-back to non-i18n sources if nothing was found
- [ "$sel" ] ||
- sel=$( grep "^menu_selection=\"$1|" */INDEX | tail -1 )
- else
- sel=$( grep "^menu_selection=\"$1|" */INDEX | tail -1 )
- fi
-
- #
- # If no matches, display usage (which shows valid keywords)
- #
- if [ ! "$sel" ]; then
+ if ! { indexfile=$( f_index_file "$1" ) &&
+ cmd=$( f_index_menusel_command "$indexfile" "$1" )
+ }; then
+ # no matches, display usage (which shows valid keywords)
f_err "%s: %s: $msg_not_found\n" "$pgm" "$1"
usage
fi
- #
- # The command to execute is after the pipe-character (|) in the
- # menu_selection property of the INDEX file for the menuitem.
- #
- cmd="${sel#*|}"
- cmd="${cmd%\"}"
- if [ ! "$cmd" ]; then
- echo "$pgm: $1: $msg_not_found"
- usage
- fi
shift
-
- #
- # If the command pathname is not fully qualified fix-up/force to be
- # relative to the menuitem directory.
- #
- case "$cmd" in
- /*) : already fully qualified ;;
- *)
- dir="${sel%%/*}"
- cmd="$dir/$cmd"
- esac
-
exec $cmd ${USE_XDIALOG:+-X} "$@" || exit 1
fi
diff --git a/usr.sbin/bsdconfig/console/console b/usr.sbin/bsdconfig/console/console
index 73d9f5b..8cf12b6 100755
--- a/usr.sbin/bsdconfig/console/console
+++ b/usr.sbin/bsdconfig/console/console
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/console/font b/usr.sbin/bsdconfig/console/font
index 2fe4611..5346dd2 100755
--- a/usr.sbin/bsdconfig/console/font
+++ b/usr.sbin/bsdconfig/console/font
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/console/keymap b/usr.sbin/bsdconfig/console/keymap
index ea1de2d..98a253c 100755
--- a/usr.sbin/bsdconfig/console/keymap
+++ b/usr.sbin/bsdconfig/console/keymap
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/console/repeat b/usr.sbin/bsdconfig/console/repeat
index 76d60d1..820b0b4 100755
--- a/usr.sbin/bsdconfig/console/repeat
+++ b/usr.sbin/bsdconfig/console/repeat
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/console/saver b/usr.sbin/bsdconfig/console/saver
index 0ec332c..5313265 100755
--- a/usr.sbin/bsdconfig/console/saver
+++ b/usr.sbin/bsdconfig/console/saver
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/console/screenmap b/usr.sbin/bsdconfig/console/screenmap
index bdabe6a..99fa7ad 100755
--- a/usr.sbin/bsdconfig/console/screenmap
+++ b/usr.sbin/bsdconfig/console/screenmap
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/console/ttys b/usr.sbin/bsdconfig/console/ttys
index fcf45ef..2d39a4c 100755
--- a/usr.sbin/bsdconfig/console/ttys
+++ b/usr.sbin/bsdconfig/console/ttys
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="080.console"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/diskmgmt/diskmgmt b/usr.sbin/bsdconfig/diskmgmt/diskmgmt
index aab901f..9cb5e09 100755
--- a/usr.sbin/bsdconfig/diskmgmt/diskmgmt
+++ b/usr.sbin/bsdconfig/diskmgmt/diskmgmt
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="050.diskmgmt"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/docsinstall/docsinstall b/usr.sbin/bsdconfig/docsinstall/docsinstall
index d6fe2d2..00aff61 100755
--- a/usr.sbin/bsdconfig/docsinstall/docsinstall
+++ b/usr.sbin/bsdconfig/docsinstall/docsinstall
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="020.docsinstall"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/dot/dot b/usr.sbin/bsdconfig/dot/dot
index 1a90324..77a34a1 100755
--- a/usr.sbin/bsdconfig/dot/dot
+++ b/usr.sbin/bsdconfig/dot/dot
@@ -35,7 +35,7 @@ BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="dot"
f_include_lang $BSDCFG_LIBE/include/messages.subr
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/mouse/disable b/usr.sbin/bsdconfig/mouse/disable
index 099cf31..d49cb50 100755
--- a/usr.sbin/bsdconfig/mouse/disable
+++ b/usr.sbin/bsdconfig/mouse/disable
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/mouse/enable b/usr.sbin/bsdconfig/mouse/enable
index e1cf796..6f3d5ac 100755
--- a/usr.sbin/bsdconfig/mouse/enable
+++ b/usr.sbin/bsdconfig/mouse/enable
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/mouse/flags b/usr.sbin/bsdconfig/mouse/flags
index c989048..21478de 100755
--- a/usr.sbin/bsdconfig/mouse/flags
+++ b/usr.sbin/bsdconfig/mouse/flags
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/mouse/mouse b/usr.sbin/bsdconfig/mouse/mouse
index 911ea95..17cd846 100755
--- a/usr.sbin/bsdconfig/mouse/mouse
+++ b/usr.sbin/bsdconfig/mouse/mouse
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/mouse/port b/usr.sbin/bsdconfig/mouse/port
index 4ab54a7..e14bf0a 100755
--- a/usr.sbin/bsdconfig/mouse/port
+++ b/usr.sbin/bsdconfig/mouse/port
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/mouse/type b/usr.sbin/bsdconfig/mouse/type
index f1e88fb..e4f99be 100755
--- a/usr.sbin/bsdconfig/mouse/type
+++ b/usr.sbin/bsdconfig/mouse/type
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/networking/defaultrouter b/usr.sbin/bsdconfig/networking/defaultrouter
index c2375b3..cc9902d 100755
--- a/usr.sbin/bsdconfig/networking/defaultrouter
+++ b/usr.sbin/bsdconfig/networking/defaultrouter
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/networking/routing.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/networking/devices b/usr.sbin/bsdconfig/networking/devices
index c7c550f..1386e01 100755
--- a/usr.sbin/bsdconfig/networking/devices
+++ b/usr.sbin/bsdconfig/networking/devices
@@ -41,7 +41,7 @@ f_include $BSDCFG_SHARE/networking/netmask.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/networking/hostname b/usr.sbin/bsdconfig/networking/hostname
index 32679b4..db05678 100755
--- a/usr.sbin/bsdconfig/networking/hostname
+++ b/usr.sbin/bsdconfig/networking/hostname
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/networking/hostname.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/networking/nameservers b/usr.sbin/bsdconfig/networking/nameservers
index 13cdf51..c9b3004 100755
--- a/usr.sbin/bsdconfig/networking/nameservers
+++ b/usr.sbin/bsdconfig/networking/nameservers
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/networking/resolv.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/networking/networking b/usr.sbin/bsdconfig/networking/networking
index fe3ce1b..fae5c9f 100755
--- a/usr.sbin/bsdconfig/networking/networking
+++ b/usr.sbin/bsdconfig/networking/networking
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/password/password b/usr.sbin/bsdconfig/password/password
index 7a439e6..c060b50 100755
--- a/usr.sbin/bsdconfig/password/password
+++ b/usr.sbin/bsdconfig/password/password
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/password/password.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="040.password"
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/security/kern_securelevel b/usr.sbin/bsdconfig/security/kern_securelevel
index 1bb89d8..e20e105 100755
--- a/usr.sbin/bsdconfig/security/kern_securelevel
+++ b/usr.sbin/bsdconfig/security/kern_securelevel
@@ -39,7 +39,7 @@ f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
SECURELEVEL_HELPFILE=$BSDCFG_LIBE/$APP_DIR/include/securelevel.hlp
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/security/security b/usr.sbin/bsdconfig/security/security
index 3dd71c5..1a3fefc 100755
--- a/usr.sbin/bsdconfig/security/security
+++ b/usr.sbin/bsdconfig/security/security
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="130.security"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/share/common.subr b/usr.sbin/bsdconfig/share/common.subr
index 46fdc6f..8050939 100644
--- a/usr.sbin/bsdconfig/share/common.subr
+++ b/usr.sbin/bsdconfig/share/common.subr
@@ -271,50 +271,186 @@ f_usage()
exit $FAILURE
}
-# f_index_menu_selection $file $pgm
+# f_index_file $keyword
+#
+# Process all INDEX files known to bsdconfig and return the path to first file
+# containing a menu_selection line with a keyword portion matching $keyword.
+#
+# If $LANG or $LC_ALL (in order of preference, respectively) is set,
+# "INDEX.encoding" files will be searched first.
+#
+# If no file is found, error status is returned along with the NULL string.
+#
+# This function is a two-parter. Below is the awk(1) portion of the function,
+# afterward is the sh(1) function which utilizes the below awk script.
+#
+f_index_file_awk='
+# Variables that should be defined on the invocation line:
+# -v keyword="keyword"
+BEGIN { found = 0 }
+( $0 ~ "^menu_selection=\"" keyword "\\|" ) {
+ print FILENAME
+ found++
+ exit
+}
+END { exit ! found }
+'
+f_index_file()
+{
+ local keyword="$1"
+ local lang="${LANG:-$LC_ALL}"
+
+ f_dprintf "lang=[$lang]"
+
+ if [ "$lang" ]; then
+ awk -v keyword="$keyword" "$f_index_file_awk" \
+ $BSDCFG_LIBE${BSDCFG_LIBE:+/}*/INDEX.$lang &&
+ return
+ # No match, fall-thru to non-i18n sources
+ fi
+ awk -v keyword="$keyword" "$f_index_file_awk" \
+ $BSDCFG_LIBE${BSDCFG_LIBE:+/}*/INDEX
+}
+
+# f_index_menusel_keyword $indexfile $pgm
+#
+# Process $indexfile and return only the keyword portion of the menu_selection
+# line with a command portion matching $pgm.
#
-# Process $file looking for $menu_selection values that correspond to $pgm.
# This function is for internationalization (i18n) mapping of the on-disk
# scriptname ($pgm) into the localized language (given language-specific
-# $file). If $LANG or $LC_ALL (in orderder of preference, respectively) is set,
-# ".encoding" will automatically be appended as a suffix to the provided $file
-# pathname.
+# $indexfile). If $LANG or $LC_ALL (in orderder of preference, respectively) is
+# set, ".encoding" will automatically be appended as a suffix to the provided
+# $indexfile pathname.
#
-# If, within $file, multiple $menu_selection values map to $pgm, only the first
-# one will be returned. If no mapping can be made, the NULL string is returned.
+# If, within $indexfile, multiple $menu_selection values map to $pgm, only the
+# first one will be returned. If no mapping can be made, the NULL string is
+# returned.
#
-# If $file does not exist, error status is returned along with the NULL string.
+# If $indexfile does not exist, error status is returned with NULL.
#
# This function is a two-parter. Below is the awk(1) portion of the function,
# afterward is the sh(1) function which utilizes the below awk script.
#
-f_index_menusel_awk='
+f_index_menusel_keyword_awk='
# Variables that should be defined on the invocation line:
# -v pgm="program_name"
#
-( $0 ~ "^menu_selection=.*\\|" pgm "\"" ) {
- sub(/\|.*/, "")
- sub(/^menu_selection="/, "")
- print
- exit
+BEGIN {
+ prefix = "menu_selection=\""
+ plen = length(prefix)
+ found = 0
}
+{
+ if (!match($0, "^" prefix ".*\\|.*\"")) next
+
+ keyword = command = substr($0, plen + 1, RLENGTH - plen - 1)
+ sub(/^.*\|/, "", command)
+ sub(/\|.*$/, "", keyword)
+
+ if ( command == pgm )
+ {
+ print keyword
+ found++
+ exit
+ }
+}
+END { exit ! found }
'
-f_index_menu_selection()
+f_index_menusel_keyword()
{
- local file="$1" pgm="$2"
+ local indexfile="$1" pgm="$2"
local lang="${LANG:-$LC_ALL}"
f_dprintf "lang=[$lang]"
- if [ -f "$file.$lang" ]; then
- awk -v pgm="$pgm" "$f_index_menusel_awk" "$file.$lang" ||
- exit $FAILURE
- elif [ -f "$file" ]; then
- awk -v pgm="$pgm" "$f_index_menusel_awk" "$file" ||
- exit $FAILURE
+ if [ -f "$indexfile.$lang" ]; then
+ awk -v pgm="$pgm" \
+ "$f_index_menusel_keyword_awk" \
+ "$indexfile.$lang"
+ elif [ -f "$indexfile" ]; then
+ awk -v pgm="$pgm" \
+ "$f_index_menusel_keyword_awk" \
+ "$indexfile"
+ fi
+}
+
+# f_index_menusel_command $indexfile $keyword
+#
+# Process $indexfile and return only the command portion of the menu_selection
+# line with a keyword portion matching $keyword.
+#
+# This function is for mapping [possibly international] keywords into the
+# command to be executed. If $LANG or $LC_ALL (order of preference) is set,
+# ".encoding" will automatically be appended as a suffix to the provided
+# $indexfile pathname.
+#
+# If, within $indexfile, multiple $menu_selection values map to $keyword, only
+# the first one will be returned. If no mapping can be made, the NULL string is
+# returned.
+#
+# If $indexfile doesn't exist, error status is returned with NULL.
+#
+# This function is a two-parter. Below is the awk(1) portion of the function,
+# afterward is the sh(1) function which utilizes the below awk script.
+#
+f_index_menusel_command_awk='
+# Variables that should be defined on the invocation line:
+# -v key="keyword"
+#
+BEGIN {
+ prefix = "menu_selection=\""
+ plen = length(prefix)
+ found = 0
+}
+{
+ if (!match($0, "^" prefix ".*\\|.*\"")) next
+
+ keyword = command = substr($0, plen + 1, RLENGTH - plen - 1)
+ sub(/^.*\|/, "", command)
+ sub(/\|.*$/, "", keyword)
+
+ if ( keyword == key )
+ {
+ print command
+ found++
+ exit
+ }
+}
+END { exit ! found }
+'
+f_index_menusel_command()
+{
+ local indexfile="$1" keyword="$2" command
+ local lang="${LANG:-$LC_ALL}"
+
+ f_dprintf "lang=[$lang]"
+
+ if [ -f "$indexfile.$lang" ]; then
+ command=$( awk -v key="$keyword" \
+ "$f_index_menusel_command_awk" \
+ "$indexfile.$lang" ) || return $FAILURE
+ elif [ -f "$indexfile" ]; then
+ command=$( awk -v key="$keyword" \
+ "$f_index_menusel_command_awk" \
+ "$indexfile" ) || return $FAILURE
else
return $FAILURE
fi
+
+ #
+ # If the command pathname is not fully qualified fix-up/force to be
+ # relative to the $indexfile directory.
+ #
+ case "$command" in
+ /*) : already fully qualified ;;
+ *)
+ local indexdir="${indexfile%/*}"
+ [ "$indexdir" != "$indexfile" ] || indexdir="."
+ command="$indexdir/$command"
+ esac
+
+ echo "$command"
}
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/startup/misc b/usr.sbin/bsdconfig/startup/misc
index 3879c57..6407d08 100755
--- a/usr.sbin/bsdconfig/startup/misc
+++ b/usr.sbin/bsdconfig/startup/misc
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/sysrc.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ GLOBALS
diff --git a/usr.sbin/bsdconfig/startup/rcadd b/usr.sbin/bsdconfig/startup/rcadd
index 8f28840..13e5fb3 100755
--- a/usr.sbin/bsdconfig/startup/rcadd
+++ b/usr.sbin/bsdconfig/startup/rcadd
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/startup/rcconf.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ GLOBALS
diff --git a/usr.sbin/bsdconfig/startup/rcconf b/usr.sbin/bsdconfig/startup/rcconf
index 4fb5859..34454ac 100755
--- a/usr.sbin/bsdconfig/startup/rcconf
+++ b/usr.sbin/bsdconfig/startup/rcconf
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/startup/rcconf.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ GLOBALS
diff --git a/usr.sbin/bsdconfig/startup/rcdelete b/usr.sbin/bsdconfig/startup/rcdelete
index b431d88..8d29f87 100755
--- a/usr.sbin/bsdconfig/startup/rcdelete
+++ b/usr.sbin/bsdconfig/startup/rcdelete
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/startup/rcconf.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ GLOBALS
diff --git a/usr.sbin/bsdconfig/startup/rcedit b/usr.sbin/bsdconfig/startup/rcedit
index c060fcb..fa43291 100755
--- a/usr.sbin/bsdconfig/startup/rcedit
+++ b/usr.sbin/bsdconfig/startup/rcedit
@@ -37,7 +37,7 @@ f_include $BSDCFG_SHARE/startup/rcedit.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/startup/rcvar b/usr.sbin/bsdconfig/startup/rcvar
index b7a5229..8097123 100755
--- a/usr.sbin/bsdconfig/startup/rcvar
+++ b/usr.sbin/bsdconfig/startup/rcvar
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/startup/rcvar.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ GLOBALS
diff --git a/usr.sbin/bsdconfig/startup/startup b/usr.sbin/bsdconfig/startup/startup
index c481761..431607c 100755
--- a/usr.sbin/bsdconfig/startup/startup
+++ b/usr.sbin/bsdconfig/startup/startup
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="140.startup"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/bsdconfig/timezone/timezone b/usr.sbin/bsdconfig/timezone/timezone
index 02626a6..7af598a 100755
--- a/usr.sbin/bsdconfig/timezone/timezone
+++ b/usr.sbin/bsdconfig/timezone/timezone
@@ -42,7 +42,7 @@ f_include $BSDCFG_SHARE/timezone/zones.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="090.timezone"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/ttys/ttys b/usr.sbin/bsdconfig/ttys/ttys
index 4e67e2c..545cc1f 100755
--- a/usr.sbin/bsdconfig/ttys/ttys
+++ b/usr.sbin/bsdconfig/ttys/ttys
@@ -36,7 +36,7 @@ f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="150.ttys"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/usermgmt/groupadd b/usr.sbin/bsdconfig/usermgmt/groupadd
index 7326ab3..01fbb1e 100755
--- a/usr.sbin/bsdconfig/usermgmt/groupadd
+++ b/usr.sbin/bsdconfig/usermgmt/groupadd
@@ -35,7 +35,7 @@ f_include $BSDCFG_SHARE/dialog.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/usermgmt/groupdel b/usr.sbin/bsdconfig/usermgmt/groupdel
index cbbe554..5a2f110 100755
--- a/usr.sbin/bsdconfig/usermgmt/groupdel
+++ b/usr.sbin/bsdconfig/usermgmt/groupdel
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/usermgmt/group_input.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/usermgmt/groupedit b/usr.sbin/bsdconfig/usermgmt/groupedit
index 6de6fa8..bb314cf 100755
--- a/usr.sbin/bsdconfig/usermgmt/groupedit
+++ b/usr.sbin/bsdconfig/usermgmt/groupedit
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/usermgmt/group_input.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/usermgmt/groupinput b/usr.sbin/bsdconfig/usermgmt/groupinput
index 2991d33..dc55852 100755
--- a/usr.sbin/bsdconfig/usermgmt/groupinput
+++ b/usr.sbin/bsdconfig/usermgmt/groupinput
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/usermgmt/group_input.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/usermgmt/useradd b/usr.sbin/bsdconfig/usermgmt/useradd
index 4821ccd..cc1b886 100755
--- a/usr.sbin/bsdconfig/usermgmt/useradd
+++ b/usr.sbin/bsdconfig/usermgmt/useradd
@@ -35,7 +35,7 @@ f_include $BSDCFG_SHARE/dialog.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/usermgmt/userdel b/usr.sbin/bsdconfig/usermgmt/userdel
index c530682..e1a26dd 100755
--- a/usr.sbin/bsdconfig/usermgmt/userdel
+++ b/usr.sbin/bsdconfig/usermgmt/userdel
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/usermgmt/user_input.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/usermgmt/useredit b/usr.sbin/bsdconfig/usermgmt/useredit
index a38afa2..40a93a8 100755
--- a/usr.sbin/bsdconfig/usermgmt/useredit
+++ b/usr.sbin/bsdconfig/usermgmt/useredit
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/usermgmt/user_input.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ MAIN
diff --git a/usr.sbin/bsdconfig/usermgmt/userinput b/usr.sbin/bsdconfig/usermgmt/userinput
index aca8aed..0bf8d89 100755
--- a/usr.sbin/bsdconfig/usermgmt/userinput
+++ b/usr.sbin/bsdconfig/usermgmt/userinput
@@ -38,7 +38,7 @@ f_include $BSDCFG_SHARE/usermgmt/user_input.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ CONFIGURATION
diff --git a/usr.sbin/bsdconfig/usermgmt/usermgmt b/usr.sbin/bsdconfig/usermgmt/usermgmt
index a2e4b40..f3357d4 100755
--- a/usr.sbin/bsdconfig/usermgmt/usermgmt
+++ b/usr.sbin/bsdconfig/usermgmt/usermgmt
@@ -39,7 +39,7 @@ f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
USERMGMT_HELPFILE=$BSDCFG_LIBE/$APP_DIR/include/usermgmt.hlp
-ipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
+ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
############################################################ FUNCTIONS
diff --git a/usr.sbin/chkgrp/chkgrp.8 b/usr.sbin/chkgrp/chkgrp.8
index abdaecc..6a57356 100644
--- a/usr.sbin/chkgrp/chkgrp.8
+++ b/usr.sbin/chkgrp/chkgrp.8
@@ -34,6 +34,7 @@
.Nd check the syntax of the group file
.Sh SYNOPSIS
.Nm
+.Op Fl q
.Op Ar groupfile
.Sh DESCRIPTION
The
@@ -47,6 +48,12 @@ contains whitespace, and that the third field (the group ID) is
numeric.
It will also check for invalid characters in the group names
and group members.
+The following options are available:
+.Bl -tag -width indent
+.It Fl q
+This option disables printing of text when the group format
+is correct.
+.El
.Sh FILES
.Bl -tag -width /etc/group -compact
.It Pa /etc/group
diff --git a/usr.sbin/chkgrp/chkgrp.c b/usr.sbin/chkgrp/chkgrp.c
index ac40ed5..c9515b5 100644
--- a/usr.sbin/chkgrp/chkgrp.c
+++ b/usr.sbin/chkgrp/chkgrp.c
@@ -30,15 +30,19 @@
__FBSDID("$FreeBSD$");
#include <err.h>
+#include <errno.h>
#include <ctype.h>
+#include <limits.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <sysexits.h>
static char empty[] = { 0 };
-static void
+static void __dead2
usage(void)
{
fprintf(stderr, "usage: chkgrp [groupfile]\n");
@@ -50,27 +54,35 @@ main(int argc, char *argv[])
{
unsigned int i;
size_t len;
+ int quiet;
+ int ch;
int n = 0, k, e = 0;
char *line, *f[4], *p;
const char *cp, *gfn;
FILE *gf;
- /* check arguments */
- switch (argc) {
- case 1:
- gfn = "/etc/group";
- break;
- case 2:
- gfn = argv[1];
- break;
- default:
- gfn = NULL; /* silence compiler */
- usage();
+ quiet = 0;
+ while ((ch = getopt(argc, argv, "q")) != -1) {
+ switch (ch) {
+ case 'q':
+ quiet = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
}
+ if (optind == argc)
+ gfn = "/etc/group";
+ else if (optind == argc - 1)
+ gfn = argv[optind];
+ else
+ usage();
+
/* open group file */
if ((gf = fopen(gfn, "r")) == NULL)
- err(EX_IOERR, "%s", gfn); /* XXX - is IO_ERR the correct exit code? */
+ err(EX_NOINPUT, "%s", gfn);
/* check line by line */
while (++n) {
@@ -78,7 +90,7 @@ main(int argc, char *argv[])
break;
if (len > 0 && line[len - 1] != '\n') {
warnx("%s: line %d: no newline character", gfn, n);
- e++;
+ e = 1;
}
while (len && isspace(line[len-1]))
len--;
@@ -111,14 +123,14 @@ main(int argc, char *argv[])
warnx("%s: line %d: missing field(s)", gfn, n);
for ( ; k < 4; k++)
f[k] = empty;
- e++;
+ e = 1;
}
for (cp = f[0] ; *cp ; cp++) {
if (!isalnum(*cp) && *cp != '.' && *cp != '_' && *cp != '-' &&
(cp > f[0] || *cp != '+')) {
warnx("%s: line %d: '%c' invalid character", gfn, n, *cp);
- e++;
+ e = 1;
}
}
@@ -126,14 +138,14 @@ main(int argc, char *argv[])
if (!isalnum(*cp) && *cp != '.' && *cp != '_' && *cp != '-' &&
*cp != ',') {
warnx("%s: line %d: '%c' invalid character", gfn, n, *cp);
- e++;
+ e = 1;
}
}
/* check if fourth field ended with a colon */
if (i < len) {
warnx("%s: line %d: too many fields", gfn, n);
- e++;
+ e = 1;
}
/* check that none of the fields contain whitespace */
@@ -141,14 +153,26 @@ main(int argc, char *argv[])
if (strcspn(f[k], " \t") != strlen(f[k])) {
warnx("%s: line %d: field %d contains whitespace",
gfn, n, k+1);
- e++;
+ e = 1;
}
}
/* check that the GID is numeric */
if (strspn(f[2], "0123456789") != strlen(f[2])) {
warnx("%s: line %d: GID is not numeric", gfn, n);
- e++;
+ e = 1;
+ }
+
+ /* check the range of the group id */
+ errno = 0;
+ unsigned long groupid = strtoul(f[2], NULL, 10);
+ if (errno != 0) {
+ warnx("%s: line %d: strtoul failed", gfn, n);
+ }
+ else if (groupid > GID_MAX) {
+ warnx("%s: line %d: group id is too large (> %ju)",
+ gfn, n, (uintmax_t)GID_MAX);
+ e = 1;
}
#if 0
@@ -163,7 +187,7 @@ main(int argc, char *argv[])
/* done */
fclose(gf);
- if (e == 0)
+ if (e == 0 && quiet == 0)
printf("%s is fine\n", gfn);
exit(e ? EX_DATAERR : EX_OK);
}
diff --git a/usr.sbin/ndiscvt/ndiscvt.c b/usr.sbin/ndiscvt/ndiscvt.c
index 3775a33..7636c4c 100644
--- a/usr.sbin/ndiscvt/ndiscvt.c
+++ b/usr.sbin/ndiscvt/ndiscvt.c
@@ -325,6 +325,8 @@ main(int argc, char *argv[])
rewind (fp);
img = calloc(fsize, 1);
n = fread (img, fsize, 1, fp);
+ if (n == 0)
+ err(1, "reading .SYS file '%s' failed", sysfile);
fclose(fp);
OpenPOWER on IntegriCloud