aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/Makefile.ia649
-rw-r--r--usr.sbin/acpi/acpiconf/acpiconf.810
-rw-r--r--usr.sbin/acpi/acpidb/acpidb.82
-rw-r--r--usr.sbin/acpi/acpidump/acpidump.820
-rw-r--r--usr.sbin/adduser/adduser.84
-rw-r--r--usr.sbin/adduser/adduser.conf.52
-rw-r--r--usr.sbin/amd/amd/Makefile2
-rw-r--r--usr.sbin/amd/amq/Makefile2
-rw-r--r--usr.sbin/amd/fixmount/Makefile2
-rw-r--r--usr.sbin/amd/fsinfo/Makefile2
-rw-r--r--usr.sbin/amd/hlfsd/Makefile2
-rw-r--r--usr.sbin/amd/include/Makefile.depend1
-rw-r--r--usr.sbin/amd/mk-amd-map/Makefile2
-rw-r--r--usr.sbin/amd/pawd/Makefile2
-rw-r--r--usr.sbin/amd/wire-test/Makefile2
-rw-r--r--usr.sbin/ancontrol/ancontrol.82
-rw-r--r--usr.sbin/apm/apm.82
-rw-r--r--usr.sbin/apmd/apmd.816
-rw-r--r--usr.sbin/asf/asf.82
-rw-r--r--usr.sbin/bhyve/Makefile2
-rw-r--r--usr.sbin/bhyve/acpi.c2
-rw-r--r--usr.sbin/bhyve/acpi.h1
-rw-r--r--usr.sbin/bhyve/atkbdc.c21
-rw-r--r--usr.sbin/bhyve/bhyve.888
-rw-r--r--usr.sbin/bhyve/bhyverun.c183
-rw-r--r--usr.sbin/bhyve/bhyverun.h4
-rw-r--r--usr.sbin/bhyve/block_if.c49
-rw-r--r--usr.sbin/bhyve/block_if.h2
-rw-r--r--usr.sbin/bhyve/inout.c148
-rw-r--r--usr.sbin/bhyve/inout.h14
-rw-r--r--usr.sbin/bhyve/mem.c9
-rw-r--r--usr.sbin/bhyve/mem.h3
-rw-r--r--usr.sbin/bhyve/mptbl.c3
-rw-r--r--usr.sbin/bhyve/pci_ahci.c6
-rw-r--r--usr.sbin/bhyve/pci_emul.c205
-rw-r--r--usr.sbin/bhyve/pci_emul.h6
-rw-r--r--usr.sbin/bhyve/pci_irq.c349
-rw-r--r--usr.sbin/bhyve/pci_irq.h45
-rw-r--r--usr.sbin/bhyve/pci_lpc.c69
-rw-r--r--usr.sbin/bhyve/pci_lpc.h2
-rw-r--r--usr.sbin/bhyve/pci_virtio_block.c6
-rw-r--r--usr.sbin/bhyve/pm.c29
-rw-r--r--usr.sbin/bhyve/rtc.c15
-rw-r--r--usr.sbin/bhyve/smbiostbl.c13
-rw-r--r--usr.sbin/bhyve/task_switch.c932
-rw-r--r--usr.sbin/bhyve/virtio.c2
-rw-r--r--usr.sbin/bhyve/virtio.h2
-rw-r--r--usr.sbin/bhyvectl/bhyvectl.c83
-rw-r--r--usr.sbin/bhyveload/bhyveload.862
-rw-r--r--usr.sbin/bhyveload/bhyveload.c29
-rw-r--r--usr.sbin/binmiscctl/binmiscctl.88
-rw-r--r--usr.sbin/bluetooth/ath3kfw/ath3kfw.82
-rw-r--r--usr.sbin/bluetooth/bcmfw/bcmfw.82
-rw-r--r--usr.sbin/bluetooth/bt3cfw/bt3cfw.82
-rw-r--r--usr.sbin/bluetooth/bthidcontrol/bthidcontrol.82
-rw-r--r--usr.sbin/bluetooth/bthidd/bthidd.82
-rw-r--r--usr.sbin/bluetooth/hccontrol/hccontrol.82
-rw-r--r--usr.sbin/bluetooth/hcsecd/hcsecd.82
-rw-r--r--usr.sbin/bluetooth/hcsecd/hcsecd.conf.52
-rw-r--r--usr.sbin/bluetooth/hcseriald/hcseriald.82
-rw-r--r--usr.sbin/bluetooth/l2control/l2control.82
-rw-r--r--usr.sbin/bluetooth/l2ping/l2ping.82
-rw-r--r--usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.82
-rw-r--r--usr.sbin/bluetooth/sdpcontrol/sdpcontrol.82
-rw-r--r--usr.sbin/bluetooth/sdpd/sdpd.82
-rw-r--r--usr.sbin/boot0cfg/boot0cfg.82
-rw-r--r--usr.sbin/bootparamd/bootparamd/bootparamd.82
-rw-r--r--usr.sbin/bsdconfig/bsdconfig.82
-rwxr-xr-xusr.sbin/bsdconfig/dot/dot65
-rw-r--r--usr.sbin/bsdconfig/dot/include/messages.subr1
-rw-r--r--usr.sbin/bsdconfig/examples/Makefile2
-rwxr-xr-xusr.sbin/bsdconfig/examples/add_some_packages.sh13
-rwxr-xr-xusr.sbin/bsdconfig/examples/browse_packages_ftp.sh25
-rwxr-xr-xusr.sbin/bsdconfig/examples/browse_packages_http.sh37
-rw-r--r--usr.sbin/bsdconfig/include/messages.subr9
-rw-r--r--usr.sbin/bsdconfig/share/common.subr6
-rw-r--r--usr.sbin/bsdconfig/share/media/common.subr3
-rw-r--r--usr.sbin/bsdconfig/share/media/http.subr7
-rw-r--r--usr.sbin/bsdconfig/share/media/httpproxy.subr2
-rw-r--r--usr.sbin/bsdconfig/share/packages/Makefile2
-rw-r--r--[-rwxr-xr-x]usr.sbin/bsdconfig/share/packages/categories.subr0
-rw-r--r--[-rwxr-xr-x]usr.sbin/bsdconfig/share/packages/index.subr83
-rw-r--r--usr.sbin/bsdconfig/share/packages/musthavepkg.subr87
-rw-r--r--[-rwxr-xr-x]usr.sbin/bsdconfig/share/packages/packages.subr9
-rw-r--r--usr.sbin/bsdinstall/bsdinstall.83
-rw-r--r--usr.sbin/bsdinstall/distextract/Makefile14
-rw-r--r--usr.sbin/bsdinstall/distfetch/Makefile14
-rw-r--r--usr.sbin/bsdinstall/partedit/Makefile14
-rw-r--r--usr.sbin/bsdinstall/partedit/partedit_powerpc.c25
-rw-r--r--usr.sbin/bsdinstall/partedit/partedit_x86.c2
-rw-r--r--usr.sbin/bsdinstall/partedit/sade.85
-rwxr-xr-xusr.sbin/bsdinstall/scripts/mirrorselect1
-rwxr-xr-xusr.sbin/bsdinstall/scripts/zfsboot160
-rw-r--r--usr.sbin/bsnmpd/modules/Makefile1
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend1
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_bridge/Makefile.depend1
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c2
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.32
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.313
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_hostres/Makefile.depend1
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_hostres/snmp_hostres.32
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_lm75/BEGEMOT-LM75-MIB.txt160
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_lm75/Makefile13
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_lm75/Makefile.depend31
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_lm75/lm75_tree.def56
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_lm75/snmp_lm75.360
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_lm75/snmp_lm75.c435
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_mibII/Makefile.depend1
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_netgraph/Makefile.depend1
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.32
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_pf/Makefile.depend1
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_target/Makefile.depend1
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_usm/Makefile.depend1
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_vacm/Makefile.depend1
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_wlan/Makefile.depend1
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.32
-rw-r--r--usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.12
-rw-r--r--usr.sbin/btxld/Makefile2
-rw-r--r--usr.sbin/btxld/btxld.82
-rw-r--r--usr.sbin/cdcontrol/Makefile4
-rw-r--r--usr.sbin/cdcontrol/Makefile.depend2
-rw-r--r--usr.sbin/chkgrp/chkgrp.84
-rw-r--r--usr.sbin/chown/Makefile6
-rw-r--r--usr.sbin/chown/tests/Makefile9
-rwxr-xr-xusr.sbin/chown/tests/chown-f_test.sh21
-rw-r--r--usr.sbin/config/config.52
-rw-r--r--usr.sbin/cpucontrol/cpucontrol.811
-rw-r--r--usr.sbin/cpucontrol/cpucontrol.c59
-rw-r--r--usr.sbin/cron/cron/Makefile2
-rw-r--r--usr.sbin/cron/cron/cron.82
-rw-r--r--usr.sbin/cron/crontab/Makefile2
-rw-r--r--usr.sbin/cron/crontab/crontab.12
-rw-r--r--usr.sbin/cron/crontab/crontab.52
-rw-r--r--usr.sbin/crunch/crunchgen/Makefile2
-rw-r--r--usr.sbin/crunch/crunchgen/Makefile.depend1
-rw-r--r--usr.sbin/crunch/crunchgen/crunchgen.16
-rw-r--r--usr.sbin/crunch/crunchide/Makefile7
-rw-r--r--usr.sbin/crunch/crunchide/crunchide.14
-rw-r--r--usr.sbin/crunch/crunchide/exec_elf32.c4
-rw-r--r--usr.sbin/ctladm/ctladm.843
-rw-r--r--usr.sbin/ctladm/ctladm.c275
-rw-r--r--usr.sbin/ctld/ctl.conf.516
-rw-r--r--usr.sbin/ctld/ctld.810
-rw-r--r--usr.sbin/ctld/ctld.c118
-rw-r--r--usr.sbin/ctld/ctld.h12
-rw-r--r--usr.sbin/ctld/discovery.c51
-rw-r--r--usr.sbin/ctld/kernel.c364
-rw-r--r--usr.sbin/ctld/login.c5
-rw-r--r--usr.sbin/ctld/parse.y13
-rw-r--r--usr.sbin/ctld/token.l5
-rw-r--r--usr.sbin/ctm/ctm/ctm.17
-rw-r--r--usr.sbin/ctm/ctm/ctm.57
-rw-r--r--usr.sbin/ctm/ctm_rmail/ctm_rmail.12
-rw-r--r--usr.sbin/ctm/mkCTM/ctm_conf.gnats8
-rw-r--r--usr.sbin/dconschat/dconschat.82
-rw-r--r--usr.sbin/devinfo/devinfo.82
-rw-r--r--usr.sbin/dumpcis/dumpcis.83
-rw-r--r--usr.sbin/editmap/Makefile2
-rw-r--r--usr.sbin/eeprom/eeprom.86
-rw-r--r--usr.sbin/etcupdate/etcupdate.82
-rw-r--r--usr.sbin/fdwrite/fdwrite.12
-rw-r--r--usr.sbin/fifolog/fifolog_create/Makefile2
-rw-r--r--usr.sbin/fifolog/fifolog_reader/Makefile2
-rw-r--r--usr.sbin/fifolog/fifolog_writer/Makefile2
-rw-r--r--usr.sbin/flowctl/flowctl.84
-rw-r--r--usr.sbin/freebsd-update/freebsd-update.82
-rw-r--r--usr.sbin/ftp-proxy/ftp-proxy/Makefile2
-rw-r--r--usr.sbin/fwcontrol/fwcontrol.86
-rw-r--r--usr.sbin/gpioctl/gpioctl.83
-rw-r--r--usr.sbin/gssd/gssd.82
-rw-r--r--usr.sbin/gstat/gstat.89
-rw-r--r--usr.sbin/gstat/gstat.c32
-rw-r--r--usr.sbin/i2c/i2c.86
-rw-r--r--usr.sbin/iostat/iostat.82
-rw-r--r--usr.sbin/ipfwpcap/ipfwpcap.84
-rw-r--r--usr.sbin/iscsid/iscsid.82
-rw-r--r--usr.sbin/iscsid/iscsid.c15
-rw-r--r--usr.sbin/iscsid/iscsid.h1
-rw-r--r--usr.sbin/iscsid/login.c139
-rw-r--r--usr.sbin/jail/jail.8208
-rw-r--r--usr.sbin/kbdcontrol/kbdcontrol.12
-rw-r--r--usr.sbin/kbdcontrol/kbdcontrol.c20
-rw-r--r--usr.sbin/kbdcontrol/path.h4
-rw-r--r--usr.sbin/kbdmap/kbdmap.16
-rw-r--r--usr.sbin/kgzip/kgzip.82
-rw-r--r--usr.sbin/kldxref/kldxref.86
-rw-r--r--usr.sbin/lmcconfig/lmcconfig.84
-rw-r--r--usr.sbin/lpr/chkprintcap/Makefile2
-rw-r--r--usr.sbin/lpr/chkprintcap/chkprintcap.82
-rw-r--r--usr.sbin/lpr/lpc/Makefile6
-rw-r--r--usr.sbin/lpr/lpc/Makefile.depend2
-rw-r--r--usr.sbin/lpr/lpd/Makefile2
-rw-r--r--usr.sbin/lpr/lpq/Makefile2
-rw-r--r--usr.sbin/lpr/lpr/Makefile2
-rw-r--r--usr.sbin/lpr/lprm/Makefile2
-rw-r--r--usr.sbin/lpr/pac/Makefile2
-rw-r--r--usr.sbin/mailstats/Makefile2
-rw-r--r--usr.sbin/mailwrapper/mailwrapper.82
-rw-r--r--usr.sbin/makefs/Makefile2
-rw-r--r--usr.sbin/makefs/ffs/mkfs.c12
-rw-r--r--usr.sbin/makefs/makefs.811
-rw-r--r--usr.sbin/makemap/Makefile2
-rw-r--r--usr.sbin/mergemaster/mergemaster.82
-rwxr-xr-xusr.sbin/mergemaster/mergemaster.sh4
-rw-r--r--usr.sbin/mixer/mixer.811
-rw-r--r--usr.sbin/mlxcontrol/mlxcontrol.87
-rw-r--r--usr.sbin/moused/moused.86
-rw-r--r--usr.sbin/mptable/mptable.12
-rw-r--r--usr.sbin/nandsim/nandsim.82
-rw-r--r--usr.sbin/ndiscvt/ndiscvt.84
-rw-r--r--usr.sbin/ndiscvt/ndisgen.82
-rw-r--r--usr.sbin/ndp/ndp.825
-rw-r--r--usr.sbin/ndp/ndp.c25
-rw-r--r--usr.sbin/newsyslog/newsyslog.810
-rw-r--r--usr.sbin/nfsd/nfsd.84
-rw-r--r--usr.sbin/ngctl/Makefile4
-rw-r--r--usr.sbin/ngctl/Makefile.depend2
-rw-r--r--usr.sbin/ngctl/ngctl.82
-rw-r--r--usr.sbin/nghook/nghook.82
-rw-r--r--usr.sbin/nmtree/Makefile2
-rw-r--r--usr.sbin/nscd/nscd.84
-rw-r--r--usr.sbin/nscd/nscd.conf.55
-rw-r--r--usr.sbin/ntp/config.h8
-rw-r--r--usr.sbin/ntp/ntp-keygen/Makefile4
-rw-r--r--usr.sbin/ntp/ntpd/Makefile4
-rw-r--r--usr.sbin/ntp/ntpd/Makefile.depend1
-rw-r--r--usr.sbin/ntp/ntpdate/Makefile2
-rw-r--r--usr.sbin/ntp/ntpdate/Makefile.depend1
-rw-r--r--usr.sbin/ntp/ntpdc/Makefile6
-rw-r--r--usr.sbin/ntp/ntpdc/Makefile.depend3
-rw-r--r--usr.sbin/ntp/ntpq/Makefile6
-rw-r--r--usr.sbin/ntp/ntpq/Makefile.depend3
-rw-r--r--usr.sbin/ntp/ntptime/Makefile2
-rw-r--r--usr.sbin/nvram/nvram.82
-rw-r--r--usr.sbin/ofwdump/ofwdump.82
-rw-r--r--usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.82
-rw-r--r--usr.sbin/pciconf/pciconf.c1
-rw-r--r--usr.sbin/periodic/periodic.84
-rw-r--r--usr.sbin/pkg/elf_tables.h1
-rw-r--r--usr.sbin/pkg/pkg.c3
-rw-r--r--usr.sbin/pmcannotate/pmcannotate.82
-rw-r--r--usr.sbin/pmcannotate/pmcannotate.c5
-rw-r--r--usr.sbin/pmccontrol/pmccontrol.82
-rw-r--r--usr.sbin/pmcstat/Makefile4
-rw-r--r--usr.sbin/pmcstat/Makefile.depend1
-rw-r--r--usr.sbin/pmcstat/pmcstat.812
-rw-r--r--usr.sbin/pmcstat/pmcstat.c44
-rw-r--r--usr.sbin/pmcstat/pmcstat.h4
-rw-r--r--usr.sbin/pmcstat/pmcstat_log.c6
-rw-r--r--usr.sbin/portsnap/portsnap/portsnap.82
-rw-r--r--usr.sbin/ppp/Makefile3
-rw-r--r--usr.sbin/ppp/ppp.86
-rw-r--r--usr.sbin/pppctl/Makefile4
-rw-r--r--usr.sbin/pppctl/Makefile.depend2
-rw-r--r--usr.sbin/praliases/Makefile2
-rw-r--r--usr.sbin/pw/pw_user.c7
-rw-r--r--usr.sbin/pw/pwupd.c17
-rw-r--r--usr.sbin/rarpd/rarpd.84
-rw-r--r--usr.sbin/rpc.umntall/rpc.umntall.82
-rw-r--r--usr.sbin/rpc.yppasswdd/rpc.yppasswdd.82
-rw-r--r--usr.sbin/rpc.ypxfrd/rpc.ypxfrd.82
-rw-r--r--usr.sbin/rtadvctl/rtadvctl.82
-rw-r--r--usr.sbin/rtprio/rtprio.12
-rw-r--r--usr.sbin/rwhod/rwhod.c1
-rw-r--r--usr.sbin/sa/sa.82
-rw-r--r--usr.sbin/sendmail/Makefile4
-rw-r--r--usr.sbin/service/service.82
-rwxr-xr-xusr.sbin/service/service.sh2
-rw-r--r--usr.sbin/sicontrol/sicontrol.84
-rw-r--r--usr.sbin/snapinfo/snapinfo.82
-rw-r--r--usr.sbin/sysrc/sysrc43
-rw-r--r--usr.sbin/sysrc/sysrc.831
-rw-r--r--usr.sbin/tcpdrop/tcpdrop.84
-rw-r--r--usr.sbin/tcpdump/tcpdump/Makefile2
-rw-r--r--usr.sbin/tzsetup/Makefile14
-rw-r--r--usr.sbin/uhsoctl/uhsoctl.c2
-rwxr-xr-xusr.sbin/unbound/local-setup/local-unbound-setup.sh65
-rw-r--r--usr.sbin/usbdump/usbdump.83
-rw-r--r--usr.sbin/usbdump/usbdump.c1
-rw-r--r--usr.sbin/utx/utx.82
-rw-r--r--usr.sbin/vidcontrol/path.h4
-rw-r--r--usr.sbin/vidcontrol/vidcontrol.19
-rw-r--r--usr.sbin/vidcontrol/vidcontrol.c152
-rw-r--r--usr.sbin/wake/wake.82
-rw-r--r--usr.sbin/watch/Makefile4
-rw-r--r--usr.sbin/watch/Makefile.depend1
-rw-r--r--usr.sbin/watch/watch.82
-rw-r--r--usr.sbin/watchdogd/watchdog.86
-rw-r--r--usr.sbin/watchdogd/watchdogd.88
-rw-r--r--usr.sbin/wpa/hostapd/Makefile4
-rw-r--r--usr.sbin/wpa/hostapd/Makefile.depend1
-rw-r--r--usr.sbin/wpa/hostapd/hostapd.82
-rw-r--r--usr.sbin/wpa/hostapd/hostapd.conf.52
-rw-r--r--usr.sbin/wpa/hostapd_cli/Makefile3
-rw-r--r--usr.sbin/wpa/hostapd_cli/Makefile.depend1
-rw-r--r--usr.sbin/wpa/hostapd_cli/hostapd_cli.82
-rw-r--r--usr.sbin/wpa/ndis_events/ndis_events.82
-rw-r--r--usr.sbin/wpa/wpa_cli/Makefile4
-rw-r--r--usr.sbin/wpa/wpa_cli/Makefile.depend3
-rw-r--r--usr.sbin/wpa/wpa_cli/wpa_cli.82
-rw-r--r--usr.sbin/wpa/wpa_passphrase/Makefile3
-rw-r--r--usr.sbin/wpa/wpa_passphrase/Makefile.depend1
-rw-r--r--usr.sbin/wpa/wpa_passphrase/wpa_passphrase.87
-rw-r--r--usr.sbin/wpa/wpa_supplicant/Makefile4
-rw-r--r--usr.sbin/wpa/wpa_supplicant/Makefile.depend1
-rw-r--r--usr.sbin/wpa/wpa_supplicant/wpa_supplicant.82
-rw-r--r--usr.sbin/wpa/wpa_supplicant/wpa_supplicant.conf.52
-rw-r--r--usr.sbin/yp_mkdb/yp_mkdb.82
-rw-r--r--usr.sbin/ypbind/ypbind.82
-rw-r--r--usr.sbin/yppush/yppush.82
-rw-r--r--usr.sbin/ypserv/ypinit.84
-rw-r--r--usr.sbin/ypserv/ypserv.82
-rw-r--r--usr.sbin/zzz/zzz.82
313 files changed, 5075 insertions, 1217 deletions
diff --git a/usr.sbin/Makefile.ia64 b/usr.sbin/Makefile.ia64
deleted file mode 100644
index 0a897b40b316..000000000000
--- a/usr.sbin/Makefile.ia64
+++ /dev/null
@@ -1,9 +0,0 @@
-# $FreeBSD$
-
-.if ${MK_ACPI} != "no"
-SUBDIR+= acpi
-.endif
-SUBDIR+= kgmon
-SUBDIR+= mount_smbfs
-SUBDIR:= ${SUBDIR:Nuathload}
-SUBDIR+= zzz
diff --git a/usr.sbin/acpi/acpiconf/acpiconf.8 b/usr.sbin/acpi/acpiconf/acpiconf.8
index 8a949d7e7274..805e090f5f38 100644
--- a/usr.sbin/acpi/acpiconf/acpiconf.8
+++ b/usr.sbin/acpi/acpiconf/acpiconf.8
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd August 16, 2004
+.Dd June 10, 2014
.Dt ACPICONF 8
.Os
.Sh NAME
@@ -37,6 +37,7 @@
.Nm
.Op Fl h
.Op Fl i Ar batt
+.Op Fl k Ar ack
.Op Fl s Ar type
.Sh DESCRIPTION
The
@@ -49,6 +50,9 @@ The following command-line options are recognized:
Displays a summary of available options.
.It Fl i Ar batt
Get design information about the specified battery.
+.It Fl k Ar ack
+Ack or abort a pending suspend request using the argument provided.
+.Sy Most users should not use this option directly.
.It Fl s Ar type
Enters the specified sleep mode.
Recognized types are
@@ -87,6 +91,6 @@ utility appeared in
The
.Nm
utility was written by
-.An Mitsuru Iwasaki Aq iwasaki@FreeBSD.org .
+.An Mitsuru Iwasaki Aq Mt iwasaki@FreeBSD.org .
This manual page was written by
-.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
+.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
diff --git a/usr.sbin/acpi/acpidb/acpidb.8 b/usr.sbin/acpi/acpidb/acpidb.8
index 4ed97a6a399c..67fab31c346d 100644
--- a/usr.sbin/acpi/acpidb/acpidb.8
+++ b/usr.sbin/acpi/acpidb/acpidb.8
@@ -161,7 +161,7 @@ It was imported for
The
.Nm
utility was written by
-.An Mitsuru Iwasaki Aq iwasaki@FreeBSD.org
+.An Mitsuru Iwasaki Aq Mt iwasaki@FreeBSD.org
and uses Intel ACPI-CA for the backend.
This manual page was written by
.An Nate Lawson .
diff --git a/usr.sbin/acpi/acpidump/acpidump.8 b/usr.sbin/acpi/acpidump/acpidump.8
index f1c7a18def32..a03917a1baba 100644
--- a/usr.sbin/acpi/acpidump/acpidump.8
+++ b/usr.sbin/acpi/acpidump/acpidump.8
@@ -181,20 +181,20 @@ and was rewritten to use
for
.Fx 5.2 .
.Sh AUTHORS
-.An Doug Rabson Aq dfr@FreeBSD.org
-.An Mitsuru IWASAKI Aq iwasaki@FreeBSD.org
-.An Yasuo YOKOYAMA Aq yokoyama@jp.FreeBSD.org
-.An Nate Lawson Aq njl@FreeBSD.org
+.An Doug Rabson Aq Mt dfr@FreeBSD.org
+.An Mitsuru IWASAKI Aq Mt iwasaki@FreeBSD.org
+.An Yasuo YOKOYAMA Aq Mt yokoyama@jp.FreeBSD.org
+.An Nate Lawson Aq Mt njl@FreeBSD.org
.Pp
.An -nosplit
Some contributions made by
-.An Chitoshi Ohsawa Aq ohsawa@catv1.ccn-net.ne.jp ,
-.An Takayasu IWANASHI Aq takayasu@wendy.a.perfect-liberty.or.jp ,
-.An Yoshihiko SARUMARU Aq mistral@imasy.or.jp ,
-.An Hiroki Sato Aq hrs@FreeBSD.org ,
-.An Michael Lucas Aq mwlucas@blackhelicopters.org
+.An Chitoshi Ohsawa Aq Mt ohsawa@catv1.ccn-net.ne.jp ,
+.An Takayasu IWANASHI Aq Mt takayasu@wendy.a.perfect-liberty.or.jp ,
+.An Yoshihiko SARUMARU Aq Mt mistral@imasy.or.jp ,
+.An Hiroki Sato Aq Mt hrs@FreeBSD.org ,
+.An Michael Lucas Aq Mt mwlucas@blackhelicopters.org
and
-.An Michael Smith Aq msmith@FreeBSD.org .
+.An Michael Smith Aq Mt msmith@FreeBSD.org .
.Sh BUGS
The current implementation does not dump the BOOT structure or
other miscellaneous tables.
diff --git a/usr.sbin/adduser/adduser.8 b/usr.sbin/adduser/adduser.8
index f23ecffd5b59..2e6a5b5a3897 100644
--- a/usr.sbin/adduser/adduser.8
+++ b/usr.sbin/adduser/adduser.8
@@ -450,11 +450,11 @@ command appeared in
.Sh AUTHORS
.An -nosplit
This manual page and the original script, in Perl, was written by
-.An Wolfram Schneider Aq wosch@FreeBSD.org .
+.An Wolfram Schneider Aq Mt wosch@FreeBSD.org .
The replacement script, written as a Bourne
shell script with some enhancements, and the man page modification that
came with it were done by
-.An Mike Makonnen Aq mtm@identd.net .
+.An Mike Makonnen Aq Mt mtm@identd.net .
.Sh BUGS
In order for
.Nm
diff --git a/usr.sbin/adduser/adduser.conf.5 b/usr.sbin/adduser/adduser.conf.5
index c7c4f5d067b9..af9fe22cfb3a 100644
--- a/usr.sbin/adduser/adduser.conf.5
+++ b/usr.sbin/adduser/adduser.conf.5
@@ -210,7 +210,7 @@ manual page first appeared in
.Fx 5.3 .
.Sh AUTHORS
This manual page was written by
-.An Tom Rhodes Aq trhodes@FreeBSD.org .
+.An Tom Rhodes Aq Mt trhodes@FreeBSD.org .
.Sh BUGS
The internal variables documented here may change without notice.
Do not rely on them.
diff --git a/usr.sbin/amd/amd/Makefile b/usr.sbin/amd/amd/Makefile
index 1fc41bfe20d0..fdcbd601e5c9 100644
--- a/usr.sbin/amd/amd/Makefile
+++ b/usr.sbin/amd/amd/Makefile
@@ -24,6 +24,8 @@ SRCS+= ops_nullfs.c ops_pcfs.c ops_tfs.c ops_ufs.c ops_umapfs.c
SRCS+= ops_unionfs.c opts.c readdir.c restart.c rpc_fwd.c sched.c
SRCS+= srvr_amfs_auto.c srvr_nfs.c
+NO_PIE= yes
+
CFLAGS+= -I${.CURDIR}/../../../contrib/amd/amd \
-I${DESTDIR}/usr/include/rpcsvc
diff --git a/usr.sbin/amd/amq/Makefile b/usr.sbin/amd/amq/Makefile
index 74fc7492f524..40257c308b98 100644
--- a/usr.sbin/amd/amq/Makefile
+++ b/usr.sbin/amd/amq/Makefile
@@ -17,4 +17,6 @@ CFLAGS+= -I${.CURDIR}/../../../contrib/amd/amq
DPADD= ${LIBAMU}
LDADD= ${LIBAMU}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/amd/fixmount/Makefile b/usr.sbin/amd/fixmount/Makefile
index 7f96a456dfe4..1838fb29ba33 100644
--- a/usr.sbin/amd/fixmount/Makefile
+++ b/usr.sbin/amd/fixmount/Makefile
@@ -18,4 +18,6 @@ SRCS+= checkmount_bsd44.c
DPADD= ${LIBAMU} ${LIBRPCSVC}
LDADD= ${LIBAMU} -lrpcsvc
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/amd/fsinfo/Makefile b/usr.sbin/amd/fsinfo/Makefile
index 1695a469f980..83becb2c5b3d 100644
--- a/usr.sbin/amd/fsinfo/Makefile
+++ b/usr.sbin/amd/fsinfo/Makefile
@@ -13,6 +13,8 @@ SRCS= fsi_gram.y fsi_lex.l
SRCS+= fsi_analyze.c fsi_dict.c fsi_util.c fsinfo.c wr_atab.c
SRCS+= wr_bparam.c wr_dumpset.c wr_exportfs.c wr_fstab.c
+NO_PIE= yes
+
CFLAGS+= -I${.CURDIR}/../../../contrib/amd/fsinfo
DPADD= ${LIBAMU}
diff --git a/usr.sbin/amd/hlfsd/Makefile b/usr.sbin/amd/hlfsd/Makefile
index 5b863dd5adcd..dca94da6bb95 100644
--- a/usr.sbin/amd/hlfsd/Makefile
+++ b/usr.sbin/amd/hlfsd/Makefile
@@ -16,4 +16,6 @@ CFLAGS+= -I${.CURDIR}/../../../contrib/amd/hlfsd
DPADD= ${LIBAMU}
LDADD= ${LIBAMU}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/amd/include/Makefile.depend b/usr.sbin/amd/include/Makefile.depend
index 57b7e10c3d71..18f420a95592 100644
--- a/usr.sbin/amd/include/Makefile.depend
+++ b/usr.sbin/amd/include/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
.include <dirdeps.mk>
diff --git a/usr.sbin/amd/mk-amd-map/Makefile b/usr.sbin/amd/mk-amd-map/Makefile
index 57fd6a5f0bdc..bed9e30c9b91 100644
--- a/usr.sbin/amd/mk-amd-map/Makefile
+++ b/usr.sbin/amd/mk-amd-map/Makefile
@@ -13,4 +13,6 @@ MAN= mk-amd-map.8
DPADD= ${LIBAMU}
LDADD= ${LIBAMU}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/amd/pawd/Makefile b/usr.sbin/amd/pawd/Makefile
index c6bb1cc37a0b..612acedf7a8a 100644
--- a/usr.sbin/amd/pawd/Makefile
+++ b/usr.sbin/amd/pawd/Makefile
@@ -17,4 +17,6 @@ CFLAGS+= -I${.CURDIR}/../../../contrib/amd/amq
DPADD= ${LIBAMU}
LDADD= ${LIBAMU}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/amd/wire-test/Makefile b/usr.sbin/amd/wire-test/Makefile
index a07e6902fe76..f96076863735 100644
--- a/usr.sbin/amd/wire-test/Makefile
+++ b/usr.sbin/amd/wire-test/Makefile
@@ -13,4 +13,6 @@ MAN= wire-test.8
DPADD= ${LIBAMU}
LDADD= ${LIBAMU}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/ancontrol/ancontrol.8 b/usr.sbin/ancontrol/ancontrol.8
index 5ce4377ab90f..25fa5aefa061 100644
--- a/usr.sbin/ancontrol/ancontrol.8
+++ b/usr.sbin/ancontrol/ancontrol.8
@@ -540,7 +540,7 @@ utility first appeared in
The
.Nm
utility was written by
-.An Bill Paul Aq wpaul@ee.columbia.edu .
+.An Bill Paul Aq Mt wpaul@ee.columbia.edu .
.Sh BUGS
The statistics counters do not seem to show the amount of transmit
and received frames as increasing.
diff --git a/usr.sbin/apm/apm.8 b/usr.sbin/apm/apm.8
index 3e039b08b1b8..96eb9732b7e6 100644
--- a/usr.sbin/apm/apm.8
+++ b/usr.sbin/apm/apm.8
@@ -133,7 +133,7 @@ replaces all of its functionality.
.Xr apm 4 ,
.Xr zzz 8
.Sh AUTHORS
-.An Tatsumi Hosokawa Aq hosokawa@jp.FreeBSD.org
+.An Tatsumi Hosokawa Aq Mt hosokawa@jp.FreeBSD.org
.Sh BUGS
Some APM implementations do not support parameters needed by
.Nm .
diff --git a/usr.sbin/apmd/apmd.8 b/usr.sbin/apmd/apmd.8
index 633217fd3295..afecd47a3759 100644
--- a/usr.sbin/apmd/apmd.8
+++ b/usr.sbin/apmd/apmd.8
@@ -308,15 +308,15 @@ The
utility appeared in
.Fx 3.3 .
.Sh AUTHORS
-.An Mitsuru IWASAKI Aq iwasaki@FreeBSD.org
-.An KOIE Hidetaka Aq koie@suri.co.jp
+.An Mitsuru IWASAKI Aq Mt iwasaki@FreeBSD.org
+.An KOIE Hidetaka Aq Mt koie@suri.co.jp
.Pp
.An -nosplit
Some contributions made by
-.An Warner Losh Aq imp@FreeBSD.org ,
-.An Hiroshi Yamashita Aq bluemoon@msj.biglobe.ne.jp ,
-.An Yoshihiko SARUMARU Aq mistral@imasy.or.jp ,
-.An Norihiro Kumagai Aq kuma@nk.rim.or.jp ,
-.An NAKAGAWA Yoshihisa Aq nakagawa@jp.FreeBSD.org ,
+.An Warner Losh Aq Mt imp@FreeBSD.org ,
+.An Hiroshi Yamashita Aq Mt bluemoon@msj.biglobe.ne.jp ,
+.An Yoshihiko SARUMARU Aq Mt mistral@imasy.or.jp ,
+.An Norihiro Kumagai Aq Mt kuma@nk.rim.or.jp ,
+.An NAKAGAWA Yoshihisa Aq Mt nakagawa@jp.FreeBSD.org ,
and
-.An Nick Hilliard Aq nick@foobar.org .
+.An Nick Hilliard Aq Mt nick@foobar.org .
diff --git a/usr.sbin/asf/asf.8 b/usr.sbin/asf/asf.8
index 92edb4b790d8..39281375417b 100644
--- a/usr.sbin/asf/asf.8
+++ b/usr.sbin/asf/asf.8
@@ -170,7 +170,7 @@ The
utility first appeared in
.Fx 5.2 .
.Sh AUTHORS
-.An Greg Lehey Aq grog@FreeBSD.org
+.An Greg Lehey Aq Mt grog@FreeBSD.org
.Sh BUGS
Module paths are guessed in a rather naive way by default.
It is likely to lag behind the changes to the build tree layout.
diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile
index c73cb3d31e02..1c95f77dff2b 100644
--- a/usr.sbin/bhyve/Makefile
+++ b/usr.sbin/bhyve/Makefile
@@ -23,6 +23,7 @@ SRCS= \
pci_ahci.c \
pci_emul.c \
pci_hostbridge.c \
+ pci_irq.c \
pci_lpc.c \
pci_passthru.c \
pci_virtio_block.c \
@@ -34,6 +35,7 @@ SRCS= \
post.c \
rtc.c \
smbiostbl.c \
+ task_switch.c \
uart_emul.c \
virtio.c \
xmsr.c \
diff --git a/usr.sbin/bhyve/acpi.c b/usr.sbin/bhyve/acpi.c
index db7f0eb72c48..c4ec020bd5e1 100644
--- a/usr.sbin/bhyve/acpi.c
+++ b/usr.sbin/bhyve/acpi.c
@@ -704,7 +704,7 @@ basl_fwrite_dsdt(FILE *fp)
dsdt_line("DefinitionBlock (\"bhyve_dsdt.aml\", \"DSDT\", 2,"
"\"BHYVE \", \"BVDSDT \", 0x00000001)");
dsdt_line("{");
- dsdt_line(" Name (_S5, Package (0x02)");
+ dsdt_line(" Name (_S5, Package ()");
dsdt_line(" {");
dsdt_line(" 0x05,");
dsdt_line(" Zero,");
diff --git a/usr.sbin/bhyve/acpi.h b/usr.sbin/bhyve/acpi.h
index 57edc48cdc15..652164af351c 100644
--- a/usr.sbin/bhyve/acpi.h
+++ b/usr.sbin/bhyve/acpi.h
@@ -49,5 +49,6 @@ void dsdt_fixed_irq(uint8_t irq);
void dsdt_fixed_mem32(uint32_t base, uint32_t length);
void dsdt_indent(int levels);
void dsdt_unindent(int levels);
+void sci_init(struct vmctx *ctx);
#endif /* _ACPI_H_ */
diff --git a/usr.sbin/bhyve/atkbdc.c b/usr.sbin/bhyve/atkbdc.c
index 1b7d66cdfdd6..930b7af95f3d 100644
--- a/usr.sbin/bhyve/atkbdc.c
+++ b/usr.sbin/bhyve/atkbdc.c
@@ -31,6 +31,10 @@ __FBSDID("$FreeBSD$");
#include <machine/vmm.h>
+#include <vmmapi.h>
+
+#include <assert.h>
+#include <errno.h>
#include <stdio.h>
#include "inout.h"
@@ -39,7 +43,7 @@ __FBSDID("$FreeBSD$");
#define KBD_DATA_PORT 0x60
#define KBD_STS_CTL_PORT 0x64
-#define KDB_SYS_FLAG 0x4
+#define KBD_SYS_FLAG 0x4
#define KBDC_RESET 0xfe
@@ -48,29 +52,30 @@ atkbdc_data_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
uint32_t *eax, void *arg)
{
if (bytes != 1)
- return (INOUT_ERROR);
+ return (-1);
*eax = 0;
- return (INOUT_OK);
+ return (0);
}
static int
atkbdc_sts_ctl_handler(struct vmctx *ctx, int vcpu, int in, int port,
int bytes, uint32_t *eax, void *arg)
{
- int retval;
+ int error, retval;
if (bytes != 1)
- return (INOUT_ERROR);
+ return (-1);
- retval = INOUT_OK;
+ retval = 0;
if (in) {
- *eax = KDB_SYS_FLAG; /* system passed POST */
+ *eax = KBD_SYS_FLAG; /* system passed POST */
} else {
switch (*eax) {
case KBDC_RESET: /* Pulse "reset" line. */
- retval = INOUT_RESET;
+ error = vm_suspend(ctx, VM_SUSPEND_RESET);
+ assert(error == 0 || errno == EALREADY);
break;
}
}
diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8
index aa97a670997d..114aaf162533 100644
--- a/usr.sbin/bhyve/bhyve.8
+++ b/usr.sbin/bhyve/bhyve.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 2, 2014
+.Dd June 26, 2014
.Dt BHYVE 8
.Os
.Sh NAME
@@ -32,12 +32,14 @@
.Nd "run a guest operating system inside a virtual machine"
.Sh SYNOPSIS
.Nm
-.Op Fl aehwxAHPW
+.Op Fl abehwxACHPWY
.Op Fl c Ar numcpus
.Op Fl g Ar gdbport
+.Op Fl l Ar lpcdev Ns Op , Ns Ar conf
+.Op Fl m Ar size Ns Op Ar K|k|M|m|G|g|T|t
.Op Fl p Ar vcpu:hostcpu
.Op Fl s Ar slot,emulation Ns Op , Ns Ar conf
-.Op Fl l Ar lpcdev Ns Op , Ns Ar conf
+.Op Fl U Ar uuid
.Ar vmname
.Sh DESCRIPTION
.Nm
@@ -59,7 +61,6 @@ exit is detected.
.Bl -tag -width 10n
.It Fl a
The guest's local APIC is configured in xAPIC mode.
-
The xAPIC mode is the default setting so this option is redundant. It will be
deprecated in a future version.
.It Fl A
@@ -67,19 +68,49 @@ Generate ACPI tables.
Required for
.Fx Ns /amd64
guests.
+.It Fl b
+Enable a low-level console device supported by
+.Fx kernels compiled with
+.Cd "device bvmconsole" .
+This option will be deprecated in a future version.
.It Fl c Ar numcpus
Number of guest virtual CPUs.
The default is 1 and the maximum is 16.
-.It Fl H
-Yield the virtual CPU thread when a HLT instruction is detected.
-If this option is not specified, virtual CPUs will use 100% of a host CPU.
+.It Fl C
+Include guest memory in core file.
+.It Fl e
+Force
+.Nm
+to exit when a guest issues an access to an I/O port that is not emulated.
+This is intended for debug purposes.
.It Fl g Ar gdbport
For
-.Fx Ns /amd64 kernels compiled with
-.Cd "option bvmdebug" ,
+.Fx
+kernels compiled with
+.Cd "device bvmdebug" ,
allow a remote kernel kgdb to be relayed to the guest kernel gdb stub
via a local IPv4 address and this port.
This option will be deprecated in a future version.
+.It Fl h
+Print help message and exit.
+.It Fl H
+Yield the virtual CPU thread when a HLT instruction is detected.
+If this option is not specified, virtual CPUs will use 100% of a host CPU.
+.It Fl l Ar lpcdev Ns Op , Ns Ar conf
+Allow devices behind the LPC PCI-ISA bridge to be configured.
+The only supported devices are the TTY-class devices,
+.Li com1
+and
+.Li com2 .
+.It Fl m Ar size Ns Op Ar K|k|M|m|G|g|T|t
+Guest physical memory size in bytes.
+This must be the same size that was given to
+.Xr bhyveload 8 .
+.Pp
+The size argument may be suffixed with one of K, M, G or T (either upper
+or lower case) to indicate a multiple of kilobytes, megabytes, gigabytes,
+or terabytes.
+If no suffix is given, the value is assumed to be in megabytes.
.It Fl p Ar vcpu:hostcpu
Pin guest's virtual CPU
.Em vcpu
@@ -87,9 +118,6 @@ to
.Em hostcpu .
.It Fl P
Force the guest virtual CPU to exit when a PAUSE instruction is detected.
-.It Fl W
-Force virtio PCI device emulations to use MSI interrupts instead of MSI-X
-interrupts.
.It Fl s Ar slot,emulation Ns Op , Ns Ar conf
Configure a virtual PCI slot and function.
.Pp
@@ -101,7 +129,6 @@ per slot.
.Bl -tag -width 10n
.It Ar slot
.Ar pcislot[:function]
-
.Ar bus:pcislot:function
.Pp
The
@@ -211,34 +238,21 @@ The host device must have been reserved at boot-time using the
loader variable as described in
.Xr vmm 4 .
.El
-.It Fl l Ar lpcdev Ns Op , Ns Ar conf
-Allow devices behind the LPC PCI-ISA bridge to be configured.
-The only supported devices are the TTY-class devices,
-.Li com1
-and
-.Li com2 .
-.It Fl m Ar size Ns Op Ar K|k|M|m|G|g|T|t
-Guest physical memory size in bytes.
-This must be the same size that was given to
-.Xr bhyveload 8 .
-.Pp
-The size argument may be suffixed with one of K, M, G or T (either upper
-or lower case) to indicate a multiple of kilobytes, megabytes, gigabytes,
-or terabytes.
-If no suffix is given, the value is assumed to be in megabytes.
-.It Fl e
-Force
-.Nm
-to exit when a guest issues an access to an I/O port that is not emulated.
-This is intended for debug purposes.
+.It Fl U Ar uuid
+Set the universally unique identifier
+.Pq UUID
+in the guest's System Management BIOS System Information structure.
+By default a UUID is generated from the host's hostname and
+.Ar vmname .
.It Fl w
Ignore accesses to unimplemented Model Specific Registers (MSRs). This is intended for debug purposes.
+.It Fl W
+Force virtio PCI device emulations to use MSI interrupts instead of MSI-X
+interrupts.
.It Fl x
The guest's local APIC is configured in x2APIC mode.
.It Fl Y
Disable MPtable generation.
-.It Fl h
-Print help message and exit.
.It Ar vmname
Alphanumeric name of the guest.
This should be the same as that created by
@@ -303,5 +317,5 @@ bhyve -c 4 \e\
first appeared in
.Fx 10.0 .
.Sh AUTHORS
-.An Neel Natu Aq neel@freebsd.org
-.An Peter Grehan Aq grehan@freebsd.org
+.An Neel Natu Aq Mt neel@freebsd.org
+.An Peter Grehan Aq Mt grehan@freebsd.org
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
index e662ca39d9c4..7dcf6d016b87 100644
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
#include "mevent.h"
#include "mptbl.h"
#include "pci_emul.h"
+#include "pci_irq.h"
#include "pci_lpc.h"
#include "smbiostbl.h"
#include "xmsr.h"
@@ -68,17 +69,11 @@ __FBSDID("$FreeBSD$");
#define GUEST_NIO_PORT 0x488 /* guest upcalls via i/o port */
-#define VMEXIT_SWITCH 0 /* force vcpu switch in mux mode */
-#define VMEXIT_CONTINUE 1 /* continue from next instruction */
-#define VMEXIT_RESTART 2 /* restart current instruction */
-#define VMEXIT_ABORT 3 /* abort the vm run loop */
-#define VMEXIT_RESET 4 /* guest machine has reset */
-#define VMEXIT_POWEROFF 5 /* guest machine has powered off */
-
#define MB (1024UL * 1024)
#define GB (1024UL * MB)
typedef int (*vmexit_handler_t)(struct vmctx *, struct vm_exit *, int *vcpu);
+extern int vmexit_task_switch(struct vmctx *, struct vm_exit *, int *vcpu);
char *vmname;
@@ -101,7 +96,7 @@ static cpuset_t cpumask;
static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip);
-struct vm_exit vmexit[VM_MAXCPU];
+static struct vm_exit vmexit[VM_MAXCPU];
struct bhyvestats {
uint64_t vmexit_bogus;
@@ -112,8 +107,6 @@ struct bhyvestats {
uint64_t vmexit_inst_emul;
uint64_t cpu_switch_rotate;
uint64_t cpu_switch_direct;
- int io_reset;
- int io_poweroff;
} stats;
struct mt_vmm_info {
@@ -129,25 +122,26 @@ usage(int code)
{
fprintf(stderr,
- "Usage: %s [-aehwAHIPW] [-g <gdb port>] [-s <pci>] [-c vcpus]\n"
- " %*s [-p vcpu:hostcpu] [-m mem] [-l <lpc>] <vm>\n"
+ "Usage: %s [-abehwxACHPWY] [-c vcpus] [-g <gdb port>] [-l <lpc>]\n"
+ " %*s [-m mem] [-p vcpu:hostcpu] [-s <pci>] [-U uuid] <vm>\n"
" -a: local apic is in xAPIC mode (deprecated)\n"
- " -A: create an ACPI table\n"
- " -g: gdb port\n"
+ " -A: create ACPI tables\n"
" -c: # cpus (default 1)\n"
- " -p: pin 'vcpu' to 'hostcpu'\n"
- " -H: vmexit from the guest on hlt\n"
- " -P: vmexit from the guest on pause\n"
- " -W: force virtio to use single-vector MSI\n"
+ " -C: include guest memory in core file\n"
" -e: exit on unhandled I/O access\n"
+ " -g: gdb port\n"
" -h: help\n"
- " -s: <slot,driver,configinfo> PCI slot config\n"
+ " -H: vmexit from the guest on hlt\n"
" -l: LPC device configuration\n"
" -m: memory size in MB\n"
+ " -p: pin 'vcpu' to 'hostcpu'\n"
+ " -P: vmexit from the guest on pause\n"
+ " -s: <slot,driver,configinfo> PCI slot config\n"
+ " -U: uuid\n"
" -w: ignore unimplemented MSRs\n"
+ " -W: force virtio to use single-vector MSI\n"
" -x: local apic is in x2APIC mode\n"
- " -Y: disable MPtable generation\n"
- " -U: uuid\n",
+ " -Y: disable MPtable generation\n",
progname, (int)strlen(progname), "");
exit(code);
@@ -186,6 +180,27 @@ pincpu_parse(const char *opt)
return (0);
}
+void
+vm_inject_fault(void *arg, int vcpu, int vector, int errcode_valid,
+ int errcode)
+{
+ struct vmctx *ctx;
+ int error;
+
+ ctx = arg;
+ if (errcode_valid)
+ error = vm_inject_exception2(ctx, vcpu, vector, errcode);
+ else
+ error = vm_inject_exception(ctx, vcpu, vector);
+ assert(error == 0);
+
+ /*
+ * Set the instruction length to 0 to ensure that the instruction is
+ * restarted when the fault handler returns.
+ */
+ vmexit[vcpu].inst_length = 0;
+}
+
void *
paddr_guest2host(struct vmctx *ctx, uintptr_t gaddr, size_t len)
{
@@ -241,6 +256,15 @@ fbsdrun_addcpu(struct vmctx *ctx, int fromcpu, int newcpu, uint64_t rip)
assert(fromcpu == BSP);
+ /*
+ * The 'newcpu' must be activated in the context of 'fromcpu'. If
+ * vm_activate_cpu() is delayed until newcpu's pthread starts running
+ * then vmm.ko is out-of-sync with bhyve and this can create a race
+ * with vm_suspend().
+ */
+ error = vm_activate_cpu(ctx, newcpu);
+ assert(error == 0);
+
CPU_SET_ATOMIC(newcpu, &cpumask);
/*
@@ -272,12 +296,6 @@ fbsdrun_deletecpu(struct vmctx *ctx, int vcpu)
}
static int
-vmexit_catch_inout(void)
-{
- return (VMEXIT_ABORT);
-}
-
-static int
vmexit_handle_notify(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu,
uint32_t eax)
{
@@ -293,44 +311,36 @@ static int
vmexit_inout(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu)
{
int error;
- int bytes, port, in, out;
- uint32_t eax;
+ int bytes, port, in, out, string;
int vcpu;
vcpu = *pvcpu;
port = vme->u.inout.port;
bytes = vme->u.inout.bytes;
- eax = vme->u.inout.eax;
+ string = vme->u.inout.string;
in = vme->u.inout.in;
out = !in;
- /* We don't deal with these */
- if (vme->u.inout.string || vme->u.inout.rep)
- return (VMEXIT_ABORT);
-
/* Extra-special case of host notifications */
- if (out && port == GUEST_NIO_PORT)
- return (vmexit_handle_notify(ctx, vme, pvcpu, eax));
+ if (out && port == GUEST_NIO_PORT) {
+ error = vmexit_handle_notify(ctx, vme, pvcpu, vme->u.inout.eax);
+ return (error);
+ }
- error = emulate_inout(ctx, vcpu, in, port, bytes, &eax, strictio);
- if (error == INOUT_OK && in)
- error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RAX, eax);
+ error = emulate_inout(ctx, vcpu, vme, strictio);
+ if (!error && in && !string) {
+ error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RAX,
+ vme->u.inout.eax);
+ assert(error == 0);
+ }
- switch (error) {
- case INOUT_OK:
+ if (error) {
+ fprintf(stderr, "Unhandled %s%c 0x%04x\n", in ? "in" : "out",
+ bytes == 1 ? 'b' : (bytes == 2 ? 'w' : 'l'), port);
+ return (VMEXIT_ABORT);
+ } else {
return (VMEXIT_CONTINUE);
- case INOUT_RESET:
- stats.io_reset++;
- return (VMEXIT_RESET);
- case INOUT_POWEROFF:
- stats.io_poweroff++;
- return (VMEXIT_POWEROFF);
- default:
- fprintf(stderr, "Unhandled %s%c 0x%04x\n",
- in ? "in" : "out",
- bytes == 1 ? 'b' : (bytes == 2 ? 'w' : 'l'), port);
- return (vmexit_catch_inout());
}
}
@@ -347,8 +357,7 @@ vmexit_rdmsr(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu)
fprintf(stderr, "rdmsr to register %#x on vcpu %d\n",
vme->u.msr.code, *pvcpu);
if (strictmsr) {
- error = vm_inject_exception2(ctx, *pvcpu, IDT_GP, 0);
- assert(error == 0);
+ vm_inject_gp(ctx, *pvcpu);
return (VMEXIT_RESTART);
}
}
@@ -374,8 +383,7 @@ vmexit_wrmsr(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu)
fprintf(stderr, "wrmsr to register %#x(%#lx) on vcpu %d\n",
vme->u.msr.code, vme->u.msr.wval, *pvcpu);
if (strictmsr) {
- error = vm_inject_exception2(ctx, *pvcpu, IDT_GP, 0);
- assert(error == 0);
+ vm_inject_gp(ctx, *pvcpu);
return (VMEXIT_RESTART);
}
}
@@ -394,6 +402,16 @@ vmexit_spinup_ap(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu)
return (retval);
}
+#define DEBUG_EPT_MISCONFIG
+#ifdef DEBUG_EPT_MISCONFIG
+#define EXIT_REASON_EPT_MISCONFIG 49
+#define VMCS_GUEST_PHYSICAL_ADDRESS 0x00002400
+#define VMCS_IDENT(x) ((x) | 0x80000000)
+
+static uint64_t ept_misconfig_gpa, ept_misconfig_pte[4];
+static int ept_misconfig_ptenum;
+#endif
+
static int
vmexit_vmx(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
{
@@ -408,7 +426,21 @@ vmexit_vmx(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
vmexit->u.vmx.exit_qualification);
fprintf(stderr, "\tinst_type\t\t%d\n", vmexit->u.vmx.inst_type);
fprintf(stderr, "\tinst_error\t\t%d\n", vmexit->u.vmx.inst_error);
-
+#ifdef DEBUG_EPT_MISCONFIG
+ if (vmexit->u.vmx.exit_reason == EXIT_REASON_EPT_MISCONFIG) {
+ vm_get_register(ctx, *pvcpu,
+ VMCS_IDENT(VMCS_GUEST_PHYSICAL_ADDRESS),
+ &ept_misconfig_gpa);
+ vm_get_gpa_pmap(ctx, ept_misconfig_gpa, ept_misconfig_pte,
+ &ept_misconfig_ptenum);
+ fprintf(stderr, "\tEPT misconfiguration:\n");
+ fprintf(stderr, "\t\tGPA: %#lx\n", ept_misconfig_gpa);
+ fprintf(stderr, "\t\tPTE(%d): %#lx %#lx %#lx %#lx\n",
+ ept_misconfig_ptenum, ept_misconfig_pte[0],
+ ept_misconfig_pte[1], ept_misconfig_pte[2],
+ ept_misconfig_pte[3]);
+ }
+#endif /* DEBUG_EPT_MISCONFIG */
return (VMEXIT_ABORT);
}
@@ -460,7 +492,7 @@ vmexit_inst_emul(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
stats.vmexit_inst_emul++;
err = emulate_mem(ctx, *pvcpu, vmexit->u.inst_emul.gpa,
- &vmexit->u.inst_emul.vie);
+ &vmexit->u.inst_emul.vie, &vmexit->u.inst_emul.paging);
if (err) {
if (err == EINVAL) {
@@ -510,6 +542,8 @@ vmexit_suspend(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
exit(1);
case VM_SUSPEND_HALT:
exit(2);
+ case VM_SUSPEND_TRIPLEFAULT:
+ exit(3);
default:
fprintf(stderr, "vmexit_suspend: invalid reason %d\n", how);
exit(100);
@@ -519,6 +553,7 @@ vmexit_suspend(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
static vmexit_handler_t handler[VM_EXITCODE_MAX] = {
[VM_EXITCODE_INOUT] = vmexit_inout,
+ [VM_EXITCODE_INOUT_STR] = vmexit_inout,
[VM_EXITCODE_VMX] = vmexit_vmx,
[VM_EXITCODE_BOGUS] = vmexit_bogus,
[VM_EXITCODE_RDMSR] = vmexit_rdmsr,
@@ -526,7 +561,8 @@ static vmexit_handler_t handler[VM_EXITCODE_MAX] = {
[VM_EXITCODE_MTRAP] = vmexit_mtrap,
[VM_EXITCODE_INST_EMUL] = vmexit_inst_emul,
[VM_EXITCODE_SPINUP_AP] = vmexit_spinup_ap,
- [VM_EXITCODE_SUSPENDED] = vmexit_suspend
+ [VM_EXITCODE_SUSPENDED] = vmexit_suspend,
+ [VM_EXITCODE_TASK_SWITCH] = vmexit_task_switch,
};
static void
@@ -534,7 +570,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip)
{
int error, rc, prevcpu;
enum vm_exitcode exitcode;
- enum vm_suspend_how how;
+ cpuset_t active_cpus;
if (vcpumap[vcpu] != NULL) {
error = pthread_setaffinity_np(pthread_self(),
@@ -542,6 +578,9 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip)
assert(error == 0);
}
+ error = vm_active_cpus(ctx, &active_cpus);
+ assert(CPU_ISSET(vcpu, &active_cpus));
+
while (1) {
error = vm_run(ctx, vcpu, rip, &vmexit[vcpu]);
if (error != 0)
@@ -565,16 +604,8 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip)
case VMEXIT_RESTART:
rip = vmexit[vcpu].rip;
break;
- case VMEXIT_RESET:
- case VMEXIT_POWEROFF:
- if (rc == VMEXIT_RESET)
- how = VM_SUSPEND_RESET;
- else
- how = VM_SUSPEND_POWEROFF;
- error = vm_suspend(ctx, how);
- assert(error == 0 || errno == EALREADY);
- rip = vmexit[vcpu].rip + vmexit[vcpu].inst_length;
- break;
+ case VMEXIT_ABORT:
+ abort();
default:
exit(1);
}
@@ -647,19 +678,20 @@ int
main(int argc, char *argv[])
{
int c, error, gdb_port, err, bvmcons;
- int max_vcpus, mptgen;
+ int dump_guest_memory, max_vcpus, mptgen;
struct vmctx *ctx;
uint64_t rip;
size_t memsize;
bvmcons = 0;
+ dump_guest_memory = 0;
progname = basename(argv[0]);
gdb_port = 0;
guest_ncpus = 1;
memsize = 256 * MB;
mptgen = 1;
- while ((c = getopt(argc, argv, "abehwxAHIPWYp:g:c:s:m:l:U:")) != -1) {
+ while ((c = getopt(argc, argv, "abehwxACHIPWYp:g:c:s:m:l:U:")) != -1) {
switch (c) {
case 'a':
x2apic_mode = 0;
@@ -679,6 +711,9 @@ main(int argc, char *argv[])
case 'c':
guest_ncpus = atoi(optarg);
break;
+ case 'C':
+ dump_guest_memory = 1;
+ break;
case 'g':
gdb_port = atoi(optarg);
break;
@@ -760,6 +795,8 @@ main(int argc, char *argv[])
fbsdrun_set_capabilities(ctx, BSP);
+ if (dump_guest_memory)
+ vm_set_memflags(ctx, VM_MEM_F_INCORE);
err = vm_setup_memory(ctx, memsize, VM_MMAP_ALL);
if (err) {
fprintf(stderr, "Unable to setup memory (%d)\n", err);
@@ -768,9 +805,11 @@ main(int argc, char *argv[])
init_mem();
init_inout();
+ pci_irq_init(ctx);
ioapic_init(ctx);
rtc_init(ctx);
+ sci_init(ctx);
/*
* Exit if a device emulation finds an error in it's initilization
diff --git a/usr.sbin/bhyve/bhyverun.h b/usr.sbin/bhyve/bhyverun.h
index f18d42fc3f01..87824ef9f4f4 100644
--- a/usr.sbin/bhyve/bhyverun.h
+++ b/usr.sbin/bhyve/bhyverun.h
@@ -35,6 +35,10 @@
#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1]
#endif
+#define VMEXIT_CONTINUE 1 /* continue from next instruction */
+#define VMEXIT_RESTART 2 /* restart current instruction */
+#define VMEXIT_ABORT 3 /* abort the vm run loop */
+
struct vmctx;
extern int guest_ncpus;
extern char *guest_uuid_str;
diff --git a/usr.sbin/bhyve/block_if.c b/usr.sbin/bhyve/block_if.c
index b29bc7856e86..1ec0344f3fca 100644
--- a/usr.sbin/bhyve/block_if.c
+++ b/usr.sbin/bhyve/block_if.c
@@ -390,6 +390,55 @@ blockif_close(struct blockif_ctxt *bc)
}
/*
+ * Return virtual C/H/S values for a given block. Use the algorithm
+ * outlined in the VHD specification to calculate values.
+ */
+void
+blockif_chs(struct blockif_ctxt *bc, uint16_t *c, uint8_t *h, uint8_t *s)
+{
+ off_t sectors; /* total sectors of the block dev */
+ off_t hcyl; /* cylinders times heads */
+ uint16_t secpt; /* sectors per track */
+ uint8_t heads;
+
+ assert(bc->bc_magic == BLOCKIF_SIG);
+
+ sectors = bc->bc_size / bc->bc_sectsz;
+
+ /* Clamp the size to the largest possible with CHS */
+ if (sectors > 65535UL*16*255)
+ sectors = 65535UL*16*255;
+
+ if (sectors >= 65536UL*16*63) {
+ secpt = 255;
+ heads = 16;
+ hcyl = sectors / secpt;
+ } else {
+ secpt = 17;
+ hcyl = sectors / secpt;
+ heads = (hcyl + 1023) / 1024;
+
+ if (heads < 4)
+ heads = 4;
+
+ if (hcyl >= (heads * 1024) || heads > 16) {
+ secpt = 31;
+ heads = 16;
+ hcyl = sectors / secpt;
+ }
+ if (hcyl >= (heads * 1024)) {
+ secpt = 63;
+ heads = 16;
+ hcyl = sectors / secpt;
+ }
+ }
+
+ *c = hcyl / heads;
+ *h = heads;
+ *s = secpt;
+}
+
+/*
* Accessors
*/
off_t
diff --git a/usr.sbin/bhyve/block_if.h b/usr.sbin/bhyve/block_if.h
index e0c0bb1f8c8b..c2c21f657446 100644
--- a/usr.sbin/bhyve/block_if.h
+++ b/usr.sbin/bhyve/block_if.h
@@ -52,6 +52,8 @@ struct blockif_req {
struct blockif_ctxt;
struct blockif_ctxt *blockif_open(const char *optstr, const char *ident);
off_t blockif_size(struct blockif_ctxt *bc);
+void blockif_chs(struct blockif_ctxt *bc, uint16_t *c, uint8_t *h,
+ uint8_t *s);
int blockif_sectsz(struct blockif_ctxt *bc);
int blockif_queuesz(struct blockif_ctxt *bc);
int blockif_is_ro(struct blockif_ctxt *bc);
diff --git a/usr.sbin/bhyve/inout.c b/usr.sbin/bhyve/inout.c
index 5fbe99ba0256..1041a59d2194 100644
--- a/usr.sbin/bhyve/inout.c
+++ b/usr.sbin/bhyve/inout.c
@@ -31,11 +31,21 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/linker_set.h>
+#include <sys/_iovec.h>
+#include <sys/mman.h>
+
+#include <x86/psl.h>
+#include <x86/segments.h>
+
+#include <machine/vmm.h>
+#include <machine/vmm_instruction_emul.h>
+#include <vmmapi.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
+#include "bhyverun.h"
#include "inout.h"
SET_DECLARE(inout_port_set, struct inout_port);
@@ -91,52 +101,132 @@ register_default_iohandler(int start, int size)
}
int
-emulate_inout(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
- uint32_t *eax, int strict)
+emulate_inout(struct vmctx *ctx, int vcpu, struct vm_exit *vmexit, int strict)
{
- int flags;
- uint32_t mask, val;
+ int addrsize, bytes, flags, in, port, prot, rep;
+ uint32_t val;
inout_func_t handler;
void *arg;
- int error;
+ int error, retval;
+ enum vm_reg_name idxreg;
+ uint64_t gla, index, iterations, count;
+ struct vm_inout_str *vis;
+ struct iovec iov[2];
+
+ bytes = vmexit->u.inout.bytes;
+ in = vmexit->u.inout.in;
+ port = vmexit->u.inout.port;
assert(port < MAX_IOPORTS);
+ assert(bytes == 1 || bytes == 2 || bytes == 4);
handler = inout_handlers[port].handler;
if (strict && handler == default_inout)
return (-1);
- switch (bytes) {
- case 1:
- mask = 0xff;
- break;
- case 2:
- mask = 0xffff;
- break;
- default:
- mask = 0xffffffff;
- break;
- }
+ flags = inout_handlers[port].flags;
+ arg = inout_handlers[port].arg;
- if (!in) {
- val = *eax & mask;
+ if (in) {
+ if (!(flags & IOPORT_F_IN))
+ return (-1);
+ } else {
+ if (!(flags & IOPORT_F_OUT))
+ return (-1);
}
- flags = inout_handlers[port].flags;
- arg = inout_handlers[port].arg;
+ retval = 0;
+ if (vmexit->u.inout.string) {
+ vis = &vmexit->u.inout_str;
+ rep = vis->inout.rep;
+ addrsize = vis->addrsize;
+ prot = in ? PROT_WRITE : PROT_READ;
+ assert(addrsize == 2 || addrsize == 4 || addrsize == 8);
+
+ /* Index register */
+ idxreg = in ? VM_REG_GUEST_RDI : VM_REG_GUEST_RSI;
+ index = vis->index & vie_size2mask(addrsize);
+
+ /* Count register */
+ count = vis->count & vie_size2mask(addrsize);
+
+ /* Limit number of back-to-back in/out emulations to 16 */
+ iterations = MIN(count, 16);
+ while (iterations > 0) {
+ assert(retval == 0);
+ if (vie_calculate_gla(vis->paging.cpu_mode,
+ vis->seg_name, &vis->seg_desc, index, bytes,
+ addrsize, prot, &gla)) {
+ vm_inject_gp(ctx, vcpu);
+ break;
+ }
+
+ error = vm_copy_setup(ctx, vcpu, &vis->paging, gla,
+ bytes, prot, iov, nitems(iov));
+ if (error == -1) {
+ retval = -1; /* Unrecoverable error */
+ break;
+ } else if (error == 1) {
+ retval = 0; /* Resume guest to handle fault */
+ break;
+ }
+
+ if (vie_alignment_check(vis->paging.cpl, bytes,
+ vis->cr0, vis->rflags, gla)) {
+ vm_inject_ac(ctx, vcpu, 0);
+ break;
+ }
+
+ val = 0;
+ if (!in)
+ vm_copyin(ctx, vcpu, iov, &val, bytes);
+
+ retval = handler(ctx, vcpu, in, port, bytes, &val, arg);
+ if (retval != 0)
+ break;
+
+ if (in)
+ vm_copyout(ctx, vcpu, &val, iov, bytes);
+
+ /* Update index */
+ if (vis->rflags & PSL_D)
+ index -= bytes;
+ else
+ index += bytes;
+
+ count--;
+ iterations--;
+ }
- if ((in && (flags & IOPORT_F_IN)) || (!in && (flags & IOPORT_F_OUT)))
- error = (*handler)(ctx, vcpu, in, port, bytes, &val, arg);
- else
- error = -1;
+ /* Update index register */
+ error = vie_update_register(ctx, vcpu, idxreg, index, addrsize);
+ assert(error == 0);
+
+ /*
+ * Update count register only if the instruction had a repeat
+ * prefix.
+ */
+ if (rep) {
+ error = vie_update_register(ctx, vcpu, VM_REG_GUEST_RCX,
+ count, addrsize);
+ assert(error == 0);
+ }
- if (!error && in) {
- *eax &= ~mask;
- *eax |= val & mask;
+ /* Restart the instruction if more iterations remain */
+ if (retval == 0 && count != 0)
+ vmexit->inst_length = 0;
+ } else {
+ if (!in) {
+ val = vmexit->u.inout.eax & vie_size2mask(bytes);
+ }
+ retval = handler(ctx, vcpu, in, port, bytes, &val, arg);
+ if (retval == 0 && in) {
+ vmexit->u.inout.eax &= ~vie_size2mask(bytes);
+ vmexit->u.inout.eax |= val & vie_size2mask(bytes);
+ }
}
-
- return (error);
+ return (retval);
}
void
diff --git a/usr.sbin/bhyve/inout.h b/usr.sbin/bhyve/inout.h
index 5117d795efd9..7f390951d418 100644
--- a/usr.sbin/bhyve/inout.h
+++ b/usr.sbin/bhyve/inout.h
@@ -32,13 +32,11 @@
#include <sys/linker_set.h>
struct vmctx;
+struct vm_exit;
-/* Handler return values. */
-#define INOUT_ERROR -1
-#define INOUT_OK 0
-#define INOUT_RESET 1
-#define INOUT_POWEROFF 2
-
+/*
+ * inout emulation handlers return 0 on success and -1 on failure.
+ */
typedef int (*inout_func_t)(struct vmctx *ctx, int vcpu, int in, int port,
int bytes, uint32_t *eax, void *arg);
@@ -72,8 +70,8 @@ struct inout_port {
DATA_SET(inout_port_set, __CONCAT(__inout_port, __LINE__))
void init_inout(void);
-int emulate_inout(struct vmctx *, int vcpu, int in, int port, int bytes,
- uint32_t *eax, int strict);
+int emulate_inout(struct vmctx *, int vcpu, struct vm_exit *vmexit,
+ int strict);
int register_inout(struct inout_port *iop);
int unregister_inout(struct inout_port *iop);
void init_bvmcons(void);
diff --git a/usr.sbin/bhyve/mem.c b/usr.sbin/bhyve/mem.c
index d5c79351223f..37cf055f2ccf 100644
--- a/usr.sbin/bhyve/mem.c
+++ b/usr.sbin/bhyve/mem.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/tree.h>
#include <sys/errno.h>
#include <machine/vmm.h>
+#include <machine/vmm_instruction_emul.h>
#include <stdio.h>
#include <stdlib.h>
@@ -156,7 +157,9 @@ mem_write(void *ctx, int vcpu, uint64_t gpa, uint64_t wval, int size, void *arg)
}
int
-emulate_mem(struct vmctx *ctx, int vcpu, uint64_t paddr, struct vie *vie)
+emulate_mem(struct vmctx *ctx, int vcpu, uint64_t paddr, struct vie *vie,
+ struct vm_guest_paging *paging)
+
{
struct mmio_rb_range *entry;
int err;
@@ -183,10 +186,10 @@ emulate_mem(struct vmctx *ctx, int vcpu, uint64_t paddr, struct vie *vie)
}
assert(entry != NULL);
- err = vmm_emulate_instruction(ctx, vcpu, paddr, vie,
+ err = vmm_emulate_instruction(ctx, vcpu, paddr, vie, paging,
mem_read, mem_write, &entry->mr_param);
pthread_rwlock_unlock(&mmio_rwlock);
-
+
return (err);
}
diff --git a/usr.sbin/bhyve/mem.h b/usr.sbin/bhyve/mem.h
index 264bff9e82b0..eb648c145df6 100644
--- a/usr.sbin/bhyve/mem.h
+++ b/usr.sbin/bhyve/mem.h
@@ -50,7 +50,8 @@ struct mem_range {
#define MEM_F_RW 0x3
void init_mem(void);
-int emulate_mem(struct vmctx *, int vcpu, uint64_t paddr, struct vie *vie);
+int emulate_mem(struct vmctx *, int vcpu, uint64_t paddr, struct vie *vie,
+ struct vm_guest_paging *paging);
int register_mem(struct mem_range *memp);
int register_mem_fallback(struct mem_range *memp);
diff --git a/usr.sbin/bhyve/mptbl.c b/usr.sbin/bhyve/mptbl.c
index 4c2167e98c85..904d103a51c5 100644
--- a/usr.sbin/bhyve/mptbl.c
+++ b/usr.sbin/bhyve/mptbl.c
@@ -210,7 +210,8 @@ mpt_count_ioint_entries(void)
}
static void
-mpt_generate_pci_int(int bus, int slot, int pin, int ioapic_irq, void *arg)
+mpt_generate_pci_int(int bus, int slot, int pin, int pirq_pin, int ioapic_irq,
+ void *arg)
{
int_entry_ptr *mpiep, mpie;
diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c
index 9f6110730b09..52724bb79369 100644
--- a/usr.sbin/bhyve/pci_ahci.c
+++ b/usr.sbin/bhyve/pci_ahci.c
@@ -598,10 +598,16 @@ handle_identify(struct ahci_port *p, int slot, uint8_t *cfis)
} else {
uint16_t buf[256];
uint64_t sectors;
+ uint16_t cyl;
+ uint8_t sech, heads;
sectors = blockif_size(p->bctx) / blockif_sectsz(p->bctx);
+ blockif_chs(p->bctx, &cyl, &heads, &sech);
memset(buf, 0, sizeof(buf));
buf[0] = 0x0040;
+ buf[1] = cyl;
+ buf[3] = heads;
+ buf[6] = sech;
/* TODO emulate different serial? */
ata_string((uint8_t *)(buf+10), "123456", 20);
ata_string((uint8_t *)(buf+23), "001", 8);
diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c
index 5b87da7f0604..458ba76480b1 100644
--- a/usr.sbin/bhyve/pci_emul.c
+++ b/usr.sbin/bhyve/pci_emul.c
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include "ioapic.h"
#include "mem.h"
#include "pci_emul.h"
+#include "pci_irq.h"
#include "pci_lpc.h"
#define CONF1_ADDR_PORT 0x0cf8
@@ -81,6 +82,7 @@ struct funcinfo {
struct intxinfo {
int ii_count;
+ int ii_pirq_pin;
int ii_ioapic_irq;
};
@@ -113,6 +115,7 @@ static uint64_t pci_emul_membase64;
#define PCI_EMUL_MEMLIMIT64 0xFD00000000UL
static struct pci_devemu *pci_emul_finddev(char *name);
+static void pci_lintr_route(struct pci_devinst *pi);
static void pci_lintr_update(struct pci_devinst *pi);
static struct mem_range pci_mem_hole;
@@ -372,10 +375,27 @@ pci_emul_mem_handler(struct vmctx *ctx, int vcpu, int dir, uint64_t addr,
offset = addr - pdi->pi_bar[bidx].addr;
- if (dir == MEM_F_WRITE)
- (*pe->pe_barwrite)(ctx, vcpu, pdi, bidx, offset, size, *val);
- else
- *val = (*pe->pe_barread)(ctx, vcpu, pdi, bidx, offset, size);
+ if (dir == MEM_F_WRITE) {
+ if (size == 8) {
+ (*pe->pe_barwrite)(ctx, vcpu, pdi, bidx, offset,
+ 4, *val & 0xffffffff);
+ (*pe->pe_barwrite)(ctx, vcpu, pdi, bidx, offset + 4,
+ 4, *val >> 32);
+ } else {
+ (*pe->pe_barwrite)(ctx, vcpu, pdi, bidx, offset,
+ size, *val);
+ }
+ } else {
+ if (size == 8) {
+ *val = (*pe->pe_barread)(ctx, vcpu, pdi, bidx,
+ offset, 4);
+ *val |= (*pe->pe_barread)(ctx, vcpu, pdi, bidx,
+ offset + 4, 4) << 32;
+ } else {
+ *val = (*pe->pe_barread)(ctx, vcpu, pdi, bidx,
+ offset, size);
+ }
+ }
return (0);
}
@@ -697,6 +717,7 @@ pci_emul_init(struct vmctx *ctx, struct pci_devemu *pde, int bus, int slot,
pthread_mutex_init(&pdi->pi_lintr.lock, NULL);
pdi->pi_lintr.pin = 0;
pdi->pi_lintr.state = IDLE;
+ pdi->pi_lintr.pirq_pin = 0;
pdi->pi_lintr.ioapic_irq = 0;
pdi->pi_d = pde;
snprintf(pdi->pi_name, PI_NAMESZ, "%s-pci-%d", pde->pe_emu, slot);
@@ -1067,6 +1088,27 @@ init_pci(struct vmctx *ctx)
}
/*
+ * PCI backends are initialized before routing INTx interrupts
+ * so that LPC devices are able to reserve ISA IRQs before
+ * routing PIRQ pins.
+ */
+ for (bus = 0; bus < MAXBUSES; bus++) {
+ if ((bi = pci_businfo[bus]) == NULL)
+ continue;
+
+ for (slot = 0; slot < MAXSLOTS; slot++) {
+ si = &bi->slotinfo[slot];
+ for (func = 0; func < MAXFUNCS; func++) {
+ fi = &si->si_funcs[func];
+ if (fi->fi_devi == NULL)
+ continue;
+ pci_lintr_route(fi->fi_devi);
+ }
+ }
+ }
+ lpc_pirq_routed();
+
+ /*
* The guest physical memory map looks like the following:
* [0, lowmem) guest system memory
* [lowmem, lowmem_limit) memory hole (may be absent)
@@ -1076,8 +1118,7 @@ init_pci(struct vmctx *ctx)
* Accesses to memory addresses that are not allocated to system
* memory or PCI devices return 0xff's.
*/
- error = vm_get_memory_seg(ctx, 0, &lowmem, NULL);
- assert(error == 0);
+ lowmem = vm_get_lowmem_size(ctx);
memset(&pci_mem_hole, 0, sizeof(struct mem_range));
pci_mem_hole.name = "PCI hole";
@@ -1093,19 +1134,36 @@ init_pci(struct vmctx *ctx)
}
static void
-pci_prt_entry(int bus, int slot, int pin, int ioapic_irq, void *arg)
+pci_apic_prt_entry(int bus, int slot, int pin, int pirq_pin, int ioapic_irq,
+ void *arg)
{
- int *count;
- count = arg;
- dsdt_line(" Package (0x04)");
+ dsdt_line(" Package ()");
dsdt_line(" {");
dsdt_line(" 0x%X,", slot << 16 | 0xffff);
dsdt_line(" 0x%02X,", pin - 1);
dsdt_line(" Zero,");
dsdt_line(" 0x%X", ioapic_irq);
- dsdt_line(" }%s", *count == 1 ? "" : ",");
- (*count)--;
+ dsdt_line(" },");
+}
+
+static void
+pci_pirq_prt_entry(int bus, int slot, int pin, int pirq_pin, int ioapic_irq,
+ void *arg)
+{
+ char *name;
+
+ name = lpc_pirq_name(pirq_pin);
+ if (name == NULL)
+ return;
+ dsdt_line(" Package ()");
+ dsdt_line(" {");
+ dsdt_line(" 0x%X,", slot << 16 | 0xffff);
+ dsdt_line(" 0x%02X,", pin - 1);
+ dsdt_line(" %s,", name);
+ dsdt_line(" 0x00");
+ dsdt_line(" },");
+ free(name);
}
/*
@@ -1118,7 +1176,7 @@ pci_bus_write_dsdt(int bus)
struct businfo *bi;
struct slotinfo *si;
struct pci_devinst *pi;
- int count, slot, func;
+ int count, func, slot;
/*
* If there are no devices on this 'bus' then just return.
@@ -1133,9 +1191,6 @@ pci_bus_write_dsdt(int bus)
return;
}
- dsdt_indent(1);
- dsdt_line("Scope (_SB)");
- dsdt_line("{");
dsdt_line(" Device (PC%02X)", bus);
dsdt_line(" {");
dsdt_line(" Name (_HID, EisaId (\"PNP0A03\"))");
@@ -1228,10 +1283,25 @@ pci_bus_write_dsdt(int bus)
count = pci_count_lintr(bus);
if (count != 0) {
dsdt_indent(2);
- dsdt_line("Name (_PRT, Package (0x%02X)", count);
+ dsdt_line("Name (PPRT, Package ()");
dsdt_line("{");
- pci_walk_lintr(bus, pci_prt_entry, &count);
- dsdt_line("})");
+ pci_walk_lintr(bus, pci_pirq_prt_entry, NULL);
+ dsdt_line("})");
+ dsdt_line("Name (APRT, Package ()");
+ dsdt_line("{");
+ pci_walk_lintr(bus, pci_apic_prt_entry, NULL);
+ dsdt_line("})");
+ dsdt_line("Method (_PRT, 0, NotSerialized)");
+ dsdt_line("{");
+ dsdt_line(" If (PICM)");
+ dsdt_line(" {");
+ dsdt_line(" Return (APRT)");
+ dsdt_line(" }");
+ dsdt_line(" Else");
+ dsdt_line(" {");
+ dsdt_line(" Return (PPRT)");
+ dsdt_line(" }");
+ dsdt_line("}");
dsdt_unindent(2);
}
@@ -1247,8 +1317,6 @@ pci_bus_write_dsdt(int bus)
dsdt_unindent(2);
done:
dsdt_line(" }");
- dsdt_line("}");
- dsdt_unindent(1);
}
void
@@ -1256,8 +1324,19 @@ pci_write_dsdt(void)
{
int bus;
+ dsdt_indent(1);
+ dsdt_line("Name (PICM, 0x00)");
+ dsdt_line("Method (_PIC, 1, NotSerialized)");
+ dsdt_line("{");
+ dsdt_line(" Store (Arg0, PICM)");
+ dsdt_line("}");
+ dsdt_line("");
+ dsdt_line("Scope (_SB)");
+ dsdt_line("{");
for (bus = 0; bus < MAXBUSES; bus++)
pci_bus_write_dsdt(bus);
+ dsdt_line("}");
+ dsdt_unindent(1);
}
int
@@ -1330,18 +1409,19 @@ pci_lintr_permitted(struct pci_devinst *pi)
(cmd & PCIM_CMD_INTxDIS)));
}
-int
+void
pci_lintr_request(struct pci_devinst *pi)
{
struct businfo *bi;
struct slotinfo *si;
- int bestpin, bestcount, irq, pin;
+ int bestpin, bestcount, pin;
bi = pci_businfo[pi->pi_bus];
assert(bi != NULL);
/*
- * First, allocate a pin from our slot.
+ * Just allocate a pin from our slot. The pin will be
+ * assigned IRQs later when interrupts are routed.
*/
si = &bi->slotinfo[pi->pi_slot];
bestpin = 0;
@@ -1353,26 +1433,43 @@ pci_lintr_request(struct pci_devinst *pi)
}
}
- /*
- * Attempt to allocate an I/O APIC pin for this intpin. If
- * 8259A support is added we will need a separate field to
- * assign the intpin to an input pin on the PCI interrupt
- * router.
- */
- if (si->si_intpins[bestpin].ii_count == 0) {
- irq = ioapic_pci_alloc_irq();
- if (irq < 0)
- return (-1);
- si->si_intpins[bestpin].ii_ioapic_irq = irq;
- } else
- irq = si->si_intpins[bestpin].ii_ioapic_irq;
si->si_intpins[bestpin].ii_count++;
-
pi->pi_lintr.pin = bestpin + 1;
- pi->pi_lintr.ioapic_irq = irq;
- pci_set_cfgdata8(pi, PCIR_INTLINE, irq);
pci_set_cfgdata8(pi, PCIR_INTPIN, bestpin + 1);
- return (0);
+}
+
+static void
+pci_lintr_route(struct pci_devinst *pi)
+{
+ struct businfo *bi;
+ struct intxinfo *ii;
+
+ if (pi->pi_lintr.pin == 0)
+ return;
+
+ bi = pci_businfo[pi->pi_bus];
+ assert(bi != NULL);
+ ii = &bi->slotinfo[pi->pi_slot].si_intpins[pi->pi_lintr.pin - 1];
+
+ /*
+ * Attempt to allocate an I/O APIC pin for this intpin if one
+ * is not yet assigned.
+ */
+ if (ii->ii_ioapic_irq == 0)
+ ii->ii_ioapic_irq = ioapic_pci_alloc_irq();
+ assert(ii->ii_ioapic_irq > 0);
+
+ /*
+ * Attempt to allocate a PIRQ pin for this intpin if one is
+ * not yet assigned.
+ */
+ if (ii->ii_pirq_pin == 0)
+ ii->ii_pirq_pin = pirq_alloc_pin(pi->pi_vmctx);
+ assert(ii->ii_pirq_pin > 0);
+
+ pi->pi_lintr.ioapic_irq = ii->ii_ioapic_irq;
+ pi->pi_lintr.pirq_pin = ii->ii_pirq_pin;
+ pci_set_cfgdata8(pi, PCIR_INTLINE, pirq_irq(ii->ii_pirq_pin));
}
void
@@ -1385,8 +1482,7 @@ pci_lintr_assert(struct pci_devinst *pi)
if (pi->pi_lintr.state == IDLE) {
if (pci_lintr_permitted(pi)) {
pi->pi_lintr.state = ASSERTED;
- vm_ioapic_assert_irq(pi->pi_vmctx,
- pi->pi_lintr.ioapic_irq);
+ pci_irq_assert(pi);
} else
pi->pi_lintr.state = PENDING;
}
@@ -1402,7 +1498,7 @@ pci_lintr_deassert(struct pci_devinst *pi)
pthread_mutex_lock(&pi->pi_lintr.lock);
if (pi->pi_lintr.state == ASSERTED) {
pi->pi_lintr.state = IDLE;
- vm_ioapic_deassert_irq(pi->pi_vmctx, pi->pi_lintr.ioapic_irq);
+ pci_irq_deassert(pi);
} else if (pi->pi_lintr.state == PENDING)
pi->pi_lintr.state = IDLE;
pthread_mutex_unlock(&pi->pi_lintr.lock);
@@ -1414,11 +1510,11 @@ pci_lintr_update(struct pci_devinst *pi)
pthread_mutex_lock(&pi->pi_lintr.lock);
if (pi->pi_lintr.state == ASSERTED && !pci_lintr_permitted(pi)) {
- vm_ioapic_deassert_irq(pi->pi_vmctx, pi->pi_lintr.ioapic_irq);
+ pci_irq_deassert(pi);
pi->pi_lintr.state = PENDING;
} else if (pi->pi_lintr.state == PENDING && pci_lintr_permitted(pi)) {
pi->pi_lintr.state = ASSERTED;
- vm_ioapic_assert_irq(pi->pi_vmctx, pi->pi_lintr.ioapic_irq);
+ pci_irq_assert(pi);
}
pthread_mutex_unlock(&pi->pi_lintr.lock);
}
@@ -1458,7 +1554,8 @@ pci_walk_lintr(int bus, pci_lintr_cb cb, void *arg)
for (pin = 0; pin < 4; pin++) {
ii = &si->si_intpins[pin];
if (ii->ii_count != 0)
- cb(bus, slot, pin + 1, ii->ii_ioapic_irq, arg);
+ cb(bus, slot, pin + 1, ii->ii_pirq_pin,
+ ii->ii_ioapic_irq, arg);
}
}
}
@@ -1755,20 +1852,6 @@ INOUT_PORT(pci_cfgdata, CONF1_DATA_PORT+1, IOPORT_F_INOUT, pci_emul_cfgdata);
INOUT_PORT(pci_cfgdata, CONF1_DATA_PORT+2, IOPORT_F_INOUT, pci_emul_cfgdata);
INOUT_PORT(pci_cfgdata, CONF1_DATA_PORT+3, IOPORT_F_INOUT, pci_emul_cfgdata);
-/*
- * I/O ports to configure PCI IRQ routing. We ignore all writes to it.
- */
-static int
-pci_irq_port_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
- uint32_t *eax, void *arg)
-{
- assert(in == 0);
- return (0);
-}
-INOUT_PORT(pci_irq, 0xC00, IOPORT_F_OUT, pci_irq_port_handler);
-INOUT_PORT(pci_irq, 0xC01, IOPORT_F_OUT, pci_irq_port_handler);
-SYSRES_IO(0xC00, 2);
-
#define PCI_EMUL_TEST
#ifdef PCI_EMUL_TEST
/*
diff --git a/usr.sbin/bhyve/pci_emul.h b/usr.sbin/bhyve/pci_emul.h
index e1040a8b715a..866ffc5b8224 100644
--- a/usr.sbin/bhyve/pci_emul.h
+++ b/usr.sbin/bhyve/pci_emul.h
@@ -120,6 +120,7 @@ struct pci_devinst {
struct {
int8_t pin;
enum lintr_stat state;
+ int pirq_pin;
int ioapic_irq;
pthread_mutex_t lock;
} pi_lintr;
@@ -200,7 +201,8 @@ struct pciecap {
uint16_t slot_status2;
} __packed;
-typedef void (*pci_lintr_cb)(int b, int s, int pin, int ioapic_irq, void *arg);
+typedef void (*pci_lintr_cb)(int b, int s, int pin, int pirq_pin,
+ int ioapic_irq, void *arg);
int init_pci(struct vmctx *ctx);
void msicap_cfgwrite(struct pci_devinst *pi, int capoff, int offset,
@@ -218,7 +220,7 @@ void pci_generate_msi(struct pci_devinst *pi, int msgnum);
void pci_generate_msix(struct pci_devinst *pi, int msgnum);
void pci_lintr_assert(struct pci_devinst *pi);
void pci_lintr_deassert(struct pci_devinst *pi);
-int pci_lintr_request(struct pci_devinst *pi);
+void pci_lintr_request(struct pci_devinst *pi);
int pci_msi_enabled(struct pci_devinst *pi);
int pci_msix_enabled(struct pci_devinst *pi);
int pci_msix_table_bar(struct pci_devinst *pi);
diff --git a/usr.sbin/bhyve/pci_irq.c b/usr.sbin/bhyve/pci_irq.c
new file mode 100644
index 000000000000..653aeb0ff1f6
--- /dev/null
+++ b/usr.sbin/bhyve/pci_irq.c
@@ -0,0 +1,349 @@
+/*-
+ * Copyright (c) 2014 Advanced Computing Technologies LLC
+ * Written by: John H. Baldwin <jhb@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <machine/vmm.h>
+
+#include <assert.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <vmmapi.h>
+
+#include "acpi.h"
+#include "inout.h"
+#include "pci_emul.h"
+#include "pci_irq.h"
+#include "pci_lpc.h"
+
+/*
+ * Implement an 8 pin PCI interrupt router compatible with the router
+ * present on Intel's ICH10 chip.
+ */
+
+/* Fields in each PIRQ register. */
+#define PIRQ_DIS 0x80
+#define PIRQ_IRQ 0x0f
+
+/* Only IRQs 3-7, 9-12, and 14-15 are permitted. */
+#define PERMITTED_IRQS 0xdef8
+#define IRQ_PERMITTED(irq) (((1U << (irq)) & PERMITTED_IRQS) != 0)
+
+/* IRQ count to disable an IRQ. */
+#define IRQ_DISABLED 0xff
+
+static struct pirq {
+ uint8_t reg;
+ int use_count;
+ int active_count;
+ pthread_mutex_t lock;
+} pirqs[8];
+
+static u_char irq_counts[16];
+static int pirq_cold = 1;
+
+/*
+ * Returns true if this pin is enabled with a valid IRQ. Setting the
+ * register to a reserved IRQ causes interrupts to not be asserted as
+ * if the pin was disabled.
+ */
+static bool
+pirq_valid_irq(int reg)
+{
+
+ if (reg & PIRQ_DIS)
+ return (false);
+ return (IRQ_PERMITTED(reg & PIRQ_IRQ));
+}
+
+uint8_t
+pirq_read(int pin)
+{
+
+ assert(pin > 0 && pin <= nitems(pirqs));
+ return (pirqs[pin - 1].reg);
+}
+
+void
+pirq_write(struct vmctx *ctx, int pin, uint8_t val)
+{
+ struct pirq *pirq;
+
+ assert(pin > 0 && pin <= nitems(pirqs));
+ pirq = &pirqs[pin - 1];
+ pthread_mutex_lock(&pirq->lock);
+ if (pirq->reg != (val & (PIRQ_DIS | PIRQ_IRQ))) {
+ if (pirq->active_count != 0 && pirq_valid_irq(pirq->reg))
+ vm_isa_deassert_irq(ctx, pirq->reg & PIRQ_IRQ, -1);
+ pirq->reg = val & (PIRQ_DIS | PIRQ_IRQ);
+ if (pirq->active_count != 0 && pirq_valid_irq(pirq->reg))
+ vm_isa_assert_irq(ctx, pirq->reg & PIRQ_IRQ, -1);
+ }
+ pthread_mutex_unlock(&pirq->lock);
+}
+
+void
+pci_irq_reserve(int irq)
+{
+
+ assert(irq < nitems(irq_counts));
+ assert(pirq_cold);
+ assert(irq_counts[irq] == 0 || irq_counts[irq] == IRQ_DISABLED);
+ irq_counts[irq] = IRQ_DISABLED;
+}
+
+void
+pci_irq_use(int irq)
+{
+
+ assert(irq < nitems(irq_counts));
+ assert(pirq_cold);
+ if (irq_counts[irq] != IRQ_DISABLED)
+ irq_counts[irq]++;
+}
+
+void
+pci_irq_init(struct vmctx *ctx)
+{
+ int i;
+
+ for (i = 0; i < nitems(pirqs); i++) {
+ pirqs[i].reg = PIRQ_DIS;
+ pirqs[i].use_count = 0;
+ pirqs[i].active_count = 0;
+ pthread_mutex_init(&pirqs[i].lock, NULL);
+ }
+ for (i = 0; i < nitems(irq_counts); i++) {
+ if (IRQ_PERMITTED(i))
+ irq_counts[i] = 0;
+ else
+ irq_counts[i] = IRQ_DISABLED;
+ }
+}
+
+void
+pci_irq_assert(struct pci_devinst *pi)
+{
+ struct pirq *pirq;
+
+ if (pi->pi_lintr.pirq_pin > 0) {
+ assert(pi->pi_lintr.pirq_pin <= nitems(pirqs));
+ pirq = &pirqs[pi->pi_lintr.pirq_pin - 1];
+ pthread_mutex_lock(&pirq->lock);
+ pirq->active_count++;
+ if (pirq->active_count == 1 && pirq_valid_irq(pirq->reg)) {
+ vm_isa_assert_irq(pi->pi_vmctx, pirq->reg & PIRQ_IRQ,
+ pi->pi_lintr.ioapic_irq);
+ pthread_mutex_unlock(&pirq->lock);
+ return;
+ }
+ pthread_mutex_unlock(&pirq->lock);
+ }
+ vm_ioapic_assert_irq(pi->pi_vmctx, pi->pi_lintr.ioapic_irq);
+}
+
+void
+pci_irq_deassert(struct pci_devinst *pi)
+{
+ struct pirq *pirq;
+
+ if (pi->pi_lintr.pirq_pin > 0) {
+ assert(pi->pi_lintr.pirq_pin <= nitems(pirqs));
+ pirq = &pirqs[pi->pi_lintr.pirq_pin - 1];
+ pthread_mutex_lock(&pirq->lock);
+ pirq->active_count--;
+ if (pirq->active_count == 0 && pirq_valid_irq(pirq->reg)) {
+ vm_isa_deassert_irq(pi->pi_vmctx, pirq->reg & PIRQ_IRQ,
+ pi->pi_lintr.ioapic_irq);
+ pthread_mutex_unlock(&pirq->lock);
+ return;
+ }
+ pthread_mutex_unlock(&pirq->lock);
+ }
+ vm_ioapic_deassert_irq(pi->pi_vmctx, pi->pi_lintr.ioapic_irq);
+}
+
+int
+pirq_alloc_pin(struct vmctx *ctx)
+{
+ int best_count, best_irq, best_pin, irq, pin;
+
+ pirq_cold = 1;
+
+ /* First, find the least-used PIRQ pin. */
+ best_pin = 0;
+ best_count = pirqs[0].use_count;
+ for (pin = 1; pin < nitems(pirqs); pin++) {
+ if (pirqs[pin].use_count < best_count) {
+ best_pin = pin;
+ best_count = pirqs[pin].use_count;
+ }
+ }
+ pirqs[best_pin].use_count++;
+
+ /* Second, route this pin to an IRQ. */
+ if (pirqs[best_pin].reg == PIRQ_DIS) {
+ best_irq = -1;
+ best_count = 0;
+ for (irq = 0; irq < nitems(irq_counts); irq++) {
+ if (irq_counts[irq] == IRQ_DISABLED)
+ continue;
+ if (best_irq == -1 || irq_counts[irq] < best_count) {
+ best_irq = irq;
+ best_count = irq_counts[irq];
+ }
+ }
+ assert(best_irq != 0);
+ irq_counts[best_irq]++;
+ pirqs[best_pin].reg = best_irq;
+ vm_isa_set_irq_trigger(ctx, best_irq, LEVEL_TRIGGER);
+ }
+
+ return (best_pin + 1);
+}
+
+int
+pirq_irq(int pin)
+{
+
+ if (pin == -1)
+ return (255);
+ assert(pin > 0 && pin <= nitems(pirqs));
+ return (pirqs[pin - 1].reg & PIRQ_IRQ);
+}
+
+/* XXX: Generate $PIR table. */
+
+static void
+pirq_dsdt(void)
+{
+ char *irq_prs, *old;
+ int irq, pin;
+
+ irq_prs = NULL;
+ for (irq = 0; irq < nitems(irq_counts); irq++) {
+ if (!IRQ_PERMITTED(irq))
+ continue;
+ if (irq_prs == NULL)
+ asprintf(&irq_prs, "%d", irq);
+ else {
+ old = irq_prs;
+ asprintf(&irq_prs, "%s,%d", old, irq);
+ free(old);
+ }
+ }
+
+ /*
+ * A helper method to validate a link register's value. This
+ * duplicates pirq_valid_irq().
+ */
+ dsdt_line("");
+ dsdt_line("Method (PIRV, 1, NotSerialized)");
+ dsdt_line("{");
+ dsdt_line(" If (And (Arg0, 0x%02X))", PIRQ_DIS);
+ dsdt_line(" {");
+ dsdt_line(" Return (0x00)");
+ dsdt_line(" }");
+ dsdt_line(" And (Arg0, 0x%02X, Local0)", PIRQ_IRQ);
+ dsdt_line(" If (LLess (Local0, 0x03))");
+ dsdt_line(" {");
+ dsdt_line(" Return (0x00)");
+ dsdt_line(" }");
+ dsdt_line(" If (LEqual (Local0, 0x08))");
+ dsdt_line(" {");
+ dsdt_line(" Return (0x00)");
+ dsdt_line(" }");
+ dsdt_line(" If (LEqual (Local0, 0x0D))");
+ dsdt_line(" {");
+ dsdt_line(" Return (0x00)");
+ dsdt_line(" }");
+ dsdt_line(" Return (0x01)");
+ dsdt_line("}");
+
+ for (pin = 0; pin < nitems(pirqs); pin++) {
+ dsdt_line("");
+ dsdt_line("Device (LNK%c)", 'A' + pin);
+ dsdt_line("{");
+ dsdt_line(" Name (_HID, EisaId (\"PNP0C0F\"))");
+ dsdt_line(" Name (_UID, 0x%02X)", pin + 1);
+ dsdt_line(" Method (_STA, 0, NotSerialized)");
+ dsdt_line(" {");
+ dsdt_line(" If (PIRV (PIR%c))", 'A' + pin);
+ dsdt_line(" {");
+ dsdt_line(" Return (0x0B)");
+ dsdt_line(" }");
+ dsdt_line(" Else");
+ dsdt_line(" {");
+ dsdt_line(" Return (0x09)");
+ dsdt_line(" }");
+ dsdt_line(" }");
+ dsdt_line(" Name (_PRS, ResourceTemplate ()");
+ dsdt_line(" {");
+ dsdt_line(" IRQ (Level, ActiveLow, Shared, )");
+ dsdt_line(" {%s}", irq_prs);
+ dsdt_line(" })");
+ dsdt_line(" Name (CB%02X, ResourceTemplate ()", pin + 1);
+ dsdt_line(" {");
+ dsdt_line(" IRQ (Level, ActiveLow, Shared, )");
+ dsdt_line(" {}");
+ dsdt_line(" })");
+ dsdt_line(" CreateWordField (CB%02X, 0x01, CIR%c)",
+ pin + 1, 'A' + pin);
+ dsdt_line(" Method (_CRS, 0, NotSerialized)");
+ dsdt_line(" {");
+ dsdt_line(" And (PIR%c, 0x%02X, Local0)", 'A' + pin,
+ PIRQ_DIS | PIRQ_IRQ);
+ dsdt_line(" If (PIRV (Local0))");
+ dsdt_line(" {");
+ dsdt_line(" ShiftLeft (0x01, Local0, CIR%c)", 'A' + pin);
+ dsdt_line(" }");
+ dsdt_line(" Else");
+ dsdt_line(" {");
+ dsdt_line(" Store (0x00, CIR%c)", 'A' + pin);
+ dsdt_line(" }");
+ dsdt_line(" Return (CB%02X)", pin + 1);
+ dsdt_line(" }");
+ dsdt_line(" Method (_DIS, 0, NotSerialized)");
+ dsdt_line(" {");
+ dsdt_line(" Store (0x80, PIR%c)", 'A' + pin);
+ dsdt_line(" }");
+ dsdt_line(" Method (_SRS, 1, NotSerialized)");
+ dsdt_line(" {");
+ dsdt_line(" CreateWordField (Arg0, 0x01, SIR%c)", 'A' + pin);
+ dsdt_line(" FindSetRightBit (SIR%c, Local0)", 'A' + pin);
+ dsdt_line(" Store (Decrement (Local0), PIR%c)", 'A' + pin);
+ dsdt_line(" }");
+ dsdt_line("}");
+ }
+ free(irq_prs);
+}
+LPC_DSDT(pirq_dsdt);
diff --git a/usr.sbin/bhyve/pci_irq.h b/usr.sbin/bhyve/pci_irq.h
new file mode 100644
index 000000000000..9d331a5d6321
--- /dev/null
+++ b/usr.sbin/bhyve/pci_irq.h
@@ -0,0 +1,45 @@
+/*-
+ * Copyright (c) 2014 Advanced Computing Technologies LLC
+ * Written by: John H. Baldwin <jhb@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef __PCI_IRQ_H__
+#define __PCI_IRQ_H__
+
+struct pci_devinst;
+
+void pci_irq_assert(struct pci_devinst *pi);
+void pci_irq_deassert(struct pci_devinst *pi);
+void pci_irq_init(struct vmctx *ctx);
+void pci_irq_reserve(int irq);
+void pci_irq_use(int irq);
+int pirq_alloc_pin(struct vmctx *ctx);
+int pirq_irq(int pin);
+uint8_t pirq_read(int pin);
+void pirq_write(struct vmctx *ctx, int pin, uint8_t val);
+
+#endif
diff --git a/usr.sbin/bhyve/pci_lpc.c b/usr.sbin/bhyve/pci_lpc.c
index f5e4a697c83a..e98b1411dfcd 100644
--- a/usr.sbin/bhyve/pci_lpc.c
+++ b/usr.sbin/bhyve/pci_lpc.c
@@ -32,7 +32,6 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <machine/vmm.h>
-#include <machine/vmm_dev.h>
#include <stdio.h>
#include <stdlib.h>
@@ -43,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include "acpi.h"
#include "inout.h"
#include "pci_emul.h"
+#include "pci_irq.h"
#include "pci_lpc.h"
#include "uart_emul.h"
@@ -173,6 +173,7 @@ lpc_init(void)
"LPC device %s\n", name);
return (-1);
}
+ pci_irq_reserve(sc->irq);
sc->uart_softc = uart_init(lpc_uart_intr_assert,
lpc_uart_intr_deassert, sc);
@@ -208,7 +209,21 @@ pci_lpc_write_dsdt(struct pci_devinst *pi)
dsdt_line("Device (ISA)");
dsdt_line("{");
dsdt_line(" Name (_ADR, 0x%04X%04X)", pi->pi_slot, pi->pi_func);
- dsdt_line(" OperationRegion (P40C, PCI_Config, 0x60, 0x04)");
+ dsdt_line(" OperationRegion (LPCR, PCI_Config, 0x00, 0x100)");
+ dsdt_line(" Field (LPCR, AnyAcc, NoLock, Preserve)");
+ dsdt_line(" {");
+ dsdt_line(" Offset (0x60),");
+ dsdt_line(" PIRA, 8,");
+ dsdt_line(" PIRB, 8,");
+ dsdt_line(" PIRC, 8,");
+ dsdt_line(" PIRD, 8,");
+ dsdt_line(" Offset (0x68),");
+ dsdt_line(" PIRE, 8,");
+ dsdt_line(" PIRF, 8,");
+ dsdt_line(" PIRG, 8,");
+ dsdt_line(" PIRH, 8");
+ dsdt_line(" }");
+ dsdt_line("");
dsdt_indent(1);
SET_FOREACH(ldpp, lpc_dsdt_set) {
@@ -305,13 +320,34 @@ pci_lpc_uart_dsdt(void)
}
LPC_DSDT(pci_lpc_uart_dsdt);
+static int
+pci_lpc_cfgwrite(struct vmctx *ctx, int vcpu, struct pci_devinst *pi,
+ int coff, int bytes, uint32_t val)
+{
+ int pirq_pin;
+
+ if (bytes == 1) {
+ pirq_pin = 0;
+ if (coff >= 0x60 && coff <= 0x63)
+ pirq_pin = coff - 0x60 + 1;
+ if (coff >= 0x68 && coff <= 0x6b)
+ pirq_pin = coff - 0x68 + 5;
+ if (pirq_pin != 0) {
+ pirq_write(ctx, pirq_pin, val);
+ pci_set_cfgdata8(pi, coff, pirq_read(pirq_pin));
+ return (0);
+ }
+ }
+ return (-1);
+}
+
static void
pci_lpc_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi,
int baridx, uint64_t offset, int size, uint64_t value)
{
}
-uint64_t
+static uint64_t
pci_lpc_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi,
int baridx, uint64_t offset, int size)
{
@@ -324,6 +360,7 @@ pci_lpc_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi,
static int
pci_lpc_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts)
{
+
/*
* Do not allow more than one LPC bridge to be configured.
*/
@@ -356,10 +393,36 @@ pci_lpc_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts)
return (0);
}
+char *
+lpc_pirq_name(int pin)
+{
+ char *name;
+
+ if (lpc_bridge == NULL)
+ return (NULL);
+ asprintf(&name, "\\_SB.PC00.ISA.LNK%c,", 'A' + pin - 1);
+ return (name);
+}
+
+void
+lpc_pirq_routed(void)
+{
+ int pin;
+
+ if (lpc_bridge == NULL)
+ return;
+
+ for (pin = 0; pin < 4; pin++)
+ pci_set_cfgdata8(lpc_bridge, 0x60 + pin, pirq_read(pin + 1));
+ for (pin = 0; pin < 4; pin++)
+ pci_set_cfgdata8(lpc_bridge, 0x68 + pin, pirq_read(pin + 5));
+}
+
struct pci_devemu pci_de_lpc = {
.pe_emu = "lpc",
.pe_init = pci_lpc_init,
.pe_write_dsdt = pci_lpc_write_dsdt,
+ .pe_cfgwrite = pci_lpc_cfgwrite,
.pe_barwrite = pci_lpc_write,
.pe_barread = pci_lpc_read
};
diff --git a/usr.sbin/bhyve/pci_lpc.h b/usr.sbin/bhyve/pci_lpc.h
index e45bcb97e4d6..55a58653f422 100644
--- a/usr.sbin/bhyve/pci_lpc.h
+++ b/usr.sbin/bhyve/pci_lpc.h
@@ -66,5 +66,7 @@ struct lpc_sysres {
#define SYSRES_MEM(base, length) LPC_SYSRES(LPC_SYSRES_MEM, base, length)
int lpc_device_parse(const char *opt);
+char *lpc_pirq_name(int pin);
+void lpc_pirq_routed(void);
#endif
diff --git a/usr.sbin/bhyve/pci_virtio_block.c b/usr.sbin/bhyve/pci_virtio_block.c
index 3474fd7fb88d..cf1c65557015 100644
--- a/usr.sbin/bhyve/pci_virtio_block.c
+++ b/usr.sbin/bhyve/pci_virtio_block.c
@@ -52,10 +52,6 @@ __FBSDID("$FreeBSD$");
#include "pci_emul.h"
#include "virtio.h"
-#ifndef min
-#define min(a, b) ((a) < (b) ? (a) : (b))
-#endif
-
#define VTBLK_RINGSZ 64
#define VTBLK_MAXSEGS 32
@@ -217,7 +213,7 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vqueue_info *vq)
case VBH_OP_IDENT:
/* Assume a single buffer */
strlcpy(iov[1].iov_base, sc->vbsc_ident,
- min(iov[1].iov_len, sizeof(sc->vbsc_ident)));
+ MIN(iov[1].iov_len, sizeof(sc->vbsc_ident)));
err = 0;
break;
default:
diff --git a/usr.sbin/bhyve/pm.c b/usr.sbin/bhyve/pm.c
index 99087e44d8c6..f5a2d438be7f 100644
--- a/usr.sbin/bhyve/pm.c
+++ b/usr.sbin/bhyve/pm.c
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include <machine/vmm.h>
#include <assert.h>
+#include <errno.h>
#include <pthread.h>
#include <signal.h>
#include <vmmapi.h>
@@ -39,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include "acpi.h"
#include "inout.h"
#include "mevent.h"
+#include "pci_irq.h"
#include "pci_lpc.h"
static pthread_mutex_t pm_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -55,6 +57,8 @@ static int
reset_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
uint32_t *eax, void *arg)
{
+ int error;
+
static uint8_t reset_control;
if (bytes != 1)
@@ -65,8 +69,10 @@ reset_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
reset_control = *eax;
/* Treat hard and soft resets the same. */
- if (reset_control & 0x4)
- return (INOUT_RESET);
+ if (reset_control & 0x4) {
+ error = vm_suspend(ctx, VM_SUSPEND_RESET);
+ assert(error == 0 || errno == EALREADY);
+ }
}
return (0);
}
@@ -223,6 +229,7 @@ static int
pm1_control_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
uint32_t *eax, void *arg)
{
+ int error;
if (bytes != 2)
return (-1);
@@ -242,8 +249,10 @@ pm1_control_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
* says that '5' should be stored in SLP_TYP for S5.
*/
if (*eax & PM1_SLP_EN) {
- if ((pm1_control & PM1_SLP_TYP) >> 10 == 5)
- return (INOUT_POWEROFF);
+ if ((pm1_control & PM1_SLP_TYP) >> 10 == 5) {
+ error = vm_suspend(ctx, VM_SUSPEND_POWEROFF);
+ assert(error == 0 || errno == EALREADY);
+ }
}
}
return (0);
@@ -289,3 +298,15 @@ smi_cmd_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
}
INOUT_PORT(smi_cmd, SMI_CMD, IOPORT_F_OUT, smi_cmd_handler);
SYSRES_IO(SMI_CMD, 1);
+
+void
+sci_init(struct vmctx *ctx)
+{
+
+ /*
+ * Mark ACPI's SCI as level trigger and bump its use count
+ * in the PIRQ router.
+ */
+ pci_irq_use(SCI_INT);
+ vm_isa_set_irq_trigger(ctx, SCI_INT, LEVEL_TRIGGER);
+}
diff --git a/usr.sbin/bhyve/rtc.c b/usr.sbin/bhyve/rtc.c
index 11877479807c..b3631fc07228 100644
--- a/usr.sbin/bhyve/rtc.c
+++ b/usr.sbin/bhyve/rtc.c
@@ -343,19 +343,14 @@ rtc_init(struct vmctx *ctx)
* 0x34/0x35 - 64KB chunks above 16MB, below 4GB
* 0x5b/0x5c/0x5d - 64KB chunks above 4GB
*/
- err = vm_get_memory_seg(ctx, 0, &lomem, NULL);
- assert(err == 0);
-
- lomem = (lomem - m_16MB) / m_64KB;
+ lomem = (vm_get_lowmem_size(ctx) - m_16MB) / m_64KB;
rtc_nvram[nvoff(RTC_LMEM_LSB)] = lomem;
rtc_nvram[nvoff(RTC_LMEM_MSB)] = lomem >> 8;
- if (vm_get_memory_seg(ctx, m_4GB, &himem, NULL) == 0) {
- himem /= m_64KB;
- rtc_nvram[nvoff(RTC_HMEM_LSB)] = himem;
- rtc_nvram[nvoff(RTC_HMEM_SB)] = himem >> 8;
- rtc_nvram[nvoff(RTC_HMEM_MSB)] = himem >> 16;
- }
+ himem = vm_get_highmem_size(ctx) / m_64KB;
+ rtc_nvram[nvoff(RTC_HMEM_LSB)] = himem;
+ rtc_nvram[nvoff(RTC_HMEM_SB)] = himem >> 8;
+ rtc_nvram[nvoff(RTC_HMEM_MSB)] = himem >> 16;
}
INOUT_PORT(rtc, IO_RTC, IOPORT_F_INOUT, rtc_addr_handler);
diff --git a/usr.sbin/bhyve/smbiostbl.c b/usr.sbin/bhyve/smbiostbl.c
index 9d1cfb3198be..28c7eb2c74b4 100644
--- a/usr.sbin/bhyve/smbiostbl.c
+++ b/usr.sbin/bhyve/smbiostbl.c
@@ -321,8 +321,8 @@ struct smbios_table_type0 smbios_type0_template = {
const char *smbios_type0_strings[] = {
"BHYVE", /* vendor string */
- __TIME__, /* bios version string */
- __DATE__, /* bios release date string */
+ "1.00", /* bios version string */
+ "03/14/2014", /* bios release date string */
NULL
};
@@ -779,13 +779,8 @@ smbios_build(struct vmctx *ctx)
int i;
int err;
- err = vm_get_memory_seg(ctx, 0, &guest_lomem, NULL);
- if (err != 0)
- return (err);
-
- err = vm_get_memory_seg(ctx, 4*GB, &guest_himem, NULL);
- if (err != 0)
- return (err);
+ guest_lomem = vm_get_lowmem_size(ctx);
+ guest_himem = vm_get_highmem_size(ctx);
startaddr = paddr_guest2host(ctx, SMBIOS_BASE, SMBIOS_MAX_LENGTH);
if (startaddr == NULL) {
diff --git a/usr.sbin/bhyve/task_switch.c b/usr.sbin/bhyve/task_switch.c
new file mode 100644
index 000000000000..0002da8df8ef
--- /dev/null
+++ b/usr.sbin/bhyve/task_switch.c
@@ -0,0 +1,932 @@
+/*-
+ * Copyright (c) 2014 Neel Natu <neel@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (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 <sys/param.h>
+#include <sys/_iovec.h>
+#include <sys/mman.h>
+
+#include <x86/psl.h>
+#include <x86/segments.h>
+#include <x86/specialreg.h>
+#include <machine/vmm.h>
+#include <machine/vmm_instruction_emul.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <errno.h>
+
+#include <vmmapi.h>
+
+#include "bhyverun.h"
+
+/*
+ * Using 'struct i386tss' is tempting but causes myriad sign extension
+ * issues because all of its fields are defined as signed integers.
+ */
+struct tss32 {
+ uint16_t tss_link;
+ uint16_t rsvd1;
+ uint32_t tss_esp0;
+ uint16_t tss_ss0;
+ uint16_t rsvd2;
+ uint32_t tss_esp1;
+ uint16_t tss_ss1;
+ uint16_t rsvd3;
+ uint32_t tss_esp2;
+ uint16_t tss_ss2;
+ uint16_t rsvd4;
+ uint32_t tss_cr3;
+ uint32_t tss_eip;
+ uint32_t tss_eflags;
+ uint32_t tss_eax;
+ uint32_t tss_ecx;
+ uint32_t tss_edx;
+ uint32_t tss_ebx;
+ uint32_t tss_esp;
+ uint32_t tss_ebp;
+ uint32_t tss_esi;
+ uint32_t tss_edi;
+ uint16_t tss_es;
+ uint16_t rsvd5;
+ uint16_t tss_cs;
+ uint16_t rsvd6;
+ uint16_t tss_ss;
+ uint16_t rsvd7;
+ uint16_t tss_ds;
+ uint16_t rsvd8;
+ uint16_t tss_fs;
+ uint16_t rsvd9;
+ uint16_t tss_gs;
+ uint16_t rsvd10;
+ uint16_t tss_ldt;
+ uint16_t rsvd11;
+ uint16_t tss_trap;
+ uint16_t tss_iomap;
+};
+CTASSERT(sizeof(struct tss32) == 104);
+
+#define SEL_START(sel) (((sel) & ~0x7))
+#define SEL_LIMIT(sel) (((sel) | 0x7))
+#define TSS_BUSY(type) (((type) & 0x2) != 0)
+
+static uint64_t
+GETREG(struct vmctx *ctx, int vcpu, int reg)
+{
+ uint64_t val;
+ int error;
+
+ error = vm_get_register(ctx, vcpu, reg, &val);
+ assert(error == 0);
+ return (val);
+}
+
+static void
+SETREG(struct vmctx *ctx, int vcpu, int reg, uint64_t val)
+{
+ int error;
+
+ error = vm_set_register(ctx, vcpu, reg, val);
+ assert(error == 0);
+}
+
+static struct seg_desc
+usd_to_seg_desc(struct user_segment_descriptor *usd)
+{
+ struct seg_desc seg_desc;
+
+ seg_desc.base = (u_int)USD_GETBASE(usd);
+ if (usd->sd_gran)
+ seg_desc.limit = (u_int)(USD_GETLIMIT(usd) << 12) | 0xfff;
+ else
+ seg_desc.limit = (u_int)USD_GETLIMIT(usd);
+ seg_desc.access = usd->sd_type | usd->sd_dpl << 5 | usd->sd_p << 7;
+ seg_desc.access |= usd->sd_xx << 12;
+ seg_desc.access |= usd->sd_def32 << 14;
+ seg_desc.access |= usd->sd_gran << 15;
+
+ return (seg_desc);
+}
+
+/*
+ * Inject an exception with an error code that is a segment selector.
+ * The format of the error code is described in section 6.13, "Error Code",
+ * Intel SDM volume 3.
+ *
+ * Bit 0 (EXT) denotes whether the exception occurred during delivery
+ * of an external event like an interrupt.
+ *
+ * Bit 1 (IDT) indicates whether the selector points to a gate descriptor
+ * in the IDT.
+ *
+ * Bit 2(GDT/LDT) has the usual interpretation of Table Indicator (TI).
+ */
+static void
+sel_exception(struct vmctx *ctx, int vcpu, int vector, uint16_t sel, int ext)
+{
+ /*
+ * Bit 2 from the selector is retained as-is in the error code.
+ *
+ * Bit 1 can be safely cleared because none of the selectors
+ * encountered during task switch emulation refer to a task
+ * gate in the IDT.
+ *
+ * Bit 0 is set depending on the value of 'ext'.
+ */
+ sel &= ~0x3;
+ if (ext)
+ sel |= 0x1;
+ vm_inject_fault(ctx, vcpu, vector, 1, sel);
+}
+
+/*
+ * Return 0 if the selector 'sel' in within the limits of the GDT/LDT
+ * and non-zero otherwise.
+ */
+static int
+desc_table_limit_check(struct vmctx *ctx, int vcpu, uint16_t sel)
+{
+ uint64_t base;
+ uint32_t limit, access;
+ int error, reg;
+
+ reg = ISLDT(sel) ? VM_REG_GUEST_LDTR : VM_REG_GUEST_GDTR;
+ error = vm_get_desc(ctx, vcpu, reg, &base, &limit, &access);
+ assert(error == 0);
+
+ if (reg == VM_REG_GUEST_LDTR) {
+ if (SEG_DESC_UNUSABLE(access) || !SEG_DESC_PRESENT(access))
+ return (-1);
+ }
+
+ if (limit < SEL_LIMIT(sel))
+ return (-1);
+ else
+ return (0);
+}
+
+/*
+ * Read/write the segment descriptor 'desc' into the GDT/LDT slot referenced
+ * by the selector 'sel'.
+ *
+ * Returns 0 on success.
+ * Returns 1 if an exception was injected into the guest.
+ * Returns -1 otherwise.
+ */
+static int
+desc_table_rw(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging,
+ uint16_t sel, struct user_segment_descriptor *desc, bool doread)
+{
+ struct iovec iov[2];
+ uint64_t base;
+ uint32_t limit, access;
+ int error, reg;
+
+ reg = ISLDT(sel) ? VM_REG_GUEST_LDTR : VM_REG_GUEST_GDTR;
+ error = vm_get_desc(ctx, vcpu, reg, &base, &limit, &access);
+ assert(error == 0);
+ assert(limit >= SEL_LIMIT(sel));
+
+ error = vm_copy_setup(ctx, vcpu, paging, base + SEL_START(sel),
+ sizeof(*desc), doread ? PROT_READ : PROT_WRITE, iov, nitems(iov));
+ if (error == 0) {
+ if (doread)
+ vm_copyin(ctx, vcpu, iov, desc, sizeof(*desc));
+ else
+ vm_copyout(ctx, vcpu, desc, iov, sizeof(*desc));
+ }
+ return (error);
+}
+
+static int
+desc_table_read(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging,
+ uint16_t sel, struct user_segment_descriptor *desc)
+{
+ return (desc_table_rw(ctx, vcpu, paging, sel, desc, true));
+}
+
+static int
+desc_table_write(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging,
+ uint16_t sel, struct user_segment_descriptor *desc)
+{
+ return (desc_table_rw(ctx, vcpu, paging, sel, desc, false));
+}
+
+/*
+ * Read the TSS descriptor referenced by 'sel' into 'desc'.
+ *
+ * Returns 0 on success.
+ * Returns 1 if an exception was injected into the guest.
+ * Returns -1 otherwise.
+ */
+static int
+read_tss_descriptor(struct vmctx *ctx, int vcpu, struct vm_task_switch *ts,
+ uint16_t sel, struct user_segment_descriptor *desc)
+{
+ struct vm_guest_paging sup_paging;
+ int error;
+
+ assert(!ISLDT(sel));
+ assert(IDXSEL(sel) != 0);
+
+ /* Fetch the new TSS descriptor */
+ if (desc_table_limit_check(ctx, vcpu, sel)) {
+ if (ts->reason == TSR_IRET)
+ sel_exception(ctx, vcpu, IDT_TS, sel, ts->ext);
+ else
+ sel_exception(ctx, vcpu, IDT_GP, sel, ts->ext);
+ return (1);
+ }
+
+ sup_paging = ts->paging;
+ sup_paging.cpl = 0; /* implicit supervisor mode */
+ error = desc_table_read(ctx, vcpu, &sup_paging, sel, desc);
+ return (error);
+}
+
+static bool
+code_desc(int sd_type)
+{
+ /* code descriptor */
+ return ((sd_type & 0x18) == 0x18);
+}
+
+static bool
+stack_desc(int sd_type)
+{
+ /* writable data descriptor */
+ return ((sd_type & 0x1A) == 0x12);
+}
+
+static bool
+data_desc(int sd_type)
+{
+ /* data descriptor or a readable code descriptor */
+ return ((sd_type & 0x18) == 0x10 || (sd_type & 0x1A) == 0x1A);
+}
+
+static bool
+ldt_desc(int sd_type)
+{
+
+ return (sd_type == SDT_SYSLDT);
+}
+
+/*
+ * Validate the descriptor 'seg_desc' associated with 'segment'.
+ *
+ * Returns 0 on success.
+ * Returns 1 if an exception was injected into the guest.
+ * Returns -1 otherwise.
+ */
+static int
+validate_seg_desc(struct vmctx *ctx, int vcpu, struct vm_task_switch *ts,
+ int segment, struct seg_desc *seg_desc)
+{
+ struct vm_guest_paging sup_paging;
+ struct user_segment_descriptor usd;
+ int error, idtvec;
+ int cpl, dpl, rpl;
+ uint16_t sel, cs;
+ bool ldtseg, codeseg, stackseg, dataseg, conforming;
+
+ ldtseg = codeseg = stackseg = dataseg = false;
+ switch (segment) {
+ case VM_REG_GUEST_LDTR:
+ ldtseg = true;
+ break;
+ case VM_REG_GUEST_CS:
+ codeseg = true;
+ break;
+ case VM_REG_GUEST_SS:
+ stackseg = true;
+ break;
+ case VM_REG_GUEST_DS:
+ case VM_REG_GUEST_ES:
+ case VM_REG_GUEST_FS:
+ case VM_REG_GUEST_GS:
+ dataseg = true;
+ break;
+ default:
+ assert(0);
+ }
+
+ /* Get the segment selector */
+ sel = GETREG(ctx, vcpu, segment);
+
+ /* LDT selector must point into the GDT */
+ if (ldtseg && ISLDT(sel)) {
+ sel_exception(ctx, vcpu, IDT_TS, sel, ts->ext);
+ return (1);
+ }
+
+ /* Descriptor table limit check */
+ if (desc_table_limit_check(ctx, vcpu, sel)) {
+ sel_exception(ctx, vcpu, IDT_TS, sel, ts->ext);
+ return (1);
+ }
+
+ /* NULL selector */
+ if (IDXSEL(sel) == 0) {
+ /* Code and stack segment selectors cannot be NULL */
+ if (codeseg || stackseg) {
+ sel_exception(ctx, vcpu, IDT_TS, sel, ts->ext);
+ return (1);
+ }
+ seg_desc->base = 0;
+ seg_desc->limit = 0;
+ seg_desc->access = 0x10000; /* unusable */
+ return (0);
+ }
+
+ /* Read the descriptor from the GDT/LDT */
+ sup_paging = ts->paging;
+ sup_paging.cpl = 0; /* implicit supervisor mode */
+ error = desc_table_read(ctx, vcpu, &sup_paging, sel, &usd);
+ if (error)
+ return (error);
+
+ /* Verify that the descriptor type is compatible with the segment */
+ if ((ldtseg && !ldt_desc(usd.sd_type)) ||
+ (codeseg && !code_desc(usd.sd_type)) ||
+ (dataseg && !data_desc(usd.sd_type)) ||
+ (stackseg && !stack_desc(usd.sd_type))) {
+ sel_exception(ctx, vcpu, IDT_TS, sel, ts->ext);
+ return (1);
+ }
+
+ /* Segment must be marked present */
+ if (!usd.sd_p) {
+ if (ldtseg)
+ idtvec = IDT_TS;
+ else if (stackseg)
+ idtvec = IDT_SS;
+ else
+ idtvec = IDT_NP;
+ sel_exception(ctx, vcpu, idtvec, sel, ts->ext);
+ return (1);
+ }
+
+ cs = GETREG(ctx, vcpu, VM_REG_GUEST_CS);
+ cpl = cs & SEL_RPL_MASK;
+ rpl = sel & SEL_RPL_MASK;
+ dpl = usd.sd_dpl;
+
+ if (stackseg && (rpl != cpl || dpl != cpl)) {
+ sel_exception(ctx, vcpu, IDT_TS, sel, ts->ext);
+ return (1);
+ }
+
+ if (codeseg) {
+ conforming = (usd.sd_type & 0x4) ? true : false;
+ if ((conforming && (cpl < dpl)) ||
+ (!conforming && (cpl != dpl))) {
+ sel_exception(ctx, vcpu, IDT_TS, sel, ts->ext);
+ return (1);
+ }
+ }
+
+ if (dataseg) {
+ /*
+ * A data segment is always non-conforming except when it's
+ * descriptor is a readable, conforming code segment.
+ */
+ if (code_desc(usd.sd_type) && (usd.sd_type & 0x4) != 0)
+ conforming = true;
+ else
+ conforming = false;
+
+ if (!conforming && (rpl > dpl || cpl > dpl)) {
+ sel_exception(ctx, vcpu, IDT_TS, sel, ts->ext);
+ return (1);
+ }
+ }
+ *seg_desc = usd_to_seg_desc(&usd);
+ return (0);
+}
+
+static void
+tss32_save(struct vmctx *ctx, int vcpu, struct vm_task_switch *task_switch,
+ uint32_t eip, struct tss32 *tss, struct iovec *iov)
+{
+
+ /* General purpose registers */
+ tss->tss_eax = GETREG(ctx, vcpu, VM_REG_GUEST_RAX);
+ tss->tss_ecx = GETREG(ctx, vcpu, VM_REG_GUEST_RCX);
+ tss->tss_edx = GETREG(ctx, vcpu, VM_REG_GUEST_RDX);
+ tss->tss_ebx = GETREG(ctx, vcpu, VM_REG_GUEST_RBX);
+ tss->tss_esp = GETREG(ctx, vcpu, VM_REG_GUEST_RSP);
+ tss->tss_ebp = GETREG(ctx, vcpu, VM_REG_GUEST_RBP);
+ tss->tss_esi = GETREG(ctx, vcpu, VM_REG_GUEST_RSI);
+ tss->tss_edi = GETREG(ctx, vcpu, VM_REG_GUEST_RDI);
+
+ /* Segment selectors */
+ tss->tss_es = GETREG(ctx, vcpu, VM_REG_GUEST_ES);
+ tss->tss_cs = GETREG(ctx, vcpu, VM_REG_GUEST_CS);
+ tss->tss_ss = GETREG(ctx, vcpu, VM_REG_GUEST_SS);
+ tss->tss_ds = GETREG(ctx, vcpu, VM_REG_GUEST_DS);
+ tss->tss_fs = GETREG(ctx, vcpu, VM_REG_GUEST_FS);
+ tss->tss_gs = GETREG(ctx, vcpu, VM_REG_GUEST_GS);
+
+ /* eflags and eip */
+ tss->tss_eflags = GETREG(ctx, vcpu, VM_REG_GUEST_RFLAGS);
+ if (task_switch->reason == TSR_IRET)
+ tss->tss_eflags &= ~PSL_NT;
+ tss->tss_eip = eip;
+
+ /* Copy updated old TSS into guest memory */
+ vm_copyout(ctx, vcpu, tss, iov, sizeof(struct tss32));
+}
+
+static void
+update_seg_desc(struct vmctx *ctx, int vcpu, int reg, struct seg_desc *sd)
+{
+ int error;
+
+ error = vm_set_desc(ctx, vcpu, reg, sd->base, sd->limit, sd->access);
+ assert(error == 0);
+}
+
+/*
+ * Update the vcpu registers to reflect the state of the new task.
+ *
+ * Returns 0 on success.
+ * Returns 1 if an exception was injected into the guest.
+ * Returns -1 otherwise.
+ */
+static int
+tss32_restore(struct vmctx *ctx, int vcpu, struct vm_task_switch *ts,
+ uint16_t ot_sel, struct tss32 *tss, struct iovec *iov)
+{
+ struct seg_desc seg_desc, seg_desc2;
+ uint64_t *pdpte, maxphyaddr, reserved;
+ uint32_t eflags;
+ int error, i;
+ bool nested;
+
+ nested = false;
+ if (ts->reason != TSR_IRET && ts->reason != TSR_JMP) {
+ tss->tss_link = ot_sel;
+ nested = true;
+ }
+
+ eflags = tss->tss_eflags;
+ if (nested)
+ eflags |= PSL_NT;
+
+ /* LDTR */
+ SETREG(ctx, vcpu, VM_REG_GUEST_LDTR, tss->tss_ldt);
+
+ /* PBDR */
+ if (ts->paging.paging_mode != PAGING_MODE_FLAT) {
+ if (ts->paging.paging_mode == PAGING_MODE_PAE) {
+ /*
+ * XXX Assuming 36-bit MAXPHYADDR.
+ */
+ maxphyaddr = (1UL << 36) - 1;
+ pdpte = paddr_guest2host(ctx, tss->tss_cr3 & ~0x1f, 32);
+ for (i = 0; i < 4; i++) {
+ /* Check reserved bits if the PDPTE is valid */
+ if (!(pdpte[i] & 0x1))
+ continue;
+ /*
+ * Bits 2:1, 8:5 and bits above the processor's
+ * maximum physical address are reserved.
+ */
+ reserved = ~maxphyaddr | 0x1E6;
+ if (pdpte[i] & reserved) {
+ vm_inject_gp(ctx, vcpu);
+ return (1);
+ }
+ }
+ SETREG(ctx, vcpu, VM_REG_GUEST_PDPTE0, pdpte[0]);
+ SETREG(ctx, vcpu, VM_REG_GUEST_PDPTE1, pdpte[1]);
+ SETREG(ctx, vcpu, VM_REG_GUEST_PDPTE2, pdpte[2]);
+ SETREG(ctx, vcpu, VM_REG_GUEST_PDPTE3, pdpte[3]);
+ }
+ SETREG(ctx, vcpu, VM_REG_GUEST_CR3, tss->tss_cr3);
+ ts->paging.cr3 = tss->tss_cr3;
+ }
+
+ /* eflags and eip */
+ SETREG(ctx, vcpu, VM_REG_GUEST_RFLAGS, eflags);
+ SETREG(ctx, vcpu, VM_REG_GUEST_RIP, tss->tss_eip);
+
+ /* General purpose registers */
+ SETREG(ctx, vcpu, VM_REG_GUEST_RAX, tss->tss_eax);
+ SETREG(ctx, vcpu, VM_REG_GUEST_RCX, tss->tss_ecx);
+ SETREG(ctx, vcpu, VM_REG_GUEST_RDX, tss->tss_edx);
+ SETREG(ctx, vcpu, VM_REG_GUEST_RBX, tss->tss_ebx);
+ SETREG(ctx, vcpu, VM_REG_GUEST_RSP, tss->tss_esp);
+ SETREG(ctx, vcpu, VM_REG_GUEST_RBP, tss->tss_ebp);
+ SETREG(ctx, vcpu, VM_REG_GUEST_RSI, tss->tss_esi);
+ SETREG(ctx, vcpu, VM_REG_GUEST_RDI, tss->tss_edi);
+
+ /* Segment selectors */
+ SETREG(ctx, vcpu, VM_REG_GUEST_ES, tss->tss_es);
+ SETREG(ctx, vcpu, VM_REG_GUEST_CS, tss->tss_cs);
+ SETREG(ctx, vcpu, VM_REG_GUEST_SS, tss->tss_ss);
+ SETREG(ctx, vcpu, VM_REG_GUEST_DS, tss->tss_ds);
+ SETREG(ctx, vcpu, VM_REG_GUEST_FS, tss->tss_fs);
+ SETREG(ctx, vcpu, VM_REG_GUEST_GS, tss->tss_gs);
+
+ /*
+ * If this is a nested task then write out the new TSS to update
+ * the previous link field.
+ */
+ if (nested)
+ vm_copyout(ctx, vcpu, tss, iov, sizeof(*tss));
+
+ /* Validate segment descriptors */
+ error = validate_seg_desc(ctx, vcpu, ts, VM_REG_GUEST_LDTR, &seg_desc);
+ if (error)
+ return (error);
+ update_seg_desc(ctx, vcpu, VM_REG_GUEST_LDTR, &seg_desc);
+
+ /*
+ * Section "Checks on Guest Segment Registers", Intel SDM, Vol 3.
+ *
+ * The SS and CS attribute checks on VM-entry are inter-dependent so
+ * we need to make sure that both segments are valid before updating
+ * either of them. This ensures that the VMCS state can pass the
+ * VM-entry checks so the guest can handle any exception injected
+ * during task switch emulation.
+ */
+ error = validate_seg_desc(ctx, vcpu, ts, VM_REG_GUEST_CS, &seg_desc);
+ if (error)
+ return (error);
+ error = validate_seg_desc(ctx, vcpu, ts, VM_REG_GUEST_SS, &seg_desc2);
+ if (error)
+ return (error);
+ update_seg_desc(ctx, vcpu, VM_REG_GUEST_CS, &seg_desc);
+ update_seg_desc(ctx, vcpu, VM_REG_GUEST_SS, &seg_desc2);
+ ts->paging.cpl = tss->tss_cs & SEL_RPL_MASK;
+
+ error = validate_seg_desc(ctx, vcpu, ts, VM_REG_GUEST_DS, &seg_desc);
+ if (error)
+ return (error);
+ update_seg_desc(ctx, vcpu, VM_REG_GUEST_DS, &seg_desc);
+
+ error = validate_seg_desc(ctx, vcpu, ts, VM_REG_GUEST_ES, &seg_desc);
+ if (error)
+ return (error);
+ update_seg_desc(ctx, vcpu, VM_REG_GUEST_ES, &seg_desc);
+
+ error = validate_seg_desc(ctx, vcpu, ts, VM_REG_GUEST_FS, &seg_desc);
+ if (error)
+ return (error);
+ update_seg_desc(ctx, vcpu, VM_REG_GUEST_FS, &seg_desc);
+
+ error = validate_seg_desc(ctx, vcpu, ts, VM_REG_GUEST_GS, &seg_desc);
+ if (error)
+ return (error);
+ update_seg_desc(ctx, vcpu, VM_REG_GUEST_GS, &seg_desc);
+
+ return (0);
+}
+
+/*
+ * Push an error code on the stack of the new task. This is needed if the
+ * task switch was triggered by a hardware exception that causes an error
+ * code to be saved (e.g. #PF).
+ *
+ * Returns 0 on success.
+ * Returns 1 if an exception was injected into the guest.
+ * Returns -1 otherwise.
+ */
+static int
+push_errcode(struct vmctx *ctx, int vcpu, struct vm_guest_paging *paging,
+ int task_type, uint32_t errcode)
+{
+ struct iovec iov[2];
+ struct seg_desc seg_desc;
+ int stacksize, bytes, error;
+ uint64_t gla, cr0, rflags;
+ uint32_t esp;
+ uint16_t stacksel;
+
+ cr0 = GETREG(ctx, vcpu, VM_REG_GUEST_CR0);
+ rflags = GETREG(ctx, vcpu, VM_REG_GUEST_RFLAGS);
+ stacksel = GETREG(ctx, vcpu, VM_REG_GUEST_SS);
+
+ error = vm_get_desc(ctx, vcpu, VM_REG_GUEST_SS, &seg_desc.base,
+ &seg_desc.limit, &seg_desc.access);
+ assert(error == 0);
+
+ /*
+ * Section "Error Code" in the Intel SDM vol 3: the error code is
+ * pushed on the stack as a doubleword or word (depending on the
+ * default interrupt, trap or task gate size).
+ */
+ if (task_type == SDT_SYS386BSY || task_type == SDT_SYS386TSS)
+ bytes = 4;
+ else
+ bytes = 2;
+
+ /*
+ * PUSH instruction from Intel SDM vol 2: the 'B' flag in the
+ * stack-segment descriptor determines the size of the stack
+ * pointer outside of 64-bit mode.
+ */
+ if (SEG_DESC_DEF32(seg_desc.access))
+ stacksize = 4;
+ else
+ stacksize = 2;
+
+ esp = GETREG(ctx, vcpu, VM_REG_GUEST_RSP);
+ esp -= bytes;
+
+ if (vie_calculate_gla(paging->cpu_mode, VM_REG_GUEST_SS,
+ &seg_desc, esp, bytes, stacksize, PROT_WRITE, &gla)) {
+ sel_exception(ctx, vcpu, IDT_SS, stacksel, 1);
+ return (1);
+ }
+
+ if (vie_alignment_check(paging->cpl, bytes, cr0, rflags, gla)) {
+ vm_inject_ac(ctx, vcpu, 1);
+ return (1);
+ }
+
+ error = vm_copy_setup(ctx, vcpu, paging, gla, bytes, PROT_WRITE,
+ iov, nitems(iov));
+ if (error)
+ return (error);
+
+ vm_copyout(ctx, vcpu, &errcode, iov, bytes);
+ SETREG(ctx, vcpu, VM_REG_GUEST_RSP, esp);
+ return (0);
+}
+
+/*
+ * Evaluate return value from helper functions and potentially return to
+ * the VM run loop.
+ * 0: success
+ * +1: an exception was injected into the guest vcpu
+ * -1: unrecoverable/programming error
+ */
+#define CHKERR(x) \
+ do { \
+ assert(((x) == 0) || ((x) == 1) || ((x) == -1)); \
+ if ((x) == -1) \
+ return (VMEXIT_ABORT); \
+ else if ((x) == 1) \
+ return (VMEXIT_CONTINUE); \
+ } while (0)
+
+int
+vmexit_task_switch(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
+{
+ struct seg_desc nt;
+ struct tss32 oldtss, newtss;
+ struct vm_task_switch *task_switch;
+ struct vm_guest_paging *paging, sup_paging;
+ struct user_segment_descriptor nt_desc, ot_desc;
+ struct iovec nt_iov[2], ot_iov[2];
+ uint64_t cr0, ot_base;
+ uint32_t eip, ot_lim, access;
+ int error, ext, minlimit, nt_type, ot_type, vcpu;
+ enum task_switch_reason reason;
+ uint16_t nt_sel, ot_sel;
+
+ task_switch = &vmexit->u.task_switch;
+ nt_sel = task_switch->tsssel;
+ ext = vmexit->u.task_switch.ext;
+ reason = vmexit->u.task_switch.reason;
+ paging = &vmexit->u.task_switch.paging;
+ vcpu = *pvcpu;
+
+ assert(paging->cpu_mode == CPU_MODE_PROTECTED);
+
+ /*
+ * Section 4.6, "Access Rights" in Intel SDM Vol 3.
+ * The following page table accesses are implicitly supervisor mode:
+ * - accesses to GDT or LDT to load segment descriptors
+ * - accesses to the task state segment during task switch
+ */
+ sup_paging = *paging;
+ sup_paging.cpl = 0; /* implicit supervisor mode */
+
+ /* Fetch the new TSS descriptor */
+ error = read_tss_descriptor(ctx, vcpu, task_switch, nt_sel, &nt_desc);
+ CHKERR(error);
+
+ nt = usd_to_seg_desc(&nt_desc);
+
+ /* Verify the type of the new TSS */
+ nt_type = SEG_DESC_TYPE(nt.access);
+ if (nt_type != SDT_SYS386BSY && nt_type != SDT_SYS386TSS &&
+ nt_type != SDT_SYS286BSY && nt_type != SDT_SYS286TSS) {
+ sel_exception(ctx, vcpu, IDT_TS, nt_sel, ext);
+ goto done;
+ }
+
+ /* TSS descriptor must have present bit set */
+ if (!SEG_DESC_PRESENT(nt.access)) {
+ sel_exception(ctx, vcpu, IDT_NP, nt_sel, ext);
+ goto done;
+ }
+
+ /*
+ * TSS must have a minimum length of 104 bytes for a 32-bit TSS and
+ * 44 bytes for a 16-bit TSS.
+ */
+ if (nt_type == SDT_SYS386BSY || nt_type == SDT_SYS386TSS)
+ minlimit = 104 - 1;
+ else if (nt_type == SDT_SYS286BSY || nt_type == SDT_SYS286TSS)
+ minlimit = 44 - 1;
+ else
+ minlimit = 0;
+
+ assert(minlimit > 0);
+ if (nt.limit < minlimit) {
+ sel_exception(ctx, vcpu, IDT_TS, nt_sel, ext);
+ goto done;
+ }
+
+ /* TSS must be busy if task switch is due to IRET */
+ if (reason == TSR_IRET && !TSS_BUSY(nt_type)) {
+ sel_exception(ctx, vcpu, IDT_TS, nt_sel, ext);
+ goto done;
+ }
+
+ /*
+ * TSS must be available (not busy) if task switch reason is
+ * CALL, JMP, exception or interrupt.
+ */
+ if (reason != TSR_IRET && TSS_BUSY(nt_type)) {
+ sel_exception(ctx, vcpu, IDT_GP, nt_sel, ext);
+ goto done;
+ }
+
+ /* Fetch the new TSS */
+ error = vm_copy_setup(ctx, vcpu, &sup_paging, nt.base, minlimit + 1,
+ PROT_READ | PROT_WRITE, nt_iov, nitems(nt_iov));
+ CHKERR(error);
+ vm_copyin(ctx, vcpu, nt_iov, &newtss, minlimit + 1);
+
+ /* Get the old TSS selector from the guest's task register */
+ ot_sel = GETREG(ctx, vcpu, VM_REG_GUEST_TR);
+ if (ISLDT(ot_sel) || IDXSEL(ot_sel) == 0) {
+ /*
+ * This might happen if a task switch was attempted without
+ * ever loading the task register with LTR. In this case the
+ * TR would contain the values from power-on:
+ * (sel = 0, base = 0, limit = 0xffff).
+ */
+ sel_exception(ctx, vcpu, IDT_TS, ot_sel, task_switch->ext);
+ goto done;
+ }
+
+ /* Get the old TSS base and limit from the guest's task register */
+ error = vm_get_desc(ctx, vcpu, VM_REG_GUEST_TR, &ot_base, &ot_lim,
+ &access);
+ assert(error == 0);
+ assert(!SEG_DESC_UNUSABLE(access) && SEG_DESC_PRESENT(access));
+ ot_type = SEG_DESC_TYPE(access);
+ assert(ot_type == SDT_SYS386BSY || ot_type == SDT_SYS286BSY);
+
+ /* Fetch the old TSS descriptor */
+ error = read_tss_descriptor(ctx, vcpu, task_switch, ot_sel, &ot_desc);
+ CHKERR(error);
+
+ /* Get the old TSS */
+ error = vm_copy_setup(ctx, vcpu, &sup_paging, ot_base, minlimit + 1,
+ PROT_READ | PROT_WRITE, ot_iov, nitems(ot_iov));
+ CHKERR(error);
+ vm_copyin(ctx, vcpu, ot_iov, &oldtss, minlimit + 1);
+
+ /*
+ * Clear the busy bit in the old TSS descriptor if the task switch
+ * due to an IRET or JMP instruction.
+ */
+ if (reason == TSR_IRET || reason == TSR_JMP) {
+ ot_desc.sd_type &= ~0x2;
+ error = desc_table_write(ctx, vcpu, &sup_paging, ot_sel,
+ &ot_desc);
+ CHKERR(error);
+ }
+
+ if (nt_type == SDT_SYS286BSY || nt_type == SDT_SYS286TSS) {
+ fprintf(stderr, "Task switch to 16-bit TSS not supported\n");
+ return (VMEXIT_ABORT);
+ }
+
+ /* Save processor state in old TSS */
+ eip = vmexit->rip + vmexit->inst_length;
+ tss32_save(ctx, vcpu, task_switch, eip, &oldtss, ot_iov);
+
+ /*
+ * If the task switch was triggered for any reason other than IRET
+ * then set the busy bit in the new TSS descriptor.
+ */
+ if (reason != TSR_IRET) {
+ nt_desc.sd_type |= 0x2;
+ error = desc_table_write(ctx, vcpu, &sup_paging, nt_sel,
+ &nt_desc);
+ CHKERR(error);
+ }
+
+ /* Update task register to point at the new TSS */
+ SETREG(ctx, vcpu, VM_REG_GUEST_TR, nt_sel);
+
+ /* Update the hidden descriptor state of the task register */
+ nt = usd_to_seg_desc(&nt_desc);
+ update_seg_desc(ctx, vcpu, VM_REG_GUEST_TR, &nt);
+
+ /* Set CR0.TS */
+ cr0 = GETREG(ctx, vcpu, VM_REG_GUEST_CR0);
+ SETREG(ctx, vcpu, VM_REG_GUEST_CR0, cr0 | CR0_TS);
+
+ /*
+ * We are now committed to the task switch. Any exceptions encountered
+ * after this point will be handled in the context of the new task and
+ * the saved instruction pointer will belong to the new task.
+ */
+ vmexit->rip = newtss.tss_eip;
+ vmexit->inst_length = 0;
+
+ /* Load processor state from new TSS */
+ error = tss32_restore(ctx, vcpu, task_switch, ot_sel, &newtss, nt_iov);
+ CHKERR(error);
+
+ /*
+ * Section "Interrupt Tasks" in Intel SDM, Vol 3: if an exception
+ * caused an error code to be generated, this error code is copied
+ * to the stack of the new task.
+ */
+ if (task_switch->errcode_valid) {
+ assert(task_switch->ext);
+ assert(task_switch->reason == TSR_IDT_GATE);
+ error = push_errcode(ctx, vcpu, &task_switch->paging, nt_type,
+ task_switch->errcode);
+ CHKERR(error);
+ }
+
+ /*
+ * Treatment of virtual-NMI blocking if NMI is delivered through
+ * a task gate.
+ *
+ * Section "Architectural State Before A VM Exit", Intel SDM, Vol3:
+ * If the virtual NMIs VM-execution control is 1, VM entry injects
+ * an NMI, and delivery of the NMI causes a task switch that causes
+ * a VM exit, virtual-NMI blocking is in effect before the VM exit
+ * commences.
+ *
+ * Thus, virtual-NMI blocking is in effect at the time of the task
+ * switch VM exit.
+ */
+
+ /*
+ * Treatment of virtual-NMI unblocking on IRET from NMI handler task.
+ *
+ * Section "Changes to Instruction Behavior in VMX Non-Root Operation"
+ * If "virtual NMIs" control is 1 IRET removes any virtual-NMI blocking.
+ * This unblocking of virtual-NMI occurs even if IRET causes a fault.
+ *
+ * Thus, virtual-NMI blocking is cleared at the time of the task switch
+ * VM exit.
+ */
+
+ /*
+ * If the task switch was triggered by an event delivered through
+ * the IDT then extinguish the pending event from the vcpu's
+ * exitintinfo.
+ */
+ if (task_switch->reason == TSR_IDT_GATE) {
+ error = vm_set_intinfo(ctx, vcpu, 0);
+ assert(error == 0);
+ }
+
+ /*
+ * XXX should inject debug exception if 'T' bit is 1
+ */
+done:
+ return (VMEXIT_CONTINUE);
+}
diff --git a/usr.sbin/bhyve/virtio.c b/usr.sbin/bhyve/virtio.c
index 4e58dd62a0e7..1f2730092936 100644
--- a/usr.sbin/bhyve/virtio.c
+++ b/usr.sbin/bhyve/virtio.c
@@ -437,7 +437,7 @@ vq_endchains(struct vqueue_info *vq, int used_all_avail)
if (used_all_avail &&
(vs->vs_negotiated_caps & VIRTIO_F_NOTIFY_ON_EMPTY))
intr = 1;
- else if (vs->vs_flags & VIRTIO_EVENT_IDX) {
+ else if (vs->vs_negotiated_caps & VIRTIO_RING_F_EVENT_IDX) {
event_idx = VQ_USED_EVENT_IDX(vq);
/*
* This calculation is per docs and the kernel
diff --git a/usr.sbin/bhyve/virtio.h b/usr.sbin/bhyve/virtio.h
index 01b5f7b9112d..1f29dfa8ef73 100644
--- a/usr.sbin/bhyve/virtio.h
+++ b/usr.sbin/bhyve/virtio.h
@@ -352,7 +352,7 @@ struct virtio_consts {
/* called to read config regs */
int (*vc_cfgwrite)(void *, int, int, uint32_t);
/* called to write config regs */
- uint32_t vc_hv_caps; /* hypervisor-provided capabilities */
+ uint64_t vc_hv_caps; /* hypervisor-provided capabilities */
};
/*
diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c
index ceee33a2aeeb..b6006b72a767 100644
--- a/usr.sbin/bhyvectl/bhyvectl.c
+++ b/usr.sbin/bhyvectl/bhyvectl.c
@@ -193,7 +193,10 @@ usage(void)
" [--assert-lapic-lvt=<pin>]\n"
" [--inject-nmi]\n"
" [--force-reset]\n"
- " [--force-poweroff]\n",
+ " [--force-poweroff]\n"
+ " [--get-active-cpus]\n"
+ " [--get-suspended-cpus]\n"
+ " [--get-intinfo]\n",
progname);
exit(1);
}
@@ -203,6 +206,8 @@ static int inject_nmi, assert_lapic_lvt;
static int force_reset, force_poweroff;
static const char *capname;
static int create, destroy, get_lowmem, get_highmem;
+static int get_intinfo;
+static int get_active_cpus, get_suspended_cpus;
static uint64_t memsize;
static int set_cr0, get_cr0, set_cr3, get_cr3, set_cr4, get_cr4;
static int set_efer, get_efer;
@@ -390,6 +395,56 @@ enum {
ASSERT_LAPIC_LVT,
};
+static void
+print_cpus(const char *banner, const cpuset_t *cpus)
+{
+ int i, first;
+
+ first = 1;
+ printf("%s:\t", banner);
+ if (!CPU_EMPTY(cpus)) {
+ for (i = 0; i < CPU_SETSIZE; i++) {
+ if (CPU_ISSET(i, cpus)) {
+ printf("%s%d", first ? " " : ", ", i);
+ first = 0;
+ }
+ }
+ } else
+ printf(" (none)");
+ printf("\n");
+}
+
+static void
+print_intinfo(const char *banner, uint64_t info)
+{
+ int type;
+
+ printf("%s:\t", banner);
+ if (info & VM_INTINFO_VALID) {
+ type = info & VM_INTINFO_TYPE;
+ switch (type) {
+ case VM_INTINFO_HWINTR:
+ printf("extint");
+ break;
+ case VM_INTINFO_NMI:
+ printf("nmi");
+ break;
+ case VM_INTINFO_SWINTR:
+ printf("swint");
+ break;
+ default:
+ printf("exception");
+ break;
+ }
+ printf(" vector %d", (int)VM_INTINFO_VECTOR(info));
+ if (info & VM_INTINFO_DEL_ERRCODE)
+ printf(" errcode %#x", (u_int)(info >> 32));
+ } else {
+ printf("n/a");
+ }
+ printf("\n");
+}
+
int
main(int argc, char *argv[])
{
@@ -398,9 +453,10 @@ main(int argc, char *argv[])
vm_paddr_t gpa, gpa_pmap;
size_t len;
struct vm_exit vmexit;
- uint64_t ctl, eptp, bm, addr, u64, pteval[4], *pte;
+ uint64_t ctl, eptp, bm, addr, u64, pteval[4], *pte, info[2];
struct vmctx *ctx;
int wired;
+ cpuset_t cpus;
uint64_t cr0, cr3, cr4, dr7, rsp, rip, rflags, efer, pat;
uint64_t rax, rbx, rcx, rdx, rsi, rdi, rbp;
@@ -570,6 +626,9 @@ main(int argc, char *argv[])
{ "inject-nmi", NO_ARG, &inject_nmi, 1 },
{ "force-reset", NO_ARG, &force_reset, 1 },
{ "force-poweroff", NO_ARG, &force_poweroff, 1 },
+ { "get-active-cpus", NO_ARG, &get_active_cpus, 1 },
+ { "get-suspended-cpus", NO_ARG, &get_suspended_cpus, 1 },
+ { "get-intinfo", NO_ARG, &get_intinfo, 1 },
{ NULL, 0, NULL, 0 }
};
@@ -1529,6 +1588,26 @@ main(int argc, char *argv[])
}
}
+ if (!error && (get_active_cpus || get_all)) {
+ error = vm_active_cpus(ctx, &cpus);
+ if (!error)
+ print_cpus("active cpus", &cpus);
+ }
+
+ if (!error && (get_suspended_cpus || get_all)) {
+ error = vm_suspended_cpus(ctx, &cpus);
+ if (!error)
+ print_cpus("suspended cpus", &cpus);
+ }
+
+ if (!error && (get_intinfo || get_all)) {
+ error = vm_get_intinfo(ctx, vcpu, &info[0], &info[1]);
+ if (!error) {
+ print_intinfo("pending", info[0]);
+ print_intinfo("current", info[1]);
+ }
+ }
+
if (!error && run) {
error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RIP, &rip);
assert(error == 0);
diff --git a/usr.sbin/bhyveload/bhyveload.8 b/usr.sbin/bhyveload/bhyveload.8
index 3a300cc00f85..c1688322cc75 100644
--- a/usr.sbin/bhyveload/bhyveload.8
+++ b/usr.sbin/bhyveload/bhyveload.8
@@ -35,11 +35,11 @@
guest inside a bhyve virtual machine
.Sh SYNOPSIS
.Nm
-.Op Fl m Ar mem-size
+.Op Fl c Ar cons-dev
.Op Fl d Ar disk-path
-.Op Fl h Ar host-path
.Op Fl e Ar name=value
-.Op Fl c Ar cons-dev
+.Op Fl h Ar host-path
+.Op Fl m Ar mem-size
.Ar vmname
.Sh DESCRIPTION
.Nm
@@ -62,6 +62,32 @@ and will be created if it does not already exist.
.Sh OPTIONS
The following options are available:
.Bl -tag -width indent
+.It Fl c Ar cons-dev
+.Ar cons-dev
+is a
+.Xr tty 4
+device to use for
+.Nm
+terminal I/O.
+.Pp
+The text string "stdio" is also accepted and selects the use of
+unbuffered standard I/O. This is the default value.
+.It Fl d Ar disk-path
+The
+.Ar disk-path
+is the pathname of the guest's boot disk image.
+.It Fl e Ar name=value
+Set the FreeBSD loader environment variable
+.Ar name
+to
+.Ar value .
+.Pp
+The option may be used more than once to set more than one environment
+variable.
+.It Fl h Ar host-path
+The
+.Ar host-path
+is the directory at the top of the guest's boot filesystem.
.It Fl m Ar mem-size Xo
.Sm off
.Op Cm K | k | M | m | G | g | T | t
@@ -85,32 +111,6 @@ respectively.
The default value of
.Ar mem-size
is 256M.
-.It Fl d Ar disk-path
-The
-.Ar disk-path
-is the pathname of the guest's boot disk image.
-.It Fl h Ar host-path
-The
-.Ar host-path
-is the directory at the top of the guest's boot filesystem.
-.It Fl e Ar name=value
-Set the FreeBSD loader environment variable
-.Ar name
-to
-.Ar value .
-.Pp
-The option may be used more than once to set more than one environment
-variable.
-.It Fl c Ar cons-dev
-.Ar cons-dev
-is a
-.Xr tty 4
-device to use for
-.Nm
-terminal I/O.
-.Pp
-The text string "stdio" is also accepted and selects the use of
-unbuffered standard I/O. This is the default value.
.El
.Sh EXAMPLES
To create a virtual machine named
@@ -147,9 +147,9 @@ and was developed at NetApp Inc.
.Nm
was developed by
.An -nosplit
-.An "Neel Natu" Aq neel@FreeBSD.org
+.An Neel Natu Aq Mt neel@FreeBSD.org
at NetApp Inc with a lot of help from
-.An Doug Rabson Aq dfr@FreeBSD.org
+.An Doug Rabson Aq Mt dfr@FreeBSD.org .
.Sh BUGS
.Nm
can only load
diff --git a/usr.sbin/bhyveload/bhyveload.c b/usr.sbin/bhyveload/bhyveload.c
index c1a54326360b..eaf71a819373 100644
--- a/usr.sbin/bhyveload/bhyveload.c
+++ b/usr.sbin/bhyveload/bhyveload.c
@@ -505,8 +505,8 @@ static void
cb_getmem(void *arg, uint64_t *ret_lowmem, uint64_t *ret_highmem)
{
- vm_get_memory_seg(ctx, 0, ret_lowmem, NULL);
- vm_get_memory_seg(ctx, 4 * GB, ret_highmem, NULL);
+ *ret_lowmem = vm_get_lowmem_size(ctx);
+ *ret_highmem = vm_get_highmem_size(ctx);
}
struct env {
@@ -629,8 +629,8 @@ usage(void)
{
fprintf(stderr,
- "usage: %s [-m mem-size] [-d <disk-path>] [-h <host-path>]\n"
- " %*s [-e <name=value>] [-c <console-device>] <vmname>\n",
+ "usage: %s [-c <console-device>] [-d <disk-path>] [-e <name=value>]\n"
+ " %*s [-h <host-path>] [-m mem-size] <vmname>\n",
progname,
(int)strlen(progname), "");
exit(1);
@@ -642,7 +642,7 @@ main(int argc, char** argv)
void *h;
void (*func)(struct loader_callbacks *, void *, int, int);
uint64_t mem_size;
- int opt, error;
+ int opt, error, need_reinit;
progname = basename(argv[0]);
@@ -691,11 +691,14 @@ main(int argc, char** argv)
vmname = argv[0];
+ need_reinit = 0;
error = vm_create(vmname);
- if (error != 0 && errno != EEXIST) {
- perror("vm_create");
- exit(1);
-
+ if (error) {
+ if (errno != EEXIST) {
+ perror("vm_create");
+ exit(1);
+ }
+ need_reinit = 1;
}
ctx = vm_open(vmname);
@@ -704,6 +707,14 @@ main(int argc, char** argv)
exit(1);
}
+ if (need_reinit) {
+ error = vm_reinit(ctx);
+ if (error) {
+ perror("vm_reinit");
+ exit(1);
+ }
+ }
+
error = vm_setup_memory(ctx, mem_size, VM_MMAP_ALL);
if (error) {
perror("vm_setup_memory");
diff --git a/usr.sbin/binmiscctl/binmiscctl.8 b/usr.sbin/binmiscctl/binmiscctl.8
index 646a5a3c2adb..c6aeca475659 100644
--- a/usr.sbin/binmiscctl/binmiscctl.8
+++ b/usr.sbin/binmiscctl/binmiscctl.8
@@ -146,10 +146,10 @@ Look up and print out the activator entry identified with
Take a snapshot and print all the activator entries currently configured.
.El
.Sh EXAMPLES
-.Bl
-# binmiscctl add llvmbc --interpreter ''/usr/bin/lli --fake-argv0=#a'' \\
- --magic ''BC\\xc0\\xde'' --size 4 --set-enabled
-.El
+.Bd -ragged -offset indent
+# binmiscctl add llvmbc --interpreter ''/usr/bin/lli --fake-argv0=#a''
+--magic ''BC\\xc0\\xde'' --size 4 --set-enabled
+.Ed
.Pp
Add an image activator to run the LLVM interpreter (lli) on bitcode
compiled files.
diff --git a/usr.sbin/bluetooth/ath3kfw/ath3kfw.8 b/usr.sbin/bluetooth/ath3kfw/ath3kfw.8
index 9198853c2213..3a37343d253a 100644
--- a/usr.sbin/bluetooth/ath3kfw/ath3kfw.8
+++ b/usr.sbin/bluetooth/ath3kfw/ath3kfw.8
@@ -72,7 +72,7 @@ Display usage message and exit.
.Xr ugen 4 ,
.Xr devd 8
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
.Sh BUGS
Most likely.
Please report if found.
diff --git a/usr.sbin/bluetooth/bcmfw/bcmfw.8 b/usr.sbin/bluetooth/bcmfw/bcmfw.8
index e79935070725..d82d701531b3 100644
--- a/usr.sbin/bluetooth/bcmfw/bcmfw.8
+++ b/usr.sbin/bluetooth/bcmfw/bcmfw.8
@@ -99,7 +99,7 @@ device:
.Xr ubtbcmfw 4 ,
.Xr ugen 4
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
.Sh BUGS
Most likely.
Please report if found.
diff --git a/usr.sbin/bluetooth/bt3cfw/bt3cfw.8 b/usr.sbin/bluetooth/bt3cfw/bt3cfw.8
index 54df178741fd..ec1ef341aea7 100644
--- a/usr.sbin/bluetooth/bt3cfw/bt3cfw.8
+++ b/usr.sbin/bluetooth/bt3cfw/bt3cfw.8
@@ -68,6 +68,6 @@ Connect to the specified Netgraph driver node of type
.Sh SEE ALSO
.Xr ng_bt3c 4
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
.Sh BUGS
Please report if found.
diff --git a/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.8 b/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.8
index 690b9422d175..50774f18d03b 100644
--- a/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.8
+++ b/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.8
@@ -99,4 +99,4 @@ are:
.Sh SEE ALSO
.Xr bthidd 8
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
diff --git a/usr.sbin/bluetooth/bthidd/bthidd.8 b/usr.sbin/bluetooth/bthidd/bthidd.8
index 8dd052edf094..53db4cb810d8 100644
--- a/usr.sbin/bluetooth/bthidd/bthidd.8
+++ b/usr.sbin/bluetooth/bthidd/bthidd.8
@@ -107,7 +107,7 @@ configuration file is needed as well.
.Xr vkbd 4 ,
.Xr bthidcontrol 8
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
.Sh CAVEATS
Any Bluetooth HID device that has
.Dv HUP_KEYBOARD
diff --git a/usr.sbin/bluetooth/hccontrol/hccontrol.8 b/usr.sbin/bluetooth/hccontrol/hccontrol.8
index 54be8237b2c8..af0a67f1cd86 100644
--- a/usr.sbin/bluetooth/hccontrol/hccontrol.8
+++ b/usr.sbin/bluetooth/hccontrol/hccontrol.8
@@ -178,7 +178,7 @@ are:
.Xr ng_hci 4 ,
.Xr hcseriald 8
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
.Sh BUGS
Most likely.
Please report if found.
diff --git a/usr.sbin/bluetooth/hcsecd/hcsecd.8 b/usr.sbin/bluetooth/hcsecd/hcsecd.8
index 8b7084d2de30..a55e85e5ab8c 100644
--- a/usr.sbin/bluetooth/hcsecd/hcsecd.8
+++ b/usr.sbin/bluetooth/hcsecd/hcsecd.8
@@ -120,7 +120,7 @@ Display usage message and exit.
.Xr hccontrol 8 ,
.Xr hcseriald 8
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
.Sh BUGS
Currently there is no way to select the link key or the PIN code based on
which local device received the request.
diff --git a/usr.sbin/bluetooth/hcsecd/hcsecd.conf.5 b/usr.sbin/bluetooth/hcsecd/hcsecd.conf.5
index 189ca66606c5..a6342aa67cf3 100644
--- a/usr.sbin/bluetooth/hcsecd/hcsecd.conf.5
+++ b/usr.sbin/bluetooth/hcsecd/hcsecd.conf.5
@@ -128,4 +128,4 @@ device {
.Sh SEE ALSO
.Xr hcsecd 8
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
diff --git a/usr.sbin/bluetooth/hcseriald/hcseriald.8 b/usr.sbin/bluetooth/hcseriald/hcseriald.8
index 8d2dd47be61f..c2d94efd0744 100644
--- a/usr.sbin/bluetooth/hcseriald/hcseriald.8
+++ b/usr.sbin/bluetooth/hcseriald/hcseriald.8
@@ -83,4 +83,4 @@ is an H4 Netgraph node name.
.Xr tty 4 ,
.Xr hccontrol 8
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
diff --git a/usr.sbin/bluetooth/l2control/l2control.8 b/usr.sbin/bluetooth/l2control/l2control.8
index 7636d9422e22..5974167439d1 100644
--- a/usr.sbin/bluetooth/l2control/l2control.8
+++ b/usr.sbin/bluetooth/l2control/l2control.8
@@ -94,4 +94,4 @@ are:
.Xr ng_l2cap 4 ,
.Xr l2ping 8
.Sh AUTHORS
-.An Maksim Yevmenkin Aq emax@FreeBSD.org
+.An Maksim Yevmenkin Aq Mt emax@FreeBSD.org
diff --git a/usr.sbin/bluetooth/l2ping/l2ping.8 b/usr.sbin/bluetooth/l2ping/l2ping.8
index 73774eccf339..b6233e8407da 100644
--- a/usr.sbin/bluetooth/l2ping/l2ping.8
+++ b/usr.sbin/bluetooth/l2ping/l2ping.8
@@ -108,7 +108,7 @@ Some implementations may not like large sizes and may hang or even crash.
.Xr ng_l2cap 4 ,
.Xr l2control 8
.Sh AUTHORS
-.An Maksim Yevmenkin Aq emax@FreeBSD.org
+.An Maksim Yevmenkin Aq Mt emax@FreeBSD.org
.Sh BUGS
Could collect more statistic.
Could check for duplicated, corrupted and lost packets.
diff --git a/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 b/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8
index 0588d0c3f5db..6763008bd047 100644
--- a/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8
+++ b/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8
@@ -343,7 +343,7 @@ label.
.Xr sdpcontrol 8 ,
.Xr sdpd 8
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
.Sh CAVEATS
The
.Nm
diff --git a/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8 b/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8
index 8104bba7adec..89db90b85955 100644
--- a/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8
+++ b/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8
@@ -96,7 +96,7 @@ are:
.Xr bluetooth 3 ,
.Xr sdp 3
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
.Sh CAVEATS
The
.Nm
diff --git a/usr.sbin/bluetooth/sdpd/sdpd.8 b/usr.sbin/bluetooth/sdpd/sdpd.8
index 0844e30ee15d..6a7b162a43a5 100644
--- a/usr.sbin/bluetooth/sdpd/sdpd.8
+++ b/usr.sbin/bluetooth/sdpd/sdpd.8
@@ -134,7 +134,7 @@ as RFCOMM channels etc., before registering the service.
.Xr sdp 3 ,
.Xr sdpcontrol 8
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
.Sh BUGS
Most likely.
Please report if found.
diff --git a/usr.sbin/boot0cfg/boot0cfg.8 b/usr.sbin/boot0cfg/boot0cfg.8
index 27f94e062d04..9e413c0a6114 100644
--- a/usr.sbin/boot0cfg/boot0cfg.8
+++ b/usr.sbin/boot0cfg/boot0cfg.8
@@ -190,7 +190,7 @@ to install the default MBR:
.Xr fdisk 8 ,
.Xr gpart 8
.Sh AUTHORS
-.An Robert Nordier Aq rnordier@FreeBSD.org .
+.An Robert Nordier Aq Mt rnordier@FreeBSD.org
.Sh BUGS
Use of the
.Sq packet
diff --git a/usr.sbin/bootparamd/bootparamd/bootparamd.8 b/usr.sbin/bootparamd/bootparamd/bootparamd.8
index 4d97cb52c37a..183302aa4748 100644
--- a/usr.sbin/bootparamd/bootparamd/bootparamd.8
+++ b/usr.sbin/bootparamd/bootparamd/bootparamd.8
@@ -69,7 +69,7 @@ The alias address must of course be free for use.
.Xr diskless 8
.Sh AUTHORS
Written by
-.An Klas Heggemann Aq klas@nada.kth.se .
+.An Klas Heggemann Aq Mt klas@nada.kth.se .
.Sh BUGS
You may find the
.Xr syslog 3
diff --git a/usr.sbin/bsdconfig/bsdconfig.8 b/usr.sbin/bsdconfig/bsdconfig.8
index b99cac248d81..3f25c95ccd1d 100644
--- a/usr.sbin/bsdconfig/bsdconfig.8
+++ b/usr.sbin/bsdconfig/bsdconfig.8
@@ -236,7 +236,7 @@ first appeared in
.Fx 9.2 .
.Sh AUTHORS
.An Ron McDowell
-.An Devin Teske Aq dteske@FreeBSD.org
+.An Devin Teske Aq Mt dteske@FreeBSD.org
.Sh BUGS
The docsinstall and diskmgmt modules call bsdinstall.
Bugs found in these modules should be considered those of bsdinstall, not
diff --git a/usr.sbin/bsdconfig/dot/dot b/usr.sbin/bsdconfig/dot/dot
index 9093d633dd28..f71c0e81487f 100755
--- a/usr.sbin/bsdconfig/dot/dot
+++ b/usr.sbin/bsdconfig/dot/dot
@@ -249,6 +249,7 @@ if [ "$SHOW_INCLUDES" ]; then
$menu_program_list \
$submenu_program_list \
$cmd_program_list \
+ $BSDCFG_SHARE/script.subr \
; do
[ -e "$file" ] && echo $file
done | sort -u
@@ -299,12 +300,6 @@ if [ "$SHOW_INCLUDES" ]; then
fi
#
-# Add script.subr to includes if it exists
-#
-[ -f $BSDCFG_SHARE/script.subr ] &&
- include_file_list="$include_file_list script.subr"
-
-#
# Start the directional-graph (digraph) output
#
printf 'strict digraph "" { // Empty name to prevent SVG Auto-Tooltip\n'
@@ -352,7 +347,7 @@ printf '\tnode [\n'
printf '\t\tfontname = "Times-Roman",\n'
printf '\t\tfontsize = 12,\n'
printf '\t\twidth = 2.5, // arbitrary minimum width for all nodes\n'
-printf '\t\tfixedsize, // turn minimum width into exact width\n'
+printf '\t\tfixedsize = true, // turn minimum width into exact width\n'
printf '\t];\n'
#
@@ -546,34 +541,36 @@ printf '\t\tbgcolor = "%s";\n' "$bgcolor_bsdconfig"
printf '\t\tlabel = "bsdconfig(8)";\n'
printf '\t\ttooltip = "bsdconfig(8)";\n'
print_node "bsdconfig"
+end_nodelist
if [ "$SHOW_INCLUDES" ]; then
- printf '\t\tsubgraph "cluster_includes" {\n'
- printf '\t\t\tbgcolor = "%s";\n' "$bgcolor_includes"
- printf '\t\t\tlabel = "%s";\n' "$msg_includes"
-
for include_file in $include_file_list; do
echo $include_file
- done | awk -v bgcolor="$bgcolor_bsdconfig" '
- BEGIN { created = 0 }
- function end_subgraph() { printf "\t\t\t};\n" }
- ( $0 !~ "/" ) {
- if ( ! created )
- {
- printf "\t\t\tsubgraph \"%s\" {\n",
- "cluster_bsdconfig_includes"
- printf "\t\t\t\tbgcolor = \"%s\";\n", bgcolor
- printf "\t\t\t\tlabel = \"bsdconfig\";\n"
- created++
+ done | awk \
+ -v bgcolor="$bgcolor_bsdconfig" \
+ -v msg_subroutines="$msg_subroutines" \
+ '
+ BEGIN { created = 0 }
+ function end_subgraph() { printf "\t};\n" }
+ ( $0 !~ "/" ) {
+ if ( ! created )
+ {
+ printf "\tsubgraph \"%s\" {\n",
+ "cluster_bsdconfig_includes"
+ printf "\t\tbgcolor = \"%s\";\n", bgcolor
+ printf "\t\tlabel = \"bsdconfig %s\";\n",
+ msg_subroutines
+ created++
+ }
+ printf "\t\t\"%s\";\n", $1
}
- printf "\t\t\t\t\"%s\";\n", $1
- }
- END { created && end_subgraph() }'
+ END { created && end_subgraph() }
+ ' # END-QUOTE
for include_file in $include_file_list; do
echo $include_file
- done | awk '
+ done | awk -v msg_subroutines="$msg_subroutines" '
BEGIN { created = 0 }
- function end_subgraph() { printf "\t\t\t};\n" }
+ function end_subgraph() { printf "\t};\n" }
( $0 ~ "/" ) {
include_dir_tmp = $1
sub("/[^/]*$", "", include_dir_tmp)
@@ -588,20 +585,18 @@ if [ "$SHOW_INCLUDES" ]; then
if ( ! created )
{
include_dir = include_dir_tmp
- printf "\t\t\tsubgraph \"cluster_%s_includes\" {\n",
+ printf "\tsubgraph \"cluster_%s_includes\" {\n",
include_dir
- printf "\t\t\t\tbgcolor = \"white\";\n"
- printf "\t\t\t\tlabel = \"%s\";\n", include_dir
+ printf "\t\tbgcolor = \"thistle\";\n"
+ printf "\t\tlabel = \"%s %s\";\n", include_dir,
+ msg_subroutines
created++
}
- printf "\t\t\t\t\"%s\";\n", $1
+ printf "\t\t\"%s\";\n", $1
}
END { created && end_subgraph() }'
-
- printf '\t\t};\n'
fi
-end_nodelist
for INDEX in */INDEX; do
menu_title=
menu_help=
@@ -676,7 +671,7 @@ for INDEX in */INDEX; do
end_nodelist
done
-printf '\n};\n'
+printf '\n}\n'
################################################################################
# END
diff --git a/usr.sbin/bsdconfig/dot/include/messages.subr b/usr.sbin/bsdconfig/dot/include/messages.subr
index 527f30885ab0..f1095f7e4995 100644
--- a/usr.sbin/bsdconfig/dot/include/messages.subr
+++ b/usr.sbin/bsdconfig/dot/include/messages.subr
@@ -28,3 +28,4 @@ msg_graph_label_with_command="bsdconfig(8)\\\ndot(1) output generated by \`\`%s'
msg_graph_label_with_command_and_date="bsdconfig(8)\\\ndot(1) output generated by \`\`%s'' on\\\n%s"
msg_includes="Includes"
msg_shortcuts="Shortcuts"
+msg_subroutines="Subroutines"
diff --git a/usr.sbin/bsdconfig/examples/Makefile b/usr.sbin/bsdconfig/examples/Makefile
index d8813ce2646b..156ccaff9ace 100644
--- a/usr.sbin/bsdconfig/examples/Makefile
+++ b/usr.sbin/bsdconfig/examples/Makefile
@@ -3,7 +3,7 @@
NO_OBJ=
FILESDIR= ${SHAREDIR}/examples/bsdconfig
-FILES= browse_packages_ftp.sh browse_packages_http.sh bsdconfigrc
+FILES= add_some_packages.sh browse_packages_http.sh bsdconfigrc
beforeinstall:
mkdir -p ${DESTDIR}${FILESDIR}
diff --git a/usr.sbin/bsdconfig/examples/add_some_packages.sh b/usr.sbin/bsdconfig/examples/add_some_packages.sh
new file mode 100755
index 000000000000..8750908dbb2c
--- /dev/null
+++ b/usr.sbin/bsdconfig/examples/add_some_packages.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# $FreeBSD$
+#
+# This sample installs a short list of packages from the main HTTP site.
+#
+[ "$_SCRIPT_SUBR" ] || . /usr/share/bsdconfig/script.subr || exit 1
+nonInteractive=1
+_httpPath=http://pkg.freebsd.org
+mediaSetHTTP
+mediaOpen
+for package in wget bash rsync; do
+ packageAdd
+done
diff --git a/usr.sbin/bsdconfig/examples/browse_packages_ftp.sh b/usr.sbin/bsdconfig/examples/browse_packages_ftp.sh
deleted file mode 100755
index 015d799f801c..000000000000
--- a/usr.sbin/bsdconfig/examples/browse_packages_ftp.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-# $FreeBSD$
-#
-# This sample downloads the package INDEX file from FTP to /tmp (if it doesn't
-# already exist) and then displays the package configuration/management screen
-# using the local INDEX file (results in faster browsing of packages from-start
-# since the INDEX can be loaded from local media).
-#
-# NOTE: Packages cannot be installed unless staged to /tmp/packages/All
-#
-. /usr/share/bsdconfig/script.subr
-nonInteractive=1
-TMPDIR=/tmp
-if [ ! -e "$TMPDIR/packages/INDEX" ]; then
- [ -d "$TMPDIR/packages" ] || mkdir -p "$TMPDIR/packages" || exit 1
- _ftpPath=ftp://ftp.freebsd.org
- # For older releases, use ftp://ftp-archive.freebsd.org
- mediaSetFTP
- mediaOpen
- f_show_info "Downloading packages/INDEX from\n %s" "$_ftpPath"
- f_device_get device_media packages/INDEX > $TMPDIR/packages/INDEX
-fi
-_directoryPath=$TMPDIR
-mediaSetDirectory
-configPackages
diff --git a/usr.sbin/bsdconfig/examples/browse_packages_http.sh b/usr.sbin/bsdconfig/examples/browse_packages_http.sh
index a0e68013ad3a..91b928d183bb 100755
--- a/usr.sbin/bsdconfig/examples/browse_packages_http.sh
+++ b/usr.sbin/bsdconfig/examples/browse_packages_http.sh
@@ -1,25 +1,32 @@
#!/bin/sh
# $FreeBSD$
#
-# This sample downloads the package INDEX file from HTTP to /tmp (if it doesn't
-# already exist) and then displays the package configuration/management screen
-# using the local INDEX file (results in faster browsing of packages from-start
-# since the INDEX can be loaded from local media).
+# This sample downloads the package digests.txz and packagesite.txz files from
+# HTTP to /tmp (if they don't already exist) and then displays the package
+# configuration/management screen using the local files (resulting in faster
+# browsing of packages from-start since digests.txz/packagesite.txz can be
+# loaded from local media).
#
-# NOTE: Packages cannot be installed unless staged to /tmp/packages/All
+# NOTE: Packages cannot be installed unless staged to
+# /tmp/packages/$PKG_ABI/All
#
-. /usr/share/bsdconfig/script.subr
+[ "$_SCRIPT_SUBR" ] || . /usr/share/bsdconfig/script.subr || exit 1
nonInteractive=1
+f_musthavepkg_init # Make sure we have a usable pkg(8) with $PKG_ABI
TMPDIR=/tmp
-if [ ! -e "$TMPDIR/packages/INDEX" ]; then
- [ -d "$TMPDIR/packages" ] || mkdir -p "$TMPDIR/packages" || exit 1
- _httpPath=http://ftp.freebsd.org
- # For older releases, use http://ftp-archive.freebsd.org
- mediaSetHTTP
- mediaOpen
- f_show_info "Downloading packages/INDEX from\n %s" "$_httpPath"
- f_device_get device_media packages/INDEX > $TMPDIR/packages/INDEX
-fi
+PKGDIR=$TMPDIR/packages/$PKG_ABI
+[ -d "$PKGDIR" ] || mkdir -p "$PKGDIR" || exit 1
+for file in digests.txz packagesite.txz; do
+ [ -s "$PKGDIR/$file" ] && continue
+ if [ ! "$HTTP_INITIALIZED" ]; then
+ _httpPath=http://pkg.freebsd.org
+ mediaSetHTTP
+ mediaOpen
+ fi
+ f_show_info "Downloading %s from\n %s" "$file" "$_httpPath"
+ f_device_get device_media "/$PKG_ABI/latest/$file" > $PKGDIR/$file ||
+ exit 1
+done
_directoryPath=$TMPDIR
mediaSetDirectory
configPackages
diff --git a/usr.sbin/bsdconfig/include/messages.subr b/usr.sbin/bsdconfig/include/messages.subr
index bf16e0875586..3d6aad0cec8d 100644
--- a/usr.sbin/bsdconfig/include/messages.subr
+++ b/usr.sbin/bsdconfig/include/messages.subr
@@ -57,6 +57,7 @@ msg_back="Back"
msg_becoming_root_via_sudo="Becoming root via sudo(8)..."
msg_benchmarks_desc="Utilities for measuring system performance."
msg_biology_desc="Software related to biology."
+msg_bootstrapping_pkg="Bootstrapping pkg(8)..."
msg_brazil="Brazil"
msg_building_package_menus="Building package menu(s)..."
msg_cad_desc="Computer Aided Design utilities."
@@ -142,8 +143,6 @@ msg_generating_index_from_pkg_database="Generating INDEX from pkg(8) database\n(
msg_geography_desc="Geography-related software."
msg_german_desc="Ported software for Germanic countries."
msg_germany="Germany"
-msg_getting_package_categories_via_pkg_rquery="Getting package categories via pkg-rquery(8)..."
-msg_getting_package_dependencies_via_pkg_rquery="Getting package dependencies via pkg-rquery(8)\n(this can take a while)..."
msg_gnome_desc="Components of the Gnome Desktop environment."
msg_gnustep_desc="Software for GNUstep desktop environment."
msg_graphics_desc="Graphics libraries and utilities."
@@ -219,6 +218,7 @@ msg_misc_desc="Miscellaneous utilities."
msg_missing_ftp_host_or_directory="Missing FTP host or directory specification. FTP media not initialized."
msg_multimedia_desc="Multimedia software."
msg_must_be_root_to_execute="%s: must be root to execute"
+msg_must_have_pkg_to_execute="%s: must have pkg(8) to execute"
msg_must_specify_a_host_name_of_some_sort="Must specify a host name of some sort!"
msg_name_server="Name server"
msg_net_desc="Networking utilities."
@@ -274,6 +274,7 @@ msg_perl5_desc="Utilities/modules for the PERL5 language."
msg_permission_denied="%s: %s: Permission denied"
msg_pkg_delete_failed="Warning: pkg-delete(8) of %s failed.\n Run with debugging for details."
msg_pkg_install_apparently_did_not_like_the_package="pkg-install(8) apparently did not like the %s package."
+msg_pkg_not_yet_installed_install_now="pkg(8) not yet installed. Install now?"
msg_plan9_desc="Software from the Plan9 operating system."
msg_please_check_the_url_and_try_again="No such directory: %s\nplease check the URL and try again.\n"
msg_please_enter_password="Please enter your password for sudo(8):"
@@ -376,15 +377,13 @@ msg_unable_to_get_proper_ftp_path="Unable to get proper FTP path. FTP media not
msg_unable_to_initialize_media_type_for_package_extract="Unable to initialize media type for package extract."
msg_unable_to_make_directory_mountpoint="Unable to make %s directory mountpoint for %s!"
msg_unable_to_open="Unable to open %s"
-msg_unable_to_pkg_rquery_package_categories="Unable to pkg-rquery(8) package categories!"
-msg_unable_to_pkg_rquery_package_dependencies="Unable to pkg-rquery(8) package dependencies!"
msg_unable_to_update_pkg_from_selected_media="Unable to update pkg(8) from selected media."
msg_uninstall="Uninstall"
msg_uninstall_desc="Mark this package for deletion"
msg_uninstalling_package_waiting_for_pkg_delete="Uninstalling %s package - waiting for pkg-delete(8)"
msg_unknown="unknown"
msg_unknown_user="Unknown user: %s"
-msg_url_was_not_found="%s was not found, maybe directory or release-version are wrong?"
+msg_url_was_not_found="%s was not found,\nmaybe directory or release-version are wrong?"
msg_usa="USA"
msg_usage="Usage"
msg_usb="USB"
diff --git a/usr.sbin/bsdconfig/share/common.subr b/usr.sbin/bsdconfig/share/common.subr
index 762fd39e0342..8fb9adaa8ff9 100644
--- a/usr.sbin/bsdconfig/share/common.subr
+++ b/usr.sbin/bsdconfig/share/common.subr
@@ -62,12 +62,6 @@ export UNAME_S="$( uname -s )" # Operating System (i.e. FreeBSD)
export UNAME_P="$( uname -p )" # Processor Architecture (i.e. i386)
export UNAME_M="$( uname -m )" # Machine platform (i.e. i386)
export UNAME_R="$( uname -r )" # Release Level (i.e. X.Y-RELEASE)
-if [ ! "${PKG_ABI+set}" ]; then
- export PKG_ABI="$(
- ASSUME_ALWAYS_YES=1 pkg -vv 2> /dev/null |
- awk '$1=="ABI"{print $3;exit}'
- )"
-fi
#
# Default behavior is to call f_debug_init() automatically when loaded.
diff --git a/usr.sbin/bsdconfig/share/media/common.subr b/usr.sbin/bsdconfig/share/media/common.subr
index 7a6ddaa9388f..0bd420d58b38 100644
--- a/usr.sbin/bsdconfig/share/media/common.subr
+++ b/usr.sbin/bsdconfig/share/media/common.subr
@@ -44,7 +44,8 @@ MOUNTPOINT=/dist
#
# Media probe values to use for `f_media_get_TYPE media $file $PROBE' or
-# `f_device_get media $file $PROBE' (where $PROBE is one of the below values).
+# `f_device_get device_media $file $PROBE' (where $PROBE is one of the below
+# values).
#
PROBE_EXIST=1
PROBE_SIZE=2
diff --git a/usr.sbin/bsdconfig/share/media/http.subr b/usr.sbin/bsdconfig/share/media/http.subr
index 6d6aa10433b4..b928f7d6a78f 100644
--- a/usr.sbin/bsdconfig/share/media/http.subr
+++ b/usr.sbin/bsdconfig/share/media/http.subr
@@ -515,10 +515,7 @@ f_media_init_http()
fi
esac
- if [ $http_found -eq $SUCCESS ]; then
- HTTP_INITIALIZED=YES
- break
- fi
+ [ $http_found -eq $SUCCESS ] && HTTP_INITIALIZED=YES break
f_getvar $VAR_HTTP_PATH http_path
f_show_msg "$msg_please_check_the_url_and_try_again" \
@@ -668,7 +665,7 @@ f_media_get_http()
44) f_show_msg "$msg_url_was_not_found" "$url" ;;
4) f_show_msg "$msg_client_error" ;;
*) f_show_msg "$msg_error_when_requesting_url" "$url" ;;
- esac
+ esac 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
return $FAILURE
}
diff --git a/usr.sbin/bsdconfig/share/media/httpproxy.subr b/usr.sbin/bsdconfig/share/media/httpproxy.subr
index 66e5be4a9934..1ef516f76463 100644
--- a/usr.sbin/bsdconfig/share/media/httpproxy.subr
+++ b/usr.sbin/bsdconfig/share/media/httpproxy.subr
@@ -452,7 +452,7 @@ f_media_get_http_proxy()
44) f_show_msg "$msg_url_was_not_found" "$url" ;;
4) f_show_msg "$msg_client_error" ;;
*) f_show_msg "$msg_error_when_requesting_url" "$url" ;;
- esac
+ esac 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
return $FAILURE
}
diff --git a/usr.sbin/bsdconfig/share/packages/Makefile b/usr.sbin/bsdconfig/share/packages/Makefile
index 2a0235399c1a..cb06b80ff1ea 100644
--- a/usr.sbin/bsdconfig/share/packages/Makefile
+++ b/usr.sbin/bsdconfig/share/packages/Makefile
@@ -3,7 +3,7 @@
NO_OBJ=
FILESDIR= ${SHAREDIR}/bsdconfig/packages
-FILES= categories.subr index.subr packages.subr
+FILES= categories.subr index.subr musthavepkg.subr packages.subr
beforeinstall:
mkdir -p ${DESTDIR}${FILESDIR}
diff --git a/usr.sbin/bsdconfig/share/packages/categories.subr b/usr.sbin/bsdconfig/share/packages/categories.subr
index 474c41d948ed..474c41d948ed 100755..100644
--- a/usr.sbin/bsdconfig/share/packages/categories.subr
+++ b/usr.sbin/bsdconfig/share/packages/categories.subr
diff --git a/usr.sbin/bsdconfig/share/packages/index.subr b/usr.sbin/bsdconfig/share/packages/index.subr
index 9586501228ba..35ef0dad14e1 100755..100644
--- a/usr.sbin/bsdconfig/share/packages/index.subr
+++ b/usr.sbin/bsdconfig/share/packages/index.subr
@@ -33,6 +33,7 @@ BSDCFG_SHARE="/usr/share/bsdconfig"
f_dprintf "%s: loading includes..." packages/index.subr
f_include $BSDCFG_SHARE/device.subr
f_include $BSDCFG_SHARE/media/common.subr
+f_include $BSDCFG_SHARE/packages/musthavepkg.subr
f_include $BSDCFG_SHARE/strings.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig"
@@ -53,27 +54,6 @@ SQLITE_REPO="/var/db/pkg/repo-packagesite.sqlite"
#
PACKAGES_INDEX_CACHEFILE="/var/run/bsdconfig/packages_INDEX.cache"
-#
-# INDEX format for FreeBSD-6.0 or higher:
-#
-# package|port-origin|install-prefix|comment|port-desc-file|maintainer|
-# categories|build-deps|run-deps|www-site|reserve|reserve|reserve|disc
-#
-INDEX_FORMAT="%n-%v" # package
-INDEX_FORMAT="$INDEX_FORMAT|/usr/ports/%o" # port-origin
-INDEX_FORMAT="$INDEX_FORMAT|%p" # install-prefix
-INDEX_FORMAT="$INDEX_FORMAT|%c" # comment
-INDEX_FORMAT="$INDEX_FORMAT|/usr/ports/%o/pkg-descr" # port-desc-file
-INDEX_FORMAT="$INDEX_FORMAT|%m" # maintainer
-INDEX_FORMAT="$INDEX_FORMAT|@CATEGORIES@" # place-holder
-INDEX_FORMAT="$INDEX_FORMAT|" # build-deps
-INDEX_FORMAT="$INDEX_FORMAT|@RUNDEPS@" # place-holder
-INDEX_FORMAT="$INDEX_FORMAT|%w" # www-site
-INDEX_FORMAT="$INDEX_FORMAT|" # reserved
-INDEX_FORMAT="$INDEX_FORMAT|" # reserved
-INDEX_FORMAT="$INDEX_FORMAT|" # reserved
-INDEX_FORMAT="$INDEX_FORMAT|" # disc
-
############################################################ FUNCTIONS
# f_index_initialize [$var_to_set]
@@ -87,13 +67,16 @@ INDEX_FORMAT="$INDEX_FORMAT|" # disc
f_index_initialize()
{
local __funcname=f_index_initialize
- local __var_to_set="${2:-PACKAGE_INDEX}"
+ local __var_to_set="${1:-PACKAGE_INDEX}"
[ "$_INDEX_INITTED" ] && return $SUCCESS
# Got any media?
f_media_verify || return $FAILURE
+ # Make sure we have a usable pkg(8) with $PKG_ABI
+ f_musthavepkg_init
+
# Does it move when you kick it?
f_device_init device_media || return $FAILURE
@@ -126,9 +109,10 @@ f_index_initialize()
__site="file://$MOUNTPOINT/packages/$PKG_ABI"
esac
- export PACKAGESITE="$__site"
- f_dprintf "PACKAGESITE=[%s]" "$PACKAGESITE"
- if ! f_eval_catch $__funcname pkg "pkg update"; then
+ f_dprintf "PACKAGESITE=[%s]" "$__site"
+ if ! f_eval_catch $__funcname pkg \
+ 'PACKAGESITE="%s" pkg update' "$__site"
+ then
f_show_err "$msg_unable_to_update_pkg_from_selected_media"
f_device_shutdown device_media
return $FAILURE
@@ -195,53 +179,8 @@ f_index_initialize()
# If we reach this point, we need to generate the data from scratch
#
- f_show_info "$msg_getting_package_categories_via_pkg_rquery"
- if ! eval "$( pkg rquery "%n-%v %C" | awk '
- { categories[$1] = categories[$1] " " $2 }
- END {
- for (package in categories)
- {
- cats = categories[package]
- sub(/^ /, "", cats)
- gsub(/[^[:alnum:]_]/, "_", package)
- printf "local _%s_categories=\"%s\";\n", package, cats
- }
- }' )"; then
- f_show_err "$msg_unable_to_pkg_rquery_package_dependencies"
- f_device_shutdown device_media
- return $FAILURE
- fi
-
- f_show_info "$msg_getting_package_dependencies_via_pkg_rquery"
- if ! eval "$( pkg rquery "%n-%v %dn-%dv" | awk '
- { rundeps[$1] = rundeps[$1] " " $2 }
- END {
- for (package in rundeps)
- {
- deps = rundeps[package]
- sub(/^ /, "", deps)
- gsub(/[^[:alnum:]_]/, "_", package)
- printf "local _%s_rundeps=\"%s\";\n", package, deps
- }
- }' )"; then
- f_show_err "$msg_unable_to_pkg_rquery_package_dependencies"
- f_device_shutdown device_media
- return $FAILURE
- fi
-
f_show_info "$msg_generating_index_from_pkg_database"
- eval "$__var_to_set"='$( pkg rquery "$INDEX_FORMAT" |
- while read LINE; do
- package="${LINE%%|*}";
- f_str2varname "$package" varpkg;
- eval f_replaceall \"\$LINE\" \"\|@CATEGORIES@\|\" \
- \"\|\$_${varpkg}_categories\|\" LINE
- eval f_replaceall \"\$LINE\" \"\|@RUNDEPS@\|\" \
- \"\|\$_${varpkg}_rundeps\|\" LINE
- echo "$LINE"
- done
- )' # always returns true (status of last item in pipe-chain)
- eval "$__var_to_set"='$( debug= f_getvar "$__var_to_set" | sort )'
+ eval "$__var_to_set"='$( pkg rquery -I | sort )'
#
# Attempt to create the persistant on-disk cache
@@ -258,7 +197,7 @@ f_index_initialize()
# Finally, move the temporary file into place
case "$PACKAGES_INDEX_CACHEFILE" in
- */*) f_eval_catch -d $funcname mkdir \
+ */*) f_eval_catch -d $__funcname mkdir \
'mkdir -p "%s"' "${PACKAGES_INDEX_CACHEFILE%/*}"
esac
f_eval_catch -d $__funcname mv 'mv -f "%s" "%s"' \
diff --git a/usr.sbin/bsdconfig/share/packages/musthavepkg.subr b/usr.sbin/bsdconfig/share/packages/musthavepkg.subr
new file mode 100644
index 000000000000..929823e4f21e
--- /dev/null
+++ b/usr.sbin/bsdconfig/share/packages/musthavepkg.subr
@@ -0,0 +1,87 @@
+if [ ! "$_PACKAGES_MUSTHAVEPKG_SUBR" ]; then _PACKAGES_MUSTHAVEPKG_SUBR=1
+#
+# Copyright (c) 2014 Devin Teske
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+############################################################ INCLUDES
+
+BSDCFG_SHARE="/usr/share/bsdconfig"
+. $BSDCFG_SHARE/common.subr || exit 1
+f_dprintf "%s: loading includes..." packages/musthavepkg.subr
+f_include $BSDCFG_SHARE/dialog.subr
+f_include $BSDCFG_SHARE/mustberoot.subr
+
+############################################################ FUNCTIONS
+
+# f_musthavepkg_init
+#
+# Validate pkg(8) is installed and set $PKG_ABI global if not already set.
+# Returns success unless pkg(8) is not installed and user refuses to install
+# it (upon prompt when running interactively).
+#
+f_musthavepkg_init()
+{
+ local funcname=f_musthavepkg_init
+ local pkg_abi_awk='$1~/^ABI/{print $NF; exit}'
+
+ if [ "$PKG_ABI" ]; then # Already set
+ f_dprintf "PKG_ABI=[%s]" "$PKG_ABI"
+ export PKG_ABI
+ f_quietly pkg -N -vv # return status (pkg(8) functional?)
+ return $?
+ fi
+
+ # Attempt to get PKG_ABI without prematurely bootstrapping pkg(8)
+ if f_eval_catch -k PKG_ABI $funcname pkg \
+ "pkg -N -vv | awk '%s'" "$pkg_abi_awk"
+ then
+ f_dprintf "PKG_ABI=[%s]" "$PKG_ABI"
+ export PKG_ABI
+ return $SUCCESS
+ fi
+
+ # pkg(8) not yet bootstrapped; ask for permission unless nonInteractive
+ f_dialog_yesno "$msg_pkg_not_yet_installed_install_now" ||
+ f_die 1 "$msg_must_have_pkg_to_execute" "$pgm"
+
+ f_mustberoot_init # Have to be root to install pkg(8)
+
+ # Bootstrap pkg(8)
+ f_dialog_info "$msg_bootstrapping_pkg"
+ f_eval_catch -k PKG_ABI $funcname pkg \
+ "ASSUME_ALWAYS_YES=1 pkg -vv | awk '%s'" "$pkg_abi_awk" ||
+ f_die 1 "$msg_must_have_pkg_to_execute" "$pgm"
+
+ f_dprintf "PKG_ABI=[%s]" "$PKG_ABI"
+ export PKG_ABI
+ return $SUCCESS
+}
+
+############################################################ MAIN
+
+f_dprintf "%s: Successfully loaded." packages/musthavepkg.subr
+
+fi # ! $_PACKAGES_MUSTHAVEPKG_SUBR
diff --git a/usr.sbin/bsdconfig/share/packages/packages.subr b/usr.sbin/bsdconfig/share/packages/packages.subr
index 6fc936fe9e9d..a041fb643749 100755..100644
--- a/usr.sbin/bsdconfig/share/packages/packages.subr
+++ b/usr.sbin/bsdconfig/share/packages/packages.subr
@@ -36,6 +36,7 @@ f_include $BSDCFG_SHARE/device.subr
f_include $BSDCFG_SHARE/media/common.subr
f_include $BSDCFG_SHARE/packages/categories.subr
f_include $BSDCFG_SHARE/packages/index.subr
+f_include $BSDCFG_SHARE/packages/musthavepkg.subr
f_include $BSDCFG_SHARE/strings.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig"
@@ -662,7 +663,7 @@ f_package_review()
f_package_config()
{
# Did we get an INDEX?
- f_index_initialize packages/INDEX || return $FAILURE
+ f_index_initialize || return $FAILURE
# Creates following variables (indirectly via f_index_read())
# CATEGORY_MENU_LIST _categories_{varpkg} _rundeps_{varpkg}
# PACKAGE_CATEGORIES _npkgs
@@ -839,7 +840,7 @@ f_package_add()
{ # Verify and initialize device media if-defined
f_media_verify &&
f_device_init device_media &&
- f_index_initialize packages/INDEX
+ f_index_initialize
} || return $FAILURE
# Now we have (indirectly via f_index_read()):
@@ -946,6 +947,8 @@ f_package_extract()
local device="$1" name="$2" depended="$3"
local devname=
+ f_musthavepkg_init # Make sure we have a usable pkg(8) with $PKG_ABI
+
$device get name devname
f_dprintf "$funcname: device=[%s] name=[%s] depended=[%s]" \
"$devname" "$name" "$depended"
@@ -1065,7 +1068,7 @@ f_package_delete()
{ # Verify and initialize device media if-defined
f_media_verify &&
f_device_init device_media &&
- f_index_initialize packages/INDEX
+ f_index_initialize
} || return $FAILURE
# Now we have (indirectly via f_index_read()):
diff --git a/usr.sbin/bsdinstall/bsdinstall.8 b/usr.sbin/bsdinstall/bsdinstall.8
index b841c36df815..98bab0a52bad 100644
--- a/usr.sbin/bsdinstall/bsdinstall.8
+++ b/usr.sbin/bsdinstall/bsdinstall.8
@@ -367,5 +367,4 @@ This version of
first appeared in
.Fx 9.0 .
.Sh AUTHORS
-.An -nosplit
-.An Nathan Whitehorn Aq nwhitehorn@FreeBSD.org
+.An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org
diff --git a/usr.sbin/bsdinstall/distextract/Makefile b/usr.sbin/bsdinstall/distextract/Makefile
index e359bba590e5..f84c4d744a37 100644
--- a/usr.sbin/bsdinstall/distextract/Makefile
+++ b/usr.sbin/bsdinstall/distextract/Makefile
@@ -2,20 +2,10 @@
BINDIR= /usr/libexec/bsdinstall
PROG= distextract
-DPADD= ${LIBARCHIVE} ${LIBDIALOG} ${LIBM}
-LDADD= -larchive -ldialog -lm
+DPADD= ${LIBARCHIVE} ${LIBNCURSESW} ${LIBDIALOG} ${LIBM}
+LDADD= -larchive -lncursesw -ldialog -lm
WARNS?= 6
MAN=
-.include <src.opts.mk>
-
-.if ${MK_NCURSESW} == "no"
-DPADD+= ${LIBNCURSES}
-LDADD+= -lncurses
-.else
-DPADD+= ${LIBNCURSESW}
-LDADD+= -lncursesw
-.endif
-
.include <bsd.prog.mk>
diff --git a/usr.sbin/bsdinstall/distfetch/Makefile b/usr.sbin/bsdinstall/distfetch/Makefile
index 2ac9eb611b73..ed1f5996ec58 100644
--- a/usr.sbin/bsdinstall/distfetch/Makefile
+++ b/usr.sbin/bsdinstall/distfetch/Makefile
@@ -2,20 +2,10 @@
BINDIR= /usr/libexec/bsdinstall
PROG= distfetch
-DPADD= ${LIBFETCH} ${LIBDIALOG} ${LIBM}
-LDADD= -lfetch -ldialog -lm
+DPADD= ${LIBFETCH} ${LIBNCURSESW} ${LIBDIALOG} ${LIBM}
+LDADD= -lfetch -lncursesw -ldialog -lm
WARNS?= 6
MAN=
-.include <src.opts.mk>
-
-.if ${MK_NCURSESW} == "no"
-DPADD+= ${LIBNCURSES}
-LDADD+= -lncurses
-.else
-DPADD+= ${LIBNCURSESW}
-LDADD+= -lncursesw
-.endif
-
.include <bsd.prog.mk>
diff --git a/usr.sbin/bsdinstall/partedit/Makefile b/usr.sbin/bsdinstall/partedit/Makefile
index 328259c1ec11..fb758884a572 100644
--- a/usr.sbin/bsdinstall/partedit/Makefile
+++ b/usr.sbin/bsdinstall/partedit/Makefile
@@ -5,8 +5,8 @@ PROG= partedit
LINKS= ${BINDIR}/partedit ${BINDIR}/autopart \
${BINDIR}/partedit ${BINDIR}/scriptedpart
SYMLINKS= ${BINDIR}/partedit /usr/sbin/sade
-DPADD= ${LIBGEOM} ${LIBUTIL} ${LIBDIALOG} ${LIBM}
-LDADD= -lgeom -lutil -ldialog -lm
+DPADD= ${LIBGEOM} ${LIBNCURSESW} ${LIBUTIL} ${LIBDIALOG} ${LIBM}
+LDADD= -lgeom -lncursesw -lutil -ldialog -lm
PARTEDIT_ARCH= ${MACHINE}
.if ${MACHINE} == "i386" || ${MACHINE} == "amd64"
@@ -22,14 +22,4 @@ SRCS= diskeditor.c partedit.c gpart_ops.c partedit_${PARTEDIT_ARCH}.c \
WARNS?= 3
MAN= sade.8
-.include <src.opts.mk>
-
-.if ${MK_NCURSESW} == "no"
-DPADD+= ${LIBNCURSES}
-LDADD+= -lncurses
-.else
-DPADD+= ${LIBNCURSESW}
-LDADD+= -lncursesw
-.endif
-
.include <bsd.prog.mk>
diff --git a/usr.sbin/bsdinstall/partedit/partedit_powerpc.c b/usr.sbin/bsdinstall/partedit/partedit_powerpc.c
index 4fa2e0530e28..77c682a6b94d 100644
--- a/usr.sbin/bsdinstall/partedit/partedit_powerpc.c
+++ b/usr.sbin/bsdinstall/partedit/partedit_powerpc.c
@@ -60,7 +60,8 @@ is_scheme_bootable(const char *part_type) {
if (strcmp(platform, "ps3") == 0 && strcmp(part_type, "GPT") == 0)
return (1);
if (strcmp(platform, "chrp") == 0 &&
- (strcmp(part_type, "MBR") == 0 || strcmp(part_type, "BSD") == 0))
+ (strcmp(part_type, "MBR") == 0 || strcmp(part_type, "BSD") == 0 ||
+ strcmp(part_type, "GPT") == 0))
return (1);
return (0);
@@ -68,13 +69,28 @@ is_scheme_bootable(const char *part_type) {
size_t
bootpart_size(const char *part_type) {
+ size_t platlen = sizeof(platform);
+ if (strlen(platform) == 0)
+ sysctlbyname("hw.platform", platform, &platlen, NULL, -1);
+
if (strcmp(part_type, "APM") == 0 || strcmp(part_type, "MBR") == 0)
return (800*1024);
+ if (strcmp(platform, "chrp") == 0 && strcmp(part_type, "GPT") == 0)
+ return (800*1024);
return (0);
}
const char *
bootpart_type(const char *scheme) {
+ size_t platlen = sizeof(platform);
+ if (strlen(platform) == 0)
+ sysctlbyname("hw.platform", platform, &platlen, NULL, -1);
+
+ if (strcmp(platform, "chrp") == 0)
+ return ("prep-boot");
+ if (strcmp(platform, "powermac") == 0)
+ return ("apple-boot");
+
return ("freebsd-boot");
}
@@ -85,9 +101,14 @@ bootcode_path(const char *part_type) {
const char *
partcode_path(const char *part_type) {
+ size_t platlen = sizeof(platform);
+ if (strlen(platform) == 0)
+ sysctlbyname("hw.platform", platform, &platlen, NULL, -1);
+
if (strcmp(part_type, "APM") == 0)
return ("/boot/boot1.hfs");
- if (strcmp(part_type, "MBR") == 0)
+ if (strcmp(part_type, "MBR") == 0 ||
+ (strcmp(platform, "chrp") == 0 && strcmp(part_type, "GPT") == 0))
return ("/boot/boot1.elf");
return (NULL);
}
diff --git a/usr.sbin/bsdinstall/partedit/partedit_x86.c b/usr.sbin/bsdinstall/partedit/partedit_x86.c
index 156674bda0d4..b458475fe6c6 100644
--- a/usr.sbin/bsdinstall/partedit/partedit_x86.c
+++ b/usr.sbin/bsdinstall/partedit/partedit_x86.c
@@ -69,7 +69,7 @@ bootpart_size(const char *scheme) {
return (0);
if (strcmp(platform, "BIOS") == 0)
- return (64*1024);
+ return (512*1024);
else
return (800*1024);
diff --git a/usr.sbin/bsdinstall/partedit/sade.8 b/usr.sbin/bsdinstall/partedit/sade.8
index 441ddc02ab90..79df079e371b 100644
--- a/usr.sbin/bsdinstall/partedit/sade.8
+++ b/usr.sbin/bsdinstall/partedit/sade.8
@@ -64,12 +64,11 @@ installer. It was replaced in
with the equivalent part of
.Xr bsdinstall 8 .
.Sh AUTHORS
-.An Nathan Whitehorn Aq nwhitehorn@FreeBSD.org
+.An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org
.Sh BUGS
The utility misses a lot of nice features, such as tools for
manipulating
.Xr gmirror 8
or
-.Xr zfs 8
-.
+.Xr zfs 8 .
These will be added later.
diff --git a/usr.sbin/bsdinstall/scripts/mirrorselect b/usr.sbin/bsdinstall/scripts/mirrorselect
index ef17cfe61a2c..af87f443653b 100755
--- a/usr.sbin/bsdinstall/scripts/mirrorselect
+++ b/usr.sbin/bsdinstall/scripts/mirrorselect
@@ -158,6 +158,7 @@ MIRROR_BUTTON=$?
exec 3>&-
_UNAME_R=`uname -r`
+_UNAME_R=${_UNAME_R%-p*}
case ${_UNAME_R} in
*-CURRENT|*-STABLE|*-PRERELEASE)
diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
index f5656550027a..9f1abb8b2f2c 100755
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -45,6 +45,11 @@ f_include $BSDCFG_SHARE/variable.subr
: ${ZFSBOOT_POOL_NAME:=zroot}
#
+# Default options to use when creating zroot pool
+#
+: ${ZFSBOOT_POOL_CREATE_OPTIONS:=-O compress=lz4 -O atime=off}
+
+#
# Default name for the boot environment parent dataset
#
: ${ZFSBOOT_BEROOT_NAME:=ROOT}
@@ -82,6 +87,11 @@ f_include $BSDCFG_SHARE/variable.subr
: ${ZFSBOOT_BOOT_POOL=}
#
+# Options to use when creating separate boot pool (if any)
+#
+: ${ZFSBOOT_BOOT_POOL_CREATE_OPTIONS:=}
+
+#
# Default name for boot pool when enabled (e.g., geli(8) or MBR)
#
: ${ZFSBOOT_BOOT_POOL_NAME:=bootpool}
@@ -108,6 +118,16 @@ f_include $BSDCFG_SHARE/variable.subr
: ${ZFSBOOT_SWAP_SIZE:=2g}
#
+# Should we use geli(8) to encrypt the swap?
+#
+: ${ZFSBOOT_SWAP_ENCRYPTION=}
+
+#
+# Should we use gmirror(8) to mirror the swap?
+#
+: ${ZFSBOOT_SWAP_MIRROR=}
+
+#
# Default ZFS datasets for root zpool
#
# NOTE: Requires /tmp, /var/tmp, /$ZFSBOOT_BOOTFS_NAME/$ZFSBOOT_BOOTFS_NAME
@@ -121,7 +141,7 @@ f_isset ZFSBOOT_DATASETS || ZFSBOOT_DATASETS="
/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME mountpoint=/
# Compress /tmp, allow exec but not setuid
- /tmp mountpoint=/tmp,compression=lz4,exec=on,setuid=off
+ /tmp mountpoint=/tmp,exec=on,setuid=off
# Don't mount /usr so that 'base' files go to the BEROOT
/usr mountpoint=/usr,canmount=off
@@ -130,17 +150,17 @@ f_isset ZFSBOOT_DATASETS || ZFSBOOT_DATASETS="
/usr/home # NB: /home is a symlink to /usr/home
# Ports tree
- /usr/ports compression=lz4,setuid=off
+ /usr/ports setuid=off
# Source tree (compressed)
- /usr/src compression=lz4,exec=off,setuid=off
+ /usr/src
# Create /var and friends
/var mountpoint=/var
- /var/crash compression=lz4,exec=off,setuid=off
- /var/log compression=lz4,exec=off,setuid=off
- /var/mail compression=lz4,atime=on
- /var/tmp compression=lz4,exec=on,setuid=off
+ /var/crash exec=off,setuid=off
+ /var/log exec=off,setuid=off
+ /var/mail atime=on
+ /var/tmp setuid=off
" # END-QUOTE
#
@@ -184,6 +204,7 @@ MOUNT_TYPE='mount -t %s "%s" "%s"'
PRINTF_CONF="printf '%s=\"%%s\"\\\n' %s >> \"%s\""
PRINTF_FSTAB='printf "$FSTAB_FMT" "%s" "%s" "%s" "%s" "%s" "%s" >> "%s"'
SHELL_TRUNCATE=':> "%s"'
+SWAP_GMIRROR_LABEL='gmirror label swap %s'
UMOUNT='umount "%s"'
ZFS_CREATE_WITH_OPTIONS='zfs create %s "%s"'
ZFS_SET='zfs set "%s" "%s"'
@@ -209,6 +230,8 @@ msg_configure_options="Configure Options:"
msg_detailed_disk_info="gpart(8) show %s:\n%s\n\ncamcontrol(8) inquiry %s:\n%s\n\n\ncamcontrol(8) identify %s:\n%s\n"
msg_disk_info="Disk Info"
msg_disk_info_help="Get detailed information on disk device(s)"
+msg_disk_singular="disk"
+msg_disk_plural="disks"
msg_encrypt_disks="Encrypt Disks?"
msg_encrypt_disks_help="Use geli(8) to encrypt all data partitions"
msg_error="Error"
@@ -263,6 +286,10 @@ msg_select_a_disk_device="Select a disk device"
msg_select_virtual_device_type="Select Virtual Device type:"
msg_stripe_desc="Stripe - No Redundancy"
msg_stripe_help="[1+ Disks] Striping provides maximum storage but no redundancy"
+msg_swap_encrypt="Encrypt Swap?"
+msg_swap_encrypt_help="Encrypt swap partitions with temporary keys, discarded on reboot"
+msg_swap_mirror="Mirror Swap?"
+msg_swap_mirror_help="Mirror swap partitions for redundancy, breaks crash dumps"
msg_swap_size="Swap Size"
msg_swap_size_help="Customize how much swap space is allocated to each selected disk"
msg_these_disks_are_too_small="These disks are too small given the amount of requested\nswap (%s) and/or geli(8) (%s) partitions, which would\ntake 50%% or more of each of the following selected disk\ndevices (not recommended):\n\n %s\n\nRecommend changing partition size(s) and/or selecting a\ndifferent set of devices."
@@ -285,15 +312,20 @@ dialog_menu_main()
local prompt="$msg_configure_options"
local force4k="$msg_no"
local usegeli="$msg_no"
+ local swapgeli="$msg_no"
+ local swapmirror="$msg_no"
[ "$ZFSBOOT_GNOP_4K_FORCE_ALIGN" ] && force4k="$msg_yes"
[ "$ZFSBOOT_GELI_ENCRYPTION" ] && usegeli="$msg_yes"
- local disks n
+ [ "$ZFSBOOT_SWAP_ENCRYPTION" ] && swapgeli="$msg_yes"
+ [ "$ZFSBOOT_SWAP_MIRROR" ] && swapmirror="$msg_yes"
+ local disks n disks_grammar
f_count n $ZFSBOOT_DISKS
- { [ $n -eq 1 ] && disks=disk; } || disks=disks # grammar
+ { [ $n -eq 1 ] && disks_grammar=$msg_disk_singular; } ||
+ disks_grammar=$msg_disk_plural # grammar
local menu_list="
'>>> $msg_install' '$msg_install_desc'
'$msg_install_help'
- 'T $msg_pool_type_disks' '$ZFSBOOT_VDEV_TYPE: $n $disks'
+ 'T $msg_pool_type_disks' '$ZFSBOOT_VDEV_TYPE: $n $disks_grammar'
'$msg_pool_type_disks_help'
'- $msg_rescan_devices' '*'
'$msg_rescan_devices_help'
@@ -309,6 +341,10 @@ dialog_menu_main()
'$msg_partition_scheme_help'
'S $msg_swap_size' '$ZFSBOOT_SWAP_SIZE'
'$msg_swap_size_help'
+ 'M $msg_swap_mirror' '$swapmirror'
+ '$msg_swap_mirror_help'
+ 'W $msg_swap_encrypt' '$swapgeli'
+ '$msg_swap_encrypt_help'
" # END-QUOTE
local defaultitem= # Calculated below
local hline="$hline_alnum_arrows_punc_tab_enter"
@@ -747,14 +783,14 @@ zfs_create_diskpart()
return $FAILURE
# NB: zpool will use the `zfs#' GPT labels
- bootpart=p2 targetpart=p2
+ bootpart=p2 swappart=p2 targetpart=p2
[ ${swapsize:-0} -gt 0 ] && targetpart=p3
#
# Prepare boot pool if enabled (e.g., for geli(8))
#
if [ "$ZFSBOOT_BOOT_POOL" ]; then
- bootpart=p2 targetpart=p3
+ bootpart=p2 swappart=p3 targetpart=p3
[ ${swapsize:-0} -gt 0 ] && targetpart=p4
f_eval_catch $funcname gpart \
"$GPART_ADD_LABEL_WITH_SIZE" boot$index \
@@ -781,12 +817,7 @@ zfs_create_diskpart()
return $FAILURE
# Pedantically nuke any old labels on the swap
f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
- /dev/gpt/swap$index
- # Update fstab(5)
- f_eval_catch $funcname printf "$PRINTF_FSTAB" \
- /dev/gpt/swap$index none swap sw 0 0 \
- $BSDINSTALL_TMPETC/fstab ||
- return $FAILURE
+ /dev/$disk$swappart
fi
#
@@ -827,7 +858,7 @@ zfs_create_diskpart()
return $FAILURE
# NB: zpool will use s1a (no labels)
- bootpart=s1a targetpart=s1d mbrindex=4
+ bootpart=s1a swappart=s1b targetpart=s1d mbrindex=4
#
# Always prepare a boot pool on MBR
@@ -858,11 +889,6 @@ zfs_create_diskpart()
# Pedantically nuke any old labels on the swap
f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
/dev/${disk}s1b
- # Update fstab(5)
- f_eval_catch $funcname printf "$PRINTF_FSTAB" \
- /dev/${disk}s1b none swap sw 0 0 \
- $BSDINSTALL_TMPETC/fstab ||
- return $FAILURE
fi
#
@@ -879,6 +905,33 @@ zfs_create_diskpart()
esac # $ZFSBOOT_PARTITION_SCHEME
+ # Update fstab(5)
+ if [ "$isswapmirror" ]; then
+ # This is not the first disk in the mirror, do nothing
+ elif [ "$ZFSBOOT_SWAP_ENCRYPTION" -a "$ZFSBOOT_SWAP_MIRROR" ]; then
+ f_eval_catch $funcname printf "$PRINTF_FSTAB" \
+ /dev/mirror/swap.eli none swap sw 0 0 \
+ $BSDINSTALL_TMPETC/fstab ||
+ return $FAILURE
+ isswapmirror=1
+ elif [ "$ZFSBOOT_SWAP_MIRROR" ]; then
+ f_eval_catch $funcname printf "$PRINTF_FSTAB" \
+ /dev/mirror/swap none swap sw 0 0 \
+ $BSDINSTALL_TMPETC/fstab ||
+ return $FAILURE
+ isswapmirror=1
+ elif [ "$ZFSBOOT_SWAP_ENCRYPTION" ]; then
+ f_eval_catch $funcname printf "$PRINTF_FSTAB" \
+ /dev/$disk${swappart}.eli none swap sw 0 0 \
+ $BSDINSTALL_TMPETC/fstab ||
+ return $FAILURE
+ else
+ f_eval_catch $funcname printf "$PRINTF_FSTAB" \
+ /dev/$disk$swappart none swap sw 0 0 \
+ $BSDINSTALL_TMPETC/fstab ||
+ return $FAILURE
+ fi
+
return $SUCCESS
}
@@ -893,10 +946,13 @@ zfs_create_boot()
local zroot_name="$1"
local zroot_vdevtype="$2"
local zroot_vdevs= # Calculated below
+ local swap_devs= # Calculated below
local boot_vdevs= # Used for geli(8) and/or MBR layouts
shift 2 # poolname vdev_type
local disks="$*" disk
- local bootpart targetpart # Set by zfs_create_diskpart() below
+ local isswapmirror
+ local bootpart targetpart swappart # Set by zfs_create_diskpart() below
+ local create_options
#
# Pedantic checks; should never be seen
@@ -968,7 +1024,8 @@ zfs_create_boot()
local n=0
for disk in $disks; do
zfs_create_diskpart $disk $n || return $FAILURE
- # Now $bootpart and $targetpart are set (suffix for $disk)
+ # Now $bootpart, $targetpart, and $swappart are set (suffix
+ # for $disk)
# Forced 4k alignment support using Geom NOP (see gnop(8))
if [ "$ZFSBOOT_GNOP_4K_FORCE_ALIGN" ]; then
@@ -1020,7 +1077,9 @@ zfs_create_boot()
f_count nvdevs $boot_vdevs
[ $nvdevs -gt 1 ] && bootpool_vdevtype=mirror
+ create_options="$ZFSBOOT_BOOT_POOL_CREATE_OPTIONS"
bootpool_options="-o altroot=$BSDINSTALL_CHROOT"
+ bootpool_options="$bootpool_options $create_options"
bootpool_options="$bootpool_options -m \"/$bootpool_name\" -f"
f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \
"$bootpool_options" "$bootpool_name" \
@@ -1087,23 +1146,26 @@ zfs_create_boot()
return $FAILURE
f_eval_catch -d $funcname umount "$UMOUNT" /mnt # tmpfs
fi
+ #
+ # Create the gmirror(8) GEOMS for swap
+ #
+ if [ "$ZFSBOOT_SWAP_MIRROR" ]; then
+ for disk in $disks; do
+ swap_devs="$swap_devs $disk$swappart"
+ done
+ f_eval_catch $funcname gmirror "$SWAP_GMIRROR_LABEL" \
+ "$swap_devs" || return $FAILURE
+ fi
#
# Create the ZFS root pool with desired type and disk devices
#
f_dprintf "$funcname: Creating root pool..."
+ create_options="$ZFSBOOT_POOL_CREATE_OPTIONS"
f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \
- "-o altroot=$BSDINSTALL_CHROOT -m none -f" \
- "$zroot_name" "$zroot_vdevtype" "$zroot_vdevs" ||
- return $FAILURE
-
- # Customize the zroot a bit...
- local option
- f_dprintf "$funcname: Setting miscellaneous options on root pool..."
- for option in atime=off; do
- f_eval_catch $funcname zfs "$ZFS_SET" $option "$zroot_name" ||
- return $FAILURE
- done
+ "-o altroot=$BSDINSTALL_CHROOT $create_options -m none -f" \
+ "$zroot_name" "$zroot_vdevtype" "$zroot_vdevs" ||
+ return $FAILURE
#
# Create ZFS dataset layout within the new root pool
@@ -1215,6 +1277,14 @@ zfs_create_boot()
f_eval_catch $funcname echo "$ECHO_APPEND" \
'kern.geom.label.disk_ident.enable=\"0\"' \
$BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE
+ f_eval_catch $funcname echo "$ECHO_APPEND" \
+ 'kern.geom.label.gptid.enable=\"0\"' \
+ $BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE
+
+ if [ "$ZFSBOOT_SWAP_MIRROR" ]; then
+ f_eval_catch $funcname echo "$ECHO_APPEND" 'geom_mirror_load=\"YES\"' \
+ $BSDINSTALL_TMPBOOT/loader.conf.gmirror || return $FAILURE
+ fi
# We're all done unless we should go on for boot pool
[ "$ZFSBOOT_BOOT_POOL" ] || return $SUCCESS
@@ -1448,6 +1518,22 @@ while :; do
"$ZFSBOOT_SWAP_SIZE" &&
ZFSBOOT_SWAP_SIZE="${input:-0}"
;;
+ ?" $msg_swap_mirror")
+ # Toggle the variable referenced both by the menu and later
+ if [ "$ZFSBOOT_SWAP_MIRROR" ]; then
+ ZFSBOOT_SWAP_MIRROR=
+ else
+ ZFSBOOT_SWAP_MIRROR=1
+ fi
+ ;;
+ ?" $msg_swap_encrypt")
+ # Toggle the variable referenced both by the menu and later
+ if [ "$ZFSBOOT_SWAP_ENCRYPTION" ]; then
+ ZFSBOOT_SWAP_ENCRYPTION=
+ else
+ ZFSBOOT_SWAP_ENCRYPTION=1
+ fi
+ ;;
esac
done
diff --git a/usr.sbin/bsnmpd/modules/Makefile b/usr.sbin/bsnmpd/modules/Makefile
index 24f9f0298c84..18d3085419ac 100644
--- a/usr.sbin/bsnmpd/modules/Makefile
+++ b/usr.sbin/bsnmpd/modules/Makefile
@@ -12,6 +12,7 @@ SUBDIR= ${_snmp_atm} \
snmp_bridge \
snmp_hast \
snmp_hostres \
+ snmp_lm75 \
snmp_mibII \
snmp_target \
snmp_usm \
diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend b/usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend
index 126a6e0c6d5f..cd6c4580e750 100644
--- a/usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend
+++ b/usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.sbin/bsnmpd/modules/snmp_bridge/Makefile.depend b/usr.sbin/bsnmpd/modules/snmp_bridge/Makefile.depend
index 520d81c5df2e..479f0565332a 100644
--- a/usr.sbin/bsnmpd/modules/snmp_bridge/Makefile.depend
+++ b/usr.sbin/bsnmpd/modules/snmp_bridge/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c b/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c
index f8644f4f8ec3..b8e66a69ef07 100644
--- a/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c
+++ b/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c
@@ -584,7 +584,7 @@ bridge_get_basemac(const char *bif_name, u_char *mac, size_t mlen)
/*
* Not just casting because of alignment constraints
- * on sparc64 and ia64.
+ * on sparc64.
*/
bcopy(ifa->ifa_addr, &sdl, sizeof(struct sockaddr_dl));
diff --git a/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3 b/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3
index b77b5f7ed6f5..677a276c1897 100644
--- a/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3
+++ b/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3
@@ -116,4 +116,4 @@ This is the private BEGEMOT-BRIDGE-MIB that is implemented by this module.
.Xr ifconfig 8 ,
.Xr snmpmod 3
.Sh AUTHORS
-.An Shteryana Shopova Aq syrinx@FreeBSD.org
+.An Shteryana Shopova Aq Mt syrinx@FreeBSD.org
diff --git a/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.3 b/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.3
index 2b966d714445..44a1590562b3 100644
--- a/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.3
+++ b/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.3
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 9, 2013
+.Dd May 31, 2014
.Dt SNMP_HAST 3
.Os
.Sh NAME
@@ -40,11 +40,12 @@ The
module implements a private BEGEMOT-HAST-MIB, which allows
management of HAST resources.
.Pp
-The module uses
+The module uses the
.Xr hastd 8
control socket to communicate with the daemon.
+The
.Va hastConfigFile
-variable can be used to specify the location of
+variable can be used to specify the location of the
.Xr hast.conf 5
file to find the address of the control connection.
.Sh FILES
@@ -62,8 +63,8 @@ configuration file.
.Sh SEE ALSO
.Xr bsnmpd 1 ,
.Xr gensnmptree 1 ,
+.Xr snmpmod 3 ,
.Xr hastctl 8 ,
-.Xr hastd 8 ,
-.Xr snmpmod 3
+.Xr hastd 8
.Sh AUTHORS
-.An Mikolaj Golub Aq trociny@FreeBSD.org
+.An Mikolaj Golub Aq Mt trociny@FreeBSD.org
diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile.depend b/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile.depend
index 1b6312499383..81b9958df464 100644
--- a/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile.depend
+++ b/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/snmp_hostres.3 b/usr.sbin/bsnmpd/modules/snmp_hostres/snmp_hostres.3
index 774c027dafca..73036c0ed3f0 100644
--- a/usr.sbin/bsnmpd/modules/snmp_hostres/snmp_hostres.3
+++ b/usr.sbin/bsnmpd/modules/snmp_hostres/snmp_hostres.3
@@ -85,4 +85,4 @@ This is the MIB that is implemented by this module.
.Xr gensnmptree 1 ,
.Xr snmpmod 3
.Sh AUTHORS
-.An Victor Cruceru Aq soc-victor@FreeBSD.org
+.An Victor Cruceru Aq Mt soc-victor@FreeBSD.org
diff --git a/usr.sbin/bsnmpd/modules/snmp_lm75/BEGEMOT-LM75-MIB.txt b/usr.sbin/bsnmpd/modules/snmp_lm75/BEGEMOT-LM75-MIB.txt
new file mode 100644
index 000000000000..f8f52a639be0
--- /dev/null
+++ b/usr.sbin/bsnmpd/modules/snmp_lm75/BEGEMOT-LM75-MIB.txt
@@ -0,0 +1,160 @@
+--
+-- Copyright (c) 2014 Luiz Otavio O Souza <loos@FreeBSD.org>
+-- All rights reserved.
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions
+-- are met:
+-- 1. Redistributions of source code must retain the above copyright
+-- notice, this list of conditions and the following disclaimer.
+-- 2. Redistributions in binary form must reproduce the above copyright
+-- notice, this list of conditions and the following disclaimer in the
+-- documentation and/or other materials provided with the distribution.
+--
+-- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+-- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+-- SUCH DAMAGE.
+--
+-- $FreeBSD$
+--
+
+BEGEMOT-LM75-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+ MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
+ Counter64, Integer32
+ FROM SNMPv2-SMI
+ TEXTUAL-CONVENTION, RowStatus
+ FROM SNMPv2-TC
+ begemot
+ FROM BEGEMOT-MIB;
+
+begemotLoos MODULE-IDENTITY
+ LAST-UPDATED "201402240000Z"
+ ORGANIZATION "FreeBSD"
+ CONTACT-INFO
+ " Luiz Otavio O Souza
+
+ Postal: N/A
+
+ Fax: N/A
+
+ E-Mail: loos@FreeBSD.org"
+ DESCRIPTION
+ "The Begemot MIB for reading lm75 sensors data."
+ REVISION "201402240000Z"
+ DESCRIPTION
+ "Initial revision."
+ ::= { begemot 400 }
+
+begemotLm75Objects OBJECT IDENTIFIER ::= { begemotLm75 1 }
+
+-- ---------------------------------------------------------- --
+-- Configuration parameters
+-- ---------------------------------------------------------- --
+
+lm75Sensor OBJECT IDENTIFIER ::= { begemotlm75Objects 1 }
+
+lm75Sensors OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of LM75 sensors in the system."
+ ::= { lm75Sensors 1 }
+
+-- ---------------------------------------------------------- --
+-- TempSensor Table
+-- ---------------------------------------------------------- --
+lm75SensorTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF Lm75SensorEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table containing information about all temperature sensors."
+ ::= { begemotLm75Objects 2 }
+
+loosTempSensorEntry OBJECT-TYPE
+ SYNTAX Lm75SensorEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Table entry that describes one temperature sensor."
+ INDEX { lm75SensorIndex }
+ ::= { lm75SensorTable 1 }
+
+Lm75SensorEntry ::= SEQUENCE {
+ lm75SensorIndex Integer32,
+ lm75SensorSysctlIndex Integer32,
+ lm75SensorDesc OCTET STRING,
+ lm75SensorLocation OCTET STRING,
+ lm75SensorPnpInfo OCTET STRING,
+ lm75SensorParent OCTET STRING,
+ lm75SensorTemperature Integer32
+}
+
+lm75SensorIndex OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "LM75 Sensor index."
+ ::= { lm75SensorEntry 1 }
+
+lm75SensorSysctlIndex OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "LM75 Sensor sysctl index."
+ ::= { lm75SensorEntry 2 }
+
+lm75SensorDesc OBJECT-TYPE
+ SYNTAX OCTET STRING
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "LM75 Sensor description."
+ ::= { lm75SensorEntry 3 }
+
+lm75SensorLocation OBJECT-TYPE
+ SYNTAX OCTET STRING
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "LM75 Sensor location."
+ ::= { lm75SensorEntry 4 }
+
+lm75SensorPnpInfo OBJECT-TYPE
+ SYNTAX OCTET STRING
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "LM75 Sensor pnp information."
+ ::= { lm75SensorEntry 5 }
+
+lm75SensorParent OBJECT-TYPE
+ SYNTAX OCTET STRING
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "LM75 Sensor parent bus."
+ ::= { lm75SensorEntry 6 }
+
+lm75SensorTemperature OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "LM75 Sensor temperature."
+ ::= { lm75SensorEntry 7 }
+
+END
diff --git a/usr.sbin/bsnmpd/modules/snmp_lm75/Makefile b/usr.sbin/bsnmpd/modules/snmp_lm75/Makefile
new file mode 100644
index 000000000000..f9ee77d37883
--- /dev/null
+++ b/usr.sbin/bsnmpd/modules/snmp_lm75/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+MOD= lm75
+SRCS= snmp_lm75.c
+XSYM= begemotLm75
+MAN= snmp_lm75.3
+
+BMIBS= BEGEMOT-LM75-MIB.txt
+DEFS= ${MOD}_tree.def
+
+.include <bsd.snmpmod.mk>
diff --git a/usr.sbin/bsnmpd/modules/snmp_lm75/Makefile.depend b/usr.sbin/bsnmpd/modules/snmp_lm75/Makefile.depend
new file mode 100644
index 000000000000..c831e4828308
--- /dev/null
+++ b/usr.sbin/bsnmpd/modules/snmp_lm75/Makefile.depend
@@ -0,0 +1,31 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ bin/cat.host \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libbsnmp/libbsnmp \
+ lib/libc \
+ lib/libcompiler_rt \
+ usr.bin/xinstall.host \
+ usr.sbin/bsnmpd/modules \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+lm75_tree.So: lm75_tree.c
+lm75_tree.So: lm75_tree.h
+lm75_tree.po: lm75_tree.c
+lm75_tree.po: lm75_tree.h
+snmp_lm75.So: lm75_oid.h
+snmp_lm75.So: lm75_tree.h
+snmp_lm75.po: lm75_oid.h
+snmp_lm75.po: lm75_tree.h
+.endif
diff --git a/usr.sbin/bsnmpd/modules/snmp_lm75/lm75_tree.def b/usr.sbin/bsnmpd/modules/snmp_lm75/lm75_tree.def
new file mode 100644
index 000000000000..3bfcd8d3bbcd
--- /dev/null
+++ b/usr.sbin/bsnmpd/modules/snmp_lm75/lm75_tree.def
@@ -0,0 +1,56 @@
+#-
+# Copyright (c) 2014 Luiz Otavio O Souza <loos@FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+(1 internet
+ (4 private
+ (1 enterprises
+ (12325 fokus
+ (1 begemot
+ (400 begemotLm75
+ (1 begemotLm75Objects
+ (1 lm75Sensors
+ (1 lm75Sensors INTEGER32 op_lm75Sensors GET)
+ )
+ (2 lm75SensorTable
+ (1 lm75SensorEntry : OCTETSTRING op_lm75SensorTable
+ (1 lm75SensorIndex INTEGER32 GET)
+ (2 lm75SensorSysctlIndex INTEGER32 GET)
+ (3 lm75SensorDesc OCTETSTRING GET)
+ (4 lm75SensorLocation OCTETSTRING GET)
+ (5 lm75SensorPnpInfo OCTETSTRING GET)
+ (6 lm75SensorParent OCTETSTRING GET)
+ (7 lm75SensorTemperature INTEGER32 GET)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+)
diff --git a/usr.sbin/bsnmpd/modules/snmp_lm75/snmp_lm75.3 b/usr.sbin/bsnmpd/modules/snmp_lm75/snmp_lm75.3
new file mode 100644
index 000000000000..cd9d5796d4cb
--- /dev/null
+++ b/usr.sbin/bsnmpd/modules/snmp_lm75/snmp_lm75.3
@@ -0,0 +1,60 @@
+.\"-
+.\" Copyright (c) 2014 Luiz Otavio O Souza <loos@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 2, 2014
+.Dt SNMP_LM75 3
+.Os
+.Sh NAME
+.Nm snmp_lm75
+.Nd "LM75 Sensor module for"
+.Xr bsnmpd 1
+.Sh LIBRARY
+.Pq begemotSnmpdModulePath."lm75" = "/usr/lib/snmp_lm75.so"
+.Sh DESCRIPTION
+The
+.Nm snmp_lm75
+module implements a private BEGEMOT-LM75-MIB, which allows
+reading the temperature of the LM75 sensors on the system.
+.Pp
+The module reads the sensor(s) temperature using the
+.Xr sysctl 8
+API.
+.Sh FILES
+.Bl -tag -width "XXXXXXXXX"
+.It Pa /usr/share/snmp/defs/lm75_tree.def
+The description of the MIB tree implemented by
+.Nm .
+.It Pa /usr/share/snmp/mibs/BEGEMOT-LM75-MIB.txt
+The private BEGEMOT-LM75-MIB that is implemented by this module.
+.El
+.Sh SEE ALSO
+.Xr bsnmpd 1 ,
+.Xr gensnmptree 1 ,
+.Xr snmpmod 3 ,
+.Xr lm75 4
+.Sh AUTHORS
+.An Luiz Otavio O Souza Aq Mt loos@FreeBSD.org
diff --git a/usr.sbin/bsnmpd/modules/snmp_lm75/snmp_lm75.c b/usr.sbin/bsnmpd/modules/snmp_lm75/snmp_lm75.c
new file mode 100644
index 000000000000..1822f7801e80
--- /dev/null
+++ b/usr.sbin/bsnmpd/modules/snmp_lm75/snmp_lm75.c
@@ -0,0 +1,435 @@
+/*-
+ * Copyright (c) 2014 Luiz Otavio O Souza <loos@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/sysctl.h>
+
+#include <bsnmp/snmpmod.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+
+#include "lm75_oid.h"
+#include "lm75_tree.h"
+
+#ifndef LM75BUF
+#define LM75BUF 64
+#endif
+#define TZ_ZEROC 2732
+#define UPDATE_INTERVAL 500 /* update interval in ticks */
+
+static struct lmodule *module;
+
+static const struct asn_oid oid_lm75 = OIDX_begemotLm75;
+
+/* the Object Resource registration index */
+static u_int lm75_index = 0;
+
+/* Number of available sensors in the system. */
+static int lm75_sensors;
+
+/*
+ * Structure that describes single sensor.
+ */
+struct lm75_snmp_sensor {
+ TAILQ_ENTRY(lm75_snmp_sensor) link;
+ int32_t index;
+ int32_t sysctlidx;
+ int32_t temp;
+ char desc[LM75BUF];
+ char location[LM75BUF];
+ char parent[LM75BUF];
+ char pnpinfo[LM75BUF];
+};
+
+static TAILQ_HEAD(, lm75_snmp_sensor) sensors =
+ TAILQ_HEAD_INITIALIZER(sensors);
+
+/* Ticks of the last sensors reading. */
+static uint64_t last_sensors_update;
+
+static void free_sensors(void);
+static int lm75_fini(void);
+static int lm75_init(struct lmodule *mod, int argc, char *argv[]);
+static void lm75_start(void);
+static int update_sensors(void);
+
+const struct snmp_module config = {
+ .comment =
+ "This module implements the BEGEMOT MIB for reading LM75 sensors data.",
+ .init = lm75_init,
+ .start = lm75_start,
+ .fini = lm75_fini,
+ .tree = lm75_ctree,
+ .tree_size = lm75_CTREE_SIZE,
+};
+
+static int
+lm75_init(struct lmodule *mod, int argc __unused, char *argv[] __unused)
+{
+
+ module = mod;
+
+ lm75_sensors = 0;
+ openlog("snmp_lm75", LOG_NDELAY | LOG_PID, LOG_DAEMON);
+
+ return(0);
+}
+
+static void
+lm75_start(void)
+{
+
+ lm75_index = or_register(&oid_lm75,
+ "The MIB module for reading lm75 sensors data.", module);
+}
+
+static int
+lm75_fini(void)
+{
+
+ or_unregister(lm75_index);
+ free_sensors();
+ closelog();
+
+ return (0);
+}
+
+static void
+free_sensors(void)
+{
+ struct lm75_snmp_sensor *sensor;
+
+ while ((sensor = TAILQ_FIRST(&sensors)) != NULL) {
+ TAILQ_REMOVE(&sensors, sensor, link);
+ free(sensor);
+ }
+}
+
+static int
+sysctlname(int *oid, int nlen, char *name, size_t len)
+{
+ int mib[12];
+
+ if (nlen > (int)(sizeof(mib) / sizeof(int) - 2))
+ return (-1);
+
+ mib[0] = 0;
+ mib[1] = 1;
+ memcpy(mib + 2, oid, nlen * sizeof(int));
+
+ if (sysctl(mib, nlen + 2, name, &len, 0, 0) == -1)
+ return (-1);
+
+ return (0);
+}
+
+static int
+sysctlgetnext(int *oid, int nlen, int *next, size_t *nextlen)
+{
+ int mib[12];
+
+ if (nlen > (int)(sizeof(mib) / sizeof(int) - 2))
+ return (-1);
+
+ mib[0] = 0;
+ mib[1] = 2;
+ memcpy(mib + 2, oid, nlen * sizeof(int));
+
+ if (sysctl(mib, nlen + 2, next, nextlen, 0, 0) == -1)
+ return (-1);
+
+ return (0);
+}
+
+static int
+update_sensor_sysctl(void *obuf, size_t *obuflen, int idx, const char *name)
+{
+ char buf[LM75BUF];
+ int mib[5];
+ size_t len;
+
+ /* Fill out the mib information. */
+ snprintf(buf, sizeof(buf) - 1, "dev.lm75.%d.%s", idx, name);
+ len = sizeof(mib) / sizeof(int);
+ if (sysctlnametomib(buf, mib, &len) == -1)
+ return (-1);
+
+ if (len != 4)
+ return (-1);
+
+ /* Read the sysctl data. */
+ if (sysctl(mib, len, obuf, obuflen, NULL, 0) == -1)
+ return (-1);
+
+ return (0);
+}
+
+static void
+update_sensor(struct lm75_snmp_sensor *sensor, int idx)
+{
+ size_t len;
+
+ len = sizeof(sensor->desc);
+ update_sensor_sysctl(sensor->desc, &len, idx, "%desc");
+
+ len = sizeof(sensor->location);
+ update_sensor_sysctl(sensor->location, &len, idx, "%location");
+
+ len = sizeof(sensor->pnpinfo);
+ update_sensor_sysctl(sensor->pnpinfo, &len, idx, "%pnpinfo");
+
+ len = sizeof(sensor->parent);
+ update_sensor_sysctl(sensor->parent, &len, idx, "%parent");
+}
+
+static int
+add_sensor(char *buf)
+{
+ int idx, temp;
+ size_t len;
+ struct lm75_snmp_sensor *sensor;
+
+ if (sscanf(buf, "dev.lm75.%d.temperature", &idx) != 1)
+ return (-1);
+
+ /* Read the sensor temperature. */
+ len = sizeof(temp);
+ if (update_sensor_sysctl(&temp, &len, idx, "temperature") != 0)
+ return (-1);
+
+ /* Add the sensor data to the table. */
+ sensor = calloc(1, sizeof(*sensor));
+ if (sensor == NULL) {
+ syslog(LOG_ERR, "Unable to allocate %zu bytes for resource",
+ sizeof(*sensor));
+ return (-1);
+ }
+ sensor->index = ++lm75_sensors;
+ sensor->sysctlidx = idx;
+ sensor->temp = (temp - TZ_ZEROC) / 10;
+ TAILQ_INSERT_TAIL(&sensors, sensor, link);
+
+ update_sensor(sensor, idx);
+
+ return (0);
+}
+
+static int
+update_sensors(void)
+{
+ char buf[LM75BUF];
+ int i, root[5], *next, *oid;
+ size_t len, nextlen, rootlen;
+ static uint64_t now;
+
+ now = get_ticks();
+ if (now - last_sensors_update < UPDATE_INTERVAL)
+ return (0);
+
+ last_sensors_update = now;
+
+ /* Reset the sensor data. */
+ free_sensors();
+ lm75_sensors = 0;
+
+ /* Start from the lm75 default root node. */
+ rootlen = 2;
+ if (sysctlnametomib("dev.lm75", root, &rootlen) == -1)
+ return (0);
+
+ oid = (int *)malloc(sizeof(int) * rootlen);
+ if (oid == NULL) {
+ perror("malloc");
+ return (-1);
+ }
+ memcpy(oid, root, rootlen * sizeof(int));
+ len = rootlen;
+
+ /* Traverse the sysctl(3) interface and find the active sensors. */
+ for (;;) {
+
+ /* Find the size of the next mib. */
+ nextlen = 0;
+ if (sysctlgetnext(oid, len, NULL, &nextlen) == -1) {
+ free(oid);
+ return (0);
+ }
+ /* Alocate and read the next mib. */
+ next = (int *)malloc(nextlen);
+ if (next == NULL) {
+ syslog(LOG_ERR,
+ "Unable to allocate %zu bytes for resource",
+ nextlen);
+ free(oid);
+ return (-1);
+ }
+ if (sysctlgetnext(oid, len, next, &nextlen) == -1) {
+ free(oid);
+ free(next);
+ return (0);
+ }
+ free(oid);
+ /* Check if we care about the next mib. */
+ for (i = 0; i < (int)rootlen; i++)
+ if (next[i] != root[i]) {
+ free(next);
+ return (0);
+ }
+ oid = (int *)malloc(nextlen);
+ if (oid == NULL) {
+ syslog(LOG_ERR,
+ "Unable to allocate %zu bytes for resource",
+ nextlen);
+ free(next);
+ return (-1);
+ }
+ memcpy(oid, next, nextlen);
+ free(next);
+ len = nextlen / sizeof(int);
+
+ /* Find the mib name. */
+ if (sysctlname(oid, len, buf, sizeof(buf)) != 0)
+ continue;
+
+ if (strstr(buf, "temperature"))
+ if (add_sensor(buf) != 0) {
+ free(oid);
+ return (-1);
+ }
+ }
+
+ return (0);
+}
+
+int
+op_lm75Sensors(struct snmp_context *context __unused, struct snmp_value *value,
+ u_int sub, u_int iidx __unused, enum snmp_op op)
+{
+ asn_subid_t which;
+
+ if (update_sensors() == -1)
+ return (SNMP_ERR_RES_UNAVAIL);
+
+ which = value->var.subs[sub - 1];
+
+ switch (op) {
+ case SNMP_OP_GET:
+ switch (which) {
+ case LEAF_lm75Sensors:
+ value->v.integer = lm75_sensors;
+ break;
+ default:
+ return (SNMP_ERR_RES_UNAVAIL);
+ }
+ break;
+ case SNMP_OP_SET:
+ return (SNMP_ERR_NOT_WRITEABLE);
+ case SNMP_OP_GETNEXT:
+ case SNMP_OP_ROLLBACK:
+ case SNMP_OP_COMMIT:
+ return (SNMP_ERR_NOERROR);
+ default:
+ return (SNMP_ERR_RES_UNAVAIL);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+op_lm75SensorTable(struct snmp_context *context __unused,
+ struct snmp_value *value, u_int sub, u_int iidx __unused, enum snmp_op op)
+{
+ struct lm75_snmp_sensor *sensor;
+ asn_subid_t which;
+ int ret;
+
+ if (update_sensors() == -1)
+ return (SNMP_ERR_RES_UNAVAIL);
+
+ which = value->var.subs[sub - 1];
+
+ switch (op) {
+ case SNMP_OP_GETNEXT:
+ sensor = NEXT_OBJECT_INT(&sensors, &value->var, sub);
+ if (sensor == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ value->var.len = sub + 1;
+ value->var.subs[sub] = sensor->index;
+ break;
+ case SNMP_OP_GET:
+ if (value->var.len - sub != 1)
+ return (SNMP_ERR_NOSUCHNAME);
+ sensor = FIND_OBJECT_INT(&sensors, &value->var, sub);
+ if (sensor == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+ case SNMP_OP_SET:
+ return (SNMP_ERR_NOT_WRITEABLE);
+ case SNMP_OP_ROLLBACK:
+ case SNMP_OP_COMMIT:
+ return (SNMP_ERR_NOERROR);
+ default:
+ return (SNMP_ERR_RES_UNAVAIL);
+ }
+
+ ret = SNMP_ERR_NOERROR;
+
+ switch (which) {
+ case LEAF_lm75SensorIndex:
+ value->v.integer = sensor->index;
+ break;
+ case LEAF_lm75SensorSysctlIndex:
+ value->v.integer = sensor->sysctlidx;
+ break;
+ case LEAF_lm75SensorDesc:
+ ret = string_get(value, sensor->desc, -1);
+ break;
+ case LEAF_lm75SensorLocation:
+ ret = string_get(value, sensor->location, -1);
+ break;
+ case LEAF_lm75SensorPnpInfo:
+ ret = string_get(value, sensor->pnpinfo, -1);
+ break;
+ case LEAF_lm75SensorParent:
+ ret = string_get(value, sensor->parent, -1);
+ break;
+ case LEAF_lm75SensorTemperature:
+ value->v.integer = sensor->temp;
+ break;
+ default:
+ ret = SNMP_ERR_RES_UNAVAIL;
+ break;
+ }
+
+ return (ret);
+}
diff --git a/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile.depend b/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile.depend
index 86837f049a13..b156e4a8f47b 100644
--- a/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile.depend
+++ b/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.sbin/bsnmpd/modules/snmp_netgraph/Makefile.depend b/usr.sbin/bsnmpd/modules/snmp_netgraph/Makefile.depend
index bb997d662a98..171b7a3c7865 100644
--- a/usr.sbin/bsnmpd/modules/snmp_netgraph/Makefile.depend
+++ b/usr.sbin/bsnmpd/modules/snmp_netgraph/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3 b/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3
index 9d9e5991008e..d40aef5e2425 100644
--- a/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3
+++ b/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3
@@ -433,4 +433,4 @@ This is the MIB that is implemented by this module.
.Xr gensnmptree 1 ,
.Xr snmpmod 3
.Sh AUTHORS
-.An Hartmut Brandt Aq harti@FreeBSD.org
+.An Hartmut Brandt Aq Mt harti@FreeBSD.org
diff --git a/usr.sbin/bsnmpd/modules/snmp_pf/Makefile.depend b/usr.sbin/bsnmpd/modules/snmp_pf/Makefile.depend
index e8e3f4ae6209..5254406ef57e 100644
--- a/usr.sbin/bsnmpd/modules/snmp_pf/Makefile.depend
+++ b/usr.sbin/bsnmpd/modules/snmp_pf/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.sbin/bsnmpd/modules/snmp_target/Makefile.depend b/usr.sbin/bsnmpd/modules/snmp_target/Makefile.depend
index a4fddaae962a..a2ad1578e50d 100644
--- a/usr.sbin/bsnmpd/modules/snmp_target/Makefile.depend
+++ b/usr.sbin/bsnmpd/modules/snmp_target/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.sbin/bsnmpd/modules/snmp_usm/Makefile.depend b/usr.sbin/bsnmpd/modules/snmp_usm/Makefile.depend
index 941d9e35d343..41f2049c1b38 100644
--- a/usr.sbin/bsnmpd/modules/snmp_usm/Makefile.depend
+++ b/usr.sbin/bsnmpd/modules/snmp_usm/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile.depend b/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile.depend
index 0bb35f278a21..de05307af19e 100644
--- a/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile.depend
+++ b/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/Makefile.depend b/usr.sbin/bsnmpd/modules/snmp_wlan/Makefile.depend
index cedaa27c0d46..e864a7ee6df8 100644
--- a/usr.sbin/bsnmpd/modules/snmp_wlan/Makefile.depend
+++ b/usr.sbin/bsnmpd/modules/snmp_wlan/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3 b/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3
index 6c6af4708e7c..205f11fd26fc 100644
--- a/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3
+++ b/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3
@@ -157,4 +157,4 @@ The private BEGEMOT-WIRELESS-MIB that is implemented by this module.
.Xr ifconfig 8 ,
.Xr snmpmod 3
.Sh AUTHORS
-.An Shteryana Shopova Aq syrinx@FreeBSD.org
+.An Shteryana Shopova Aq Mt syrinx@FreeBSD.org
diff --git a/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1 b/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1
index 41e505696a30..a2a118679f40 100644
--- a/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1
+++ b/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1
@@ -430,4 +430,4 @@ SNMPv3 is the default version to use for outgoing requests.
.Sh SEE ALSO
.Xr gensnmpdef 1
.Sh AUTHORS
-.An Shteryana Shopova Aq syrinx@FreeBSD.org
+.An Shteryana Shopova Aq Mt syrinx@FreeBSD.org
diff --git a/usr.sbin/btxld/Makefile b/usr.sbin/btxld/Makefile
index 32cf99d5edac..8df8fa1c39fe 100644
--- a/usr.sbin/btxld/Makefile
+++ b/usr.sbin/btxld/Makefile
@@ -4,4 +4,6 @@ PROG= btxld
MAN= btxld.8
SRCS= btxld.c elfh.c
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/btxld/btxld.8 b/usr.sbin/btxld/btxld.8
index 5b514f619cbd..cfa4623e49d9 100644
--- a/usr.sbin/btxld/btxld.8
+++ b/usr.sbin/btxld/btxld.8
@@ -95,4 +95,4 @@ combined .text and .data segments of the client image.
.Xr ld 1 ,
.Xr boot 8
.Sh AUTHORS
-.An Robert Nordier Aq rnordier@FreeBSD.org .
+.An Robert Nordier Aq Mt rnordier@FreeBSD.org
diff --git a/usr.sbin/cdcontrol/Makefile b/usr.sbin/cdcontrol/Makefile
index a505e3a3e4a2..fa0dc2c094cf 100644
--- a/usr.sbin/cdcontrol/Makefile
+++ b/usr.sbin/cdcontrol/Makefile
@@ -2,7 +2,7 @@
PROG= cdcontrol
-DPADD= ${LIBEDIT} ${LIBTERMCAP}
-LDADD= -ledit -ltermcap
+DPADD= ${LIBEDIT} ${LIBTERMCAPW}
+LDADD= -ledit -ltermcapw
.include <bsd.prog.mk>
diff --git a/usr.sbin/cdcontrol/Makefile.depend b/usr.sbin/cdcontrol/Makefile.depend
index a0d576d9b48e..abbcdbc6ab98 100644
--- a/usr.sbin/cdcontrol/Makefile.depend
+++ b/usr.sbin/cdcontrol/Makefile.depend
@@ -12,7 +12,7 @@ DIRDEPS = \
lib/libc \
lib/libcompiler_rt \
lib/libedit \
- lib/ncurses/ncurses \
+ lib/ncurses/ncursesw \
.include <dirdeps.mk>
diff --git a/usr.sbin/chkgrp/chkgrp.8 b/usr.sbin/chkgrp/chkgrp.8
index 6a57356086b2..c0d71562b4f9 100644
--- a/usr.sbin/chkgrp/chkgrp.8
+++ b/usr.sbin/chkgrp/chkgrp.8
@@ -86,8 +86,8 @@ utility appeared in
The
.Nm
utility and this manual page were written by
-.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
+.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
Further functionality was added by
-.An Liam J. Foy Aq liamfoy@dragonflybsd.org .
+.An Liam J. Foy Aq Mt liamfoy@dragonflybsd.org .
.Sh BUGS
Should check the range of the group ID.
diff --git a/usr.sbin/chown/Makefile b/usr.sbin/chown/Makefile
index 97972e5684ed..7bcb67724832 100644
--- a/usr.sbin/chown/Makefile
+++ b/usr.sbin/chown/Makefile
@@ -1,8 +1,14 @@
# @(#)Makefile 8.1 (Berkeley) 6/6/93
# $FreeBSD$
+.include <src.opts.mk>
+
PROG= chown
LINKS= ${BINDIR}/chown /usr/bin/chgrp
MAN= chgrp.1 chown.8
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/chown/tests/Makefile b/usr.sbin/chown/tests/Makefile
new file mode 100644
index 000000000000..fb13f3fb0abe
--- /dev/null
+++ b/usr.sbin/chown/tests/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/bin/chown
+
+TAP_TESTS_SH= chown-f_test
+
+.include <bsd.test.mk>
diff --git a/usr.sbin/chown/tests/chown-f_test.sh b/usr.sbin/chown/tests/chown-f_test.sh
new file mode 100755
index 000000000000..c66b0085fc25
--- /dev/null
+++ b/usr.sbin/chown/tests/chown-f_test.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+# $FreeBSD$
+
+base=`basename $0`
+
+echo "1..1"
+
+name="chown -f root:wheel file"
+if [ `id -u` -eq 0 ]; then
+ echo "ok 1 - $name # skip Test must not be uid 0."
+else
+ touch file
+ output=$(chown -f root:wheel file 2>&1)
+ if [ $? -eq 0 -a -z "$output" ]
+ then
+ echo "ok 1 - $name"
+ else
+ echo "not ok 1 - $name"
+ fi
+ rm file
+fi
diff --git a/usr.sbin/config/config.5 b/usr.sbin/config/config.5
index 7513db1fa0ff..dfc9fc8f2c35 100644
--- a/usr.sbin/config/config.5
+++ b/usr.sbin/config/config.5
@@ -182,8 +182,6 @@ The ARM architecture.
The AMD x86-64 architecture.
.It Cm i386
The Intel x86 based PC architecture.
-.It Cm ia64
-The Intel IA64 architecture.
.It Cm mips
The MIPS architecture.
.It Cm pc98
diff --git a/usr.sbin/cpucontrol/cpucontrol.8 b/usr.sbin/cpucontrol/cpucontrol.8
index 0998b2056593..91946d3fd7e7 100644
--- a/usr.sbin/cpucontrol/cpucontrol.8
+++ b/usr.sbin/cpucontrol/cpucontrol.8
@@ -65,6 +65,12 @@ device
.Ek
.Nm
.Op Fl vh
+.Fl i Ar level,level_type
+.Bk
+.Ar device
+.Ek
+.Nm
+.Op Fl vh
.Op Fl d Ar datadir
.Fl u
.Bk
@@ -114,6 +120,9 @@ In this case the inverted value of mask will be used.
.It Fl i Ar level
Retrieve CPUID info.
Level should be given as a hex number.
+.It Fl i Ar level,level_type
+Retrieve CPUID info.
+Level and level_type should be given as hex numbers.
.It Fl u
Apply CPU firmware updates.
The
@@ -168,6 +177,6 @@ utility first appeared in
The
.Nm
utility and this manual page was written by
-.An Stanislav Sedov Aq stas@FreeBSD.org .
+.An Stanislav Sedov Aq Mt stas@FreeBSD.org .
.Sh BUGS
Yes, probably, report if any.
diff --git a/usr.sbin/cpucontrol/cpucontrol.c b/usr.sbin/cpucontrol/cpucontrol.c
index c0d5a3132d8d..69fdf3aa76f2 100644
--- a/usr.sbin/cpucontrol/cpucontrol.c
+++ b/usr.sbin/cpucontrol/cpucontrol.c
@@ -99,6 +99,7 @@ static struct ucode_handler {
static void usage(void);
static int isdir(const char *path);
static int do_cpuid(const char *cmdarg, const char *dev);
+static int do_cpuid_count(const char *cmdarg, const char *dev);
static int do_msr(const char *cmdarg, const char *dev);
static int do_update(const char *dev);
static void datadir_add(const char *path);
@@ -112,7 +113,7 @@ usage(void)
if (name == NULL)
name = "cpuctl";
fprintf(stderr, "Usage: %s [-vh] [-d datadir] [-m msr[=value] | "
- "-i level | -u] device\n", name);
+ "-i level | -i level,level_type | -u] device\n", name);
exit(EX_USAGE);
}
@@ -170,6 +171,57 @@ do_cpuid(const char *cmdarg, const char *dev)
}
static int
+do_cpuid_count(const char *cmdarg, const char *dev)
+{
+ char *cmdarg1, *endptr, *endptr1;
+ unsigned int level, level_type;
+ cpuctl_cpuid_count_args_t args;
+ int fd, error;
+
+ assert(cmdarg != NULL);
+ assert(dev != NULL);
+
+ level = strtoul(cmdarg, &endptr, 16);
+ if (*cmdarg == '\0' || *endptr == '\0') {
+ WARNX(0, "incorrect or missing operand: %s", cmdarg);
+ usage();
+ /* NOTREACHED */
+ }
+ /* Locate the comma... */
+ cmdarg1 = strstr(endptr, ",");
+ /* ... and skip past it */
+ cmdarg1 += 1;
+ level_type = strtoul(cmdarg1, &endptr1, 16);
+ if (*cmdarg1 == '\0' || *endptr1 != '\0') {
+ WARNX(0, "incorrect or missing operand: %s", cmdarg);
+ usage();
+ /* NOTREACHED */
+ }
+
+ /*
+ * Fill ioctl argument structure.
+ */
+ args.level = level;
+ args.level_type = level_type;
+ fd = open(dev, O_RDONLY);
+ if (fd < 0) {
+ WARN(0, "error opening %s for reading", dev);
+ return (1);
+ }
+ error = ioctl(fd, CPUCTL_CPUID_COUNT, &args);
+ if (error < 0) {
+ WARN(0, "ioctl(%s, CPUCTL_CPUID_COUNT)", dev);
+ close(fd);
+ return (error);
+ }
+ fprintf(stdout, "cpuid level 0x%x, level_type 0x%x: 0x%.8x 0x%.8x "
+ "0x%.8x 0x%.8x\n", level, level_type, args.data[0], args.data[1],
+ args.data[2], args.data[3]);
+ close(fd);
+ return (0);
+}
+
+static int
do_msr(const char *cmdarg, const char *dev)
{
unsigned int msr;
@@ -414,7 +466,10 @@ main(int argc, char *argv[])
c = flags & (FLAG_I | FLAG_M | FLAG_U);
switch (c) {
case FLAG_I:
- error = do_cpuid(cmdarg, dev);
+ if (strstr(cmdarg, ",") != NULL)
+ error = do_cpuid_count(cmdarg, dev);
+ else
+ error = do_cpuid(cmdarg, dev);
break;
case FLAG_M:
error = do_msr(cmdarg, dev);
diff --git a/usr.sbin/cron/cron/Makefile b/usr.sbin/cron/cron/Makefile
index d9a1d247d41e..c7762f180b64 100644
--- a/usr.sbin/cron/cron/Makefile
+++ b/usr.sbin/cron/cron/Makefile
@@ -11,4 +11,6 @@ LDADD= ${LIBCRON} ${MINUSLPAM} -lutil
WARNS?= 2
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/cron/cron/cron.8 b/usr.sbin/cron/cron/cron.8
index 5d5a8d9a9ab9..697629f618cd 100644
--- a/usr.sbin/cron/cron/cron.8
+++ b/usr.sbin/cron/cron/cron.8
@@ -218,4 +218,4 @@ Directory for personal crontab files
.Xr crontab 5 ,
.Xr pam.conf 5
.Sh AUTHORS
-.An Paul Vixie Aq paul@vix.com
+.An Paul Vixie Aq Mt paul@vix.com
diff --git a/usr.sbin/cron/crontab/Makefile b/usr.sbin/cron/crontab/Makefile
index 829128e5729e..cd9600ae8184 100644
--- a/usr.sbin/cron/crontab/Makefile
+++ b/usr.sbin/cron/crontab/Makefile
@@ -15,4 +15,6 @@ CFLAGS+= -I${.CURDIR}/../cron
DPADD= ${LIBCRON} ${LIBMD} ${LIBUTIL}
LDADD= ${LIBCRON} -lmd -lutil
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/cron/crontab/crontab.1 b/usr.sbin/cron/crontab/crontab.1
index eed515ee159d..0183c39bdfa3 100644
--- a/usr.sbin/cron/crontab/crontab.1
+++ b/usr.sbin/cron/crontab/crontab.1
@@ -142,4 +142,4 @@ The new command syntax
differs from previous versions of Vixie Cron, as well as from the classic
SVR3 syntax.
.Sh AUTHORS
-.An Paul Vixie Aq paul@vix.com
+.An Paul Vixie Aq Mt paul@vix.com
diff --git a/usr.sbin/cron/crontab/crontab.5 b/usr.sbin/cron/crontab/crontab.5
index 9be37df264e5..5222d2d99334 100644
--- a/usr.sbin/cron/crontab/crontab.5
+++ b/usr.sbin/cron/crontab/crontab.5
@@ -295,7 +295,7 @@ All of the
commands that can appear in place of the first five fields
are extensions.
.Sh AUTHORS
-.An Paul Vixie Aq paul@vix.com
+.An Paul Vixie Aq Mt paul@vix.com
.Sh BUGS
If you are in one of the 70-odd countries that observe Daylight
Savings Time, jobs scheduled during the rollback or advance may be
diff --git a/usr.sbin/crunch/crunchgen/Makefile b/usr.sbin/crunch/crunchgen/Makefile
index 8d0a78b19027..7b07f2bd2a2a 100644
--- a/usr.sbin/crunch/crunchgen/Makefile
+++ b/usr.sbin/crunch/crunchgen/Makefile
@@ -4,6 +4,8 @@ PROG= crunchgen
SRCS= crunchgen.c crunched_skel.c
CLEANFILES+= crunched_skel.c
+NO_PIE= yes
+
crunched_skel.c: crunched_main.c
sh -e ${.CURDIR}/mkskel.sh ${.CURDIR}/crunched_main.c >crunched_skel.c
diff --git a/usr.sbin/crunch/crunchgen/Makefile.depend b/usr.sbin/crunch/crunchgen/Makefile.depend
index 41b04bf746cc..d10ac0b566e9 100644
--- a/usr.sbin/crunch/crunchgen/Makefile.depend
+++ b/usr.sbin/crunch/crunchgen/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.sbin/crunch/crunchgen/crunchgen.1 b/usr.sbin/crunch/crunchgen/crunchgen.1
index 66fe8f3f6df2..b9aef315e4fc 100644
--- a/usr.sbin/crunch/crunchgen/crunchgen.1
+++ b/usr.sbin/crunch/crunchgen/crunchgen.1
@@ -444,7 +444,7 @@ would also need to be copied to the install floppy.
The
.Nm
utility was written by
-.An James da Silva Aq jds@cs.umd.edu .
+.An James da Silva Aq Mt jds@cs.umd.edu .
.Pp
Copyright (c) 1994 University of Maryland.
All Rights Reserved.
@@ -452,9 +452,9 @@ All Rights Reserved.
The
.Ic libs_so
keyword was added in 2005 by
-.An Adrian Steinmann Aq ast@marabu.ch
+.An Adrian Steinmann Aq Mt ast@marabu.ch
and
-.An Ceri Davies Aq ceri@FreeBSD.org .
+.An Ceri Davies Aq Mt ceri@FreeBSD.org .
.Sh CAVEATS
While
.Nm
diff --git a/usr.sbin/crunch/crunchide/Makefile b/usr.sbin/crunch/crunchide/Makefile
index 2a6c50068d7f..e328aa412c2c 100644
--- a/usr.sbin/crunch/crunchide/Makefile
+++ b/usr.sbin/crunch/crunchide/Makefile
@@ -3,6 +3,8 @@
PROG= crunchide
SRCS= crunchide.c
+NO_PIE= yes
+
TARGET_ARCH?= ${MACHINE_ARCH}
.if ${TARGET_ARCH} == i386 && ${MACHINE_ARCH} == i386
@@ -10,9 +12,8 @@ CFLAGS+=-DNLIST_AOUT
SRCS+= exec_aout.c
.endif
-.if ${TARGET_ARCH} == ia64 || ${TARGET_ARCH} == powerpc64 || \
- ${TARGET_ARCH} == sparc64 || ${TARGET_ARCH} == amd64 || \
- ${TARGET_ARCH:Mmips64*}
+.if ${TARGET_ARCH} == amd64 || ${TARGET_ARCH} == powerpc64 || \
+ ${TARGET_ARCH} == sparc64 || ${TARGET_ARCH:Mmips64*}
CFLAGS+=-DNLIST_ELF64
SRCS+= exec_elf64.c
exec_elf64.o: exec_elf32.c
diff --git a/usr.sbin/crunch/crunchide/crunchide.1 b/usr.sbin/crunch/crunchide/crunchide.1
index ef9947dae56c..4bdda5f451d7 100644
--- a/usr.sbin/crunch/crunchide/crunchide.1
+++ b/usr.sbin/crunch/crunchide/crunchide.1
@@ -76,12 +76,12 @@ multiple component programs.
The
.Nm crunch
utility was written by
-.An James da Silva Aq jds@cs.umd.edu .
+.An James da Silva Aq Mt jds@cs.umd.edu .
.Pp
Copyright (c) 1994 University of Maryland.
All Rights Reserved.
.Pp
-.An Chris Demetriou Aq cgd@netbsd.org
+.An Chris Demetriou Aq Mt cgd@netbsd.org
reorganized
.Nm
so that it supported multiple object formats, and added
diff --git a/usr.sbin/crunch/crunchide/exec_elf32.c b/usr.sbin/crunch/crunchide/exec_elf32.c
index 752007f45f26..e9bc22798bde 100644
--- a/usr.sbin/crunch/crunchide/exec_elf32.c
+++ b/usr.sbin/crunch/crunchide/exec_elf32.c
@@ -186,10 +186,6 @@ ELFNAMEEND(check)(int fd, const char *fn)
#endif
case EM_MIPS: break;
case /* EM_MIPS_RS3_LE */ EM_MIPS_RS4_BE: break;
-#ifndef EM_IA_64
-#define EM_IA_64 50
-#endif
- case EM_IA_64: break;
#ifndef EM_PPC
#define EM_PPC 20
#endif
diff --git a/usr.sbin/ctladm/ctladm.8 b/usr.sbin/ctladm/ctladm.8
index 005225c41a9c..f58a760f39d3 100644
--- a/usr.sbin/ctladm/ctladm.8
+++ b/usr.sbin/ctladm/ctladm.8
@@ -34,7 +34,7 @@
.\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $
.\" $FreeBSD$
.\"
-.Dd October 30, 2013
+.Dd July 9, 2014
.Dt CTLADM 8
.Os
.Sh NAME
@@ -499,7 +499,7 @@ Specify relative addressing for the starting LBA. CTL does not support
relative addressing, since it only works for linked commands, and CTL
does not support linked commands.
.It Fl i
-Tell the target to return status immediately after issuing the SYHCHRONIZE CACHE
+Tell the target to return status immediately after issuing the SYNCHRONIZE CACHE
command rather than waiting for the cache to finish syncing. CTL does not
support this bit.
.It Fl c Ar cdbsize
@@ -933,6 +933,43 @@ Display
.Nm
usage information.
.El
+.Sh OPTIONS
+Number of additional configuration options may be specified for LUNs.
+Some options are global, others are backend-specific.
+.Pp
+Global options:
+.Bl -tag -width 12n
+.It Va vendor
+Specifies LUN vendor string up to 8 chars.
+.It Va product
+Specifies LUN product string up to 16 chars.
+.It Va revision
+Specifies LUN revision string up to 4 chars.
+.It Va scsiname
+Specifies LUN SCSI name string.
+.It Va eui
+Specifies LUN EUI-64 identifier.
+.It Va naa
+Specifies LUN NAA identifier.
+Either EUI or NAA identifier should be set to UNIQUE value to allow
+EXTENDED COPY command access the LUN.
+Non-unique LUN identifiers may lead to data corruption.
+.It Va insecure_tpc
+Setting to "on" allows EXTENDED COPY command sent to this LUN access
+other LUNs on this host, not accessible otherwise.
+This allows to offload copying between different iSCSI targets residing
+on the same host in trusted environments.
+.It Va unmap
+Set to "on", enables UNMAP support for the LUN.
+.El
+.Pp
+Options specific for block backend:
+.Bl -tag -width 12n
+.It Va file
+Specifies file or device name to use for backing store.
+.It Va num_threads
+Specifies number of backend threads to use for this LUN.
+.El
.Sh EXAMPLES
.Dl ctladm tur 0:1
.Pp
@@ -1030,4 +1067,4 @@ The
utility was originally written during the Winter/Spring of 2003 as an
interface to CTL.
.Sh AUTHORS
-.An Ken Merry Aq ken@FreeBSD.org
+.An Ken Merry Aq Mt ken@FreeBSD.org
diff --git a/usr.sbin/ctladm/ctladm.c b/usr.sbin/ctladm/ctladm.c
index 783315524a30..c362f5cb83ef 100644
--- a/usr.sbin/ctladm/ctladm.c
+++ b/usr.sbin/ctladm/ctladm.c
@@ -95,6 +95,7 @@ typedef enum {
CTLADM_CMD_READ,
CTLADM_CMD_WRITE,
CTLADM_CMD_PORT,
+ CTLADM_CMD_PORTLIST,
CTLADM_CMD_READCAPACITY,
CTLADM_CMD_MODESENSE,
CTLADM_CMD_DUMPOOA,
@@ -190,6 +191,7 @@ static struct ctladm_opts option_table[] = {
{"modesense", CTLADM_CMD_MODESENSE, CTLADM_ARG_NEED_TL, "P:S:dlm:c:"},
{"modify", CTLADM_CMD_MODIFY, CTLADM_ARG_NONE, "b:l:s:"},
{"port", CTLADM_CMD_PORT, CTLADM_ARG_NONE, "lo:p:qt:w:W:x"},
+ {"portlist", CTLADM_CMD_PORTLIST, CTLADM_ARG_NONE, "f:vx"},
{"prin", CTLADM_CMD_PRES_IN, CTLADM_ARG_NEED_TL, "a:"},
{"prout", CTLADM_CMD_PRES_OUT, CTLADM_ARG_NEED_TL, "a:k:r:s:"},
{"read", CTLADM_CMD_READ, CTLADM_ARG_NEED_TL, rw_opts},
@@ -498,6 +500,9 @@ retry:
case CTL_PORT_ISCSI:
type = "ISCSI";
break;
+ case CTL_PORT_SAS:
+ type = "SAS";
+ break;
default:
type = "UNKNOWN";
break;
@@ -588,6 +593,7 @@ static struct ctladm_opts cctl_fe_table[] = {
{"scsi", CTL_PORT_SCSI, CTLADM_ARG_NONE, NULL},
{"internal", CTL_PORT_INTERNAL, CTLADM_ARG_NONE, NULL},
{"iscsi", CTL_PORT_ISCSI, CTLADM_ARG_NONE, NULL},
+ {"sas", CTL_PORT_SAS, CTLADM_ARG_NONE, NULL},
{"all", CTL_PORT_ALL, CTLADM_ARG_NONE, NULL},
{NULL, 0, 0, NULL}
};
@@ -4073,6 +4079,269 @@ bailout:
return (retval);
}
+/*
+ * Port information.
+ */
+struct cctl_port {
+ uint64_t port_id;
+ char *online;
+ char *frontend_type;
+ char *name;
+ int pp, vp;
+ char *wwnn, *wwpn;
+ STAILQ_HEAD(,cctl_lun_nv) attr_list;
+ STAILQ_ENTRY(cctl_port) links;
+};
+
+struct cctl_portlist_data {
+ int num_ports;
+ STAILQ_HEAD(,cctl_port) port_list;
+ struct cctl_port *cur_port;
+ int level;
+ struct sbuf *cur_sb[32];
+};
+
+static void
+cctl_start_pelement(void *user_data, const char *name, const char **attr)
+{
+ int i;
+ struct cctl_portlist_data *portlist;
+ struct cctl_port *cur_port;
+
+ portlist = (struct cctl_portlist_data *)user_data;
+ cur_port = portlist->cur_port;
+ portlist->level++;
+ if ((u_int)portlist->level >= (sizeof(portlist->cur_sb) /
+ sizeof(portlist->cur_sb[0])))
+ errx(1, "%s: too many nesting levels, %zd max", __func__,
+ sizeof(portlist->cur_sb) / sizeof(portlist->cur_sb[0]));
+
+ portlist->cur_sb[portlist->level] = sbuf_new_auto();
+ if (portlist->cur_sb[portlist->level] == NULL)
+ err(1, "%s: Unable to allocate sbuf", __func__);
+
+ if (strcmp(name, "targ_port") == 0) {
+ if (cur_port != NULL)
+ errx(1, "%s: improper port element nesting", __func__);
+
+ cur_port = calloc(1, sizeof(*cur_port));
+ if (cur_port == NULL)
+ err(1, "%s: cannot allocate %zd bytes", __func__,
+ sizeof(*cur_port));
+
+ portlist->num_ports++;
+ portlist->cur_port = cur_port;
+
+ STAILQ_INIT(&cur_port->attr_list);
+ STAILQ_INSERT_TAIL(&portlist->port_list, cur_port, links);
+
+ for (i = 0; attr[i] != NULL; i += 2) {
+ if (strcmp(attr[i], "id") == 0) {
+ cur_port->port_id = strtoull(attr[i+1], NULL, 0);
+ } else {
+ errx(1, "%s: invalid LUN attribute %s = %s",
+ __func__, attr[i], attr[i+1]);
+ }
+ }
+ }
+}
+
+static void
+cctl_end_pelement(void *user_data, const char *name)
+{
+ struct cctl_portlist_data *portlist;
+ struct cctl_port *cur_port;
+ char *str;
+
+ portlist = (struct cctl_portlist_data *)user_data;
+ cur_port = portlist->cur_port;
+
+ if ((cur_port == NULL)
+ && (strcmp(name, "ctlportlist") != 0))
+ errx(1, "%s: cur_port == NULL! (name = %s)", __func__, name);
+
+ if (portlist->cur_sb[portlist->level] == NULL)
+ errx(1, "%s: no valid sbuf at level %d (name %s)", __func__,
+ portlist->level, name);
+
+ if (sbuf_finish(portlist->cur_sb[portlist->level]) != 0)
+ err(1, "%s: sbuf_finish", __func__);
+ str = strdup(sbuf_data(portlist->cur_sb[portlist->level]));
+ if (str == NULL)
+ err(1, "%s can't allocate %zd bytes for string", __func__,
+ sbuf_len(portlist->cur_sb[portlist->level]));
+
+ if (strlen(str) == 0) {
+ free(str);
+ str = NULL;
+ }
+
+ sbuf_delete(portlist->cur_sb[portlist->level]);
+ portlist->cur_sb[portlist->level] = NULL;
+ portlist->level--;
+
+ if (strcmp(name, "frontend_type") == 0) {
+ cur_port->frontend_type = str;
+ str = NULL;
+ } else if (strcmp(name, "port_name") == 0) {
+ cur_port->name = str;
+ str = NULL;
+ } else if (strcmp(name, "online") == 0) {
+ cur_port->online = str;
+ str = NULL;
+ } else if (strcmp(name, "physical_port") == 0) {
+ cur_port->pp = strtoull(str, NULL, 0);
+ } else if (strcmp(name, "virtual_port") == 0) {
+ cur_port->vp = strtoull(str, NULL, 0);
+ } else if (strcmp(name, "wwnn") == 0) {
+ cur_port->wwnn = str;
+ str = NULL;
+ } else if (strcmp(name, "wwpn") == 0) {
+ cur_port->wwpn = str;
+ str = NULL;
+ } else if (strcmp(name, "targ_port") == 0) {
+ portlist->cur_port = NULL;
+ } else if (strcmp(name, "ctlportlist") == 0) {
+
+ } else {
+ struct cctl_lun_nv *nv;
+
+ nv = calloc(1, sizeof(*nv));
+ if (nv == NULL)
+ err(1, "%s: can't allocate %zd bytes for nv pair",
+ __func__, sizeof(*nv));
+
+ nv->name = strdup(name);
+ if (nv->name == NULL)
+ err(1, "%s: can't allocated %zd bytes for string",
+ __func__, strlen(name));
+
+ nv->value = str;
+ str = NULL;
+ STAILQ_INSERT_TAIL(&cur_port->attr_list, nv, links);
+ }
+
+ free(str);
+}
+
+static void
+cctl_char_phandler(void *user_data, const XML_Char *str, int len)
+{
+ struct cctl_portlist_data *portlist;
+
+ portlist = (struct cctl_portlist_data *)user_data;
+
+ sbuf_bcat(portlist->cur_sb[portlist->level], str, len);
+}
+
+static int
+cctl_portlist(int fd, int argc, char **argv, char *combinedopt)
+{
+ struct ctl_lun_list list;
+ struct cctl_portlist_data portlist;
+ struct cctl_port *port;
+ XML_Parser parser;
+ char *port_str;
+ int port_len;
+ int dump_xml = 0;
+ int retval, c;
+ char *frontend = NULL;
+ int verbose = 0;
+
+ retval = 0;
+ port_len = 4096;
+
+ bzero(&portlist, sizeof(portlist));
+ STAILQ_INIT(&portlist.port_list);
+
+ while ((c = getopt(argc, argv, combinedopt)) != -1) {
+ switch (c) {
+ case 'f':
+ frontend = strdup(optarg);
+ break;
+ case 'v':
+ verbose++;
+ break;
+ case 'x':
+ dump_xml = 1;
+ break;
+ default:
+ break;
+ }
+ }
+
+retry:
+ port_str = malloc(port_len);
+
+ bzero(&list, sizeof(list));
+ list.alloc_len = port_len;
+ list.status = CTL_LUN_LIST_NONE;
+ list.lun_xml = port_str;
+
+ if (ioctl(fd, CTL_PORT_LIST, &list) == -1) {
+ warn("%s: error issuing CTL_PORT_LIST ioctl", __func__);
+ retval = 1;
+ goto bailout;
+ }
+
+ if (list.status == CTL_LUN_LIST_ERROR) {
+ warnx("%s: error returned from CTL_PORT_LIST ioctl:\n%s",
+ __func__, list.error_str);
+ } else if (list.status == CTL_LUN_LIST_NEED_MORE_SPACE) {
+ port_len = port_len << 1;
+ goto retry;
+ }
+
+ if (dump_xml != 0) {
+ printf("%s", port_str);
+ goto bailout;
+ }
+
+ parser = XML_ParserCreate(NULL);
+ if (parser == NULL) {
+ warn("%s: Unable to create XML parser", __func__);
+ retval = 1;
+ goto bailout;
+ }
+
+ XML_SetUserData(parser, &portlist);
+ XML_SetElementHandler(parser, cctl_start_pelement, cctl_end_pelement);
+ XML_SetCharacterDataHandler(parser, cctl_char_phandler);
+
+ retval = XML_Parse(parser, port_str, strlen(port_str), 1);
+ XML_ParserFree(parser);
+ if (retval != 1) {
+ retval = 1;
+ goto bailout;
+ }
+
+ printf("Port Online Frontend %-12s pp vp %-18s %-18s\n",
+ "Name", "WWNN", "WWPN");
+ STAILQ_FOREACH(port, &portlist.port_list, links) {
+ struct cctl_lun_nv *nv;
+
+ if ((frontend != NULL)
+ && (strcmp(port->frontend_type, frontend) != 0))
+ continue;
+
+ printf("%-4ju %-6s %-8s %-12s %-2d %-2d %-18s %-18s\n",
+ (uintmax_t)port->port_id, port->online,
+ port->frontend_type, port->name, port->pp, port->vp,
+ port->wwnn, port->wwpn);
+
+ if (verbose == 0)
+ continue;
+
+ STAILQ_FOREACH(nv, &port->attr_list, links) {
+ printf(" %s=%s\n", nv->name, nv->value);
+ }
+ }
+bailout:
+ free(port_str);
+
+ return (retval);
+}
+
void
usage(int error)
{
@@ -4104,7 +4373,7 @@ usage(int error)
" [-S serial_num] [-t dev_type]\n"
" ctladm remove <-b backend> <-l lun_id> [-o name=value]\n"
" ctladm modify <-b backend> <-l lun_id> <-s size_bytes>\n"
-" ctladm devlist [-b][-v][-x]\n"
+" ctladm devlist [-b backend] [-v] [-x]\n"
" ctladm shutdown\n"
" ctladm startup\n"
" ctladm hardstop\n"
@@ -4120,6 +4389,7 @@ usage(int error)
" [-s len fmt [args]] [-c] [-d delete_id]\n"
" ctladm port <-l | -o <on|off> | [-w wwnn][-W wwpn]>\n"
" [-p targ_port] [-t port_type] [-q] [-x]\n"
+" ctladm portlist [-f frontend] [-v] [-x]\n"
" ctladm islist [-v | -x]\n"
" ctladm islogout <-a | -c connection-id | -i name | -p portal>\n"
" ctladm isterminate <-a | -c connection-id | -i name | -p portal>\n"
@@ -4429,6 +4699,9 @@ main(int argc, char **argv)
case CTLADM_CMD_PORT:
retval = cctl_port(fd, argc, argv, combinedopt);
break;
+ case CTLADM_CMD_PORTLIST:
+ retval = cctl_portlist(fd, argc, argv, combinedopt);
+ break;
case CTLADM_CMD_READCAPACITY:
retval = cctl_read_capacity(fd, target, lun, initid, retries,
argc, argv, combinedopt);
diff --git a/usr.sbin/ctld/ctl.conf.5 b/usr.sbin/ctld/ctl.conf.5
index 35706670c0aa..0c73f64d6bf4 100644
--- a/usr.sbin/ctld/ctl.conf.5
+++ b/usr.sbin/ctld/ctl.conf.5
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 24, 2014
+.Dd July 28, 2014
.Dt CTL.CONF 5
.Os
.Sh NAME
@@ -104,14 +104,14 @@ The following statements are available at the auth-group level:
.It Ic auth-type Ao Ar type Ac
Specifies authentication type.
Type can be either "none", "deny", "chap", or "chap-mutual".
-In most cases it is not neccessary to set the type using this clause;
+In most cases it is not necessary to set the type using this clause;
it is usually used to disable authentication for a given auth-group.
.It Ic chap Ao Ar user Ac Aq Ar secret
Specifies CHAP authentication credentials.
.It Ic chap-mutual Ao Ar user Ac Ao Ar secret Ac Ao Ar mutualuser Ac Aq Ar mutualsecret
Specifies mutual CHAP authentication credentials.
Note that for any auth-group, configuration may contain either chap,
-or chap-mutual entries; it's an error to mix them.
+or chap-mutual entries; it is an error to mix them.
.It Ic initiator-name Ao Ar initiator-name Ac
Specifies iSCSI initiator name.
If not defined, there will be no restrictions based on initiator
@@ -119,7 +119,7 @@ name.
Otherwise, only initiators with names matching one of defined
ones will be allowed to connect.
.It Ic initiator-portal Ao Ar address Ac
-Specifies iSCSI initiator portal - IPv4 or IPv6 address.
+Specifies iSCSI initiator portal - IPv4 or IPv6 address or network.
If not defined, there will be no restrictions based on initiator
address.
Otherwise, only initiators with addresses matching one of defined
@@ -158,18 +158,18 @@ without authentication.
.It Ic auth-type Ao Ar type Ac
Specifies authentication type.
Type can be either "none", "deny", "chap", or "chap-mutual".
-In most cases it is not neccessary to set the type using this clause;
+In most cases it is not necessary to set the type using this clause;
it is usually used to disable authentication for a given target.
This clause is mutually exclusive with auth-group; one cannot use
both in a single target.
.It Ic chap Ao Ar user Ac Aq Ar secret
Specifies CHAP authentication credentials.
Note that targets must use either auth-group, or chap,
-or chap-mutual clauses; it's a configuration error to mix them in one target.
+or chap-mutual clauses; it is a configuration error to mix them in one target.
.It Ic chap-mutual Ao Ar user Ac Ao Ar secret Ac Ao Ar mutualuser Ac Aq Ar mutualsecret
Specifies mutual CHAP authentication credentials.
Note that targets must use either auth-group, chap, or
-chap-mutual clauses; it's a configuration error to mix them in one target.
+chap-mutual clauses; it is a configuration error to mix them in one target.
.It Ic initiator-name Ao Ar initiator-name Ac
Specifies iSCSI initiator name.
If not defined, there will be no restrictions based on initiator
@@ -283,5 +283,5 @@ The
configuration file functionality for
.Xr ctld 8
was developed by
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
under sponsorship from the FreeBSD Foundation.
diff --git a/usr.sbin/ctld/ctld.8 b/usr.sbin/ctld/ctld.8
index 60ffbfcf478a..9cff3a82b422 100644
--- a/usr.sbin/ctld/ctld.8
+++ b/usr.sbin/ctld/ctld.8
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 20, 2012
+.Dd July 20, 2014
.Dt CTLD 8
.Os
.Sh NAME
@@ -51,7 +51,7 @@ Then it compares the configuration with the kernel list of LUNs managed
by previously running
.Nm
instances, removes LUNs no longer existing in the configuration file,
-and creates new LUNs as neccessary.
+and creates new LUNs as necessary.
After that it listens for the incoming iSCSI connections, performs
authentication, and, if successful, passes the connections to the kernel part
of CTL iSCSI target, which handles it from that point.
@@ -59,13 +59,13 @@ of CTL iSCSI target, which handles it from that point.
When it receives a SIGHUP signal, the
.Nm
reloads its configuration and applies the changes to the kernel.
-Changes are applied in a way that avoids unneccessary disruptions;
+Changes are applied in a way that avoids unnecessary disruptions;
for example removing one LUN does not affect other LUNs.
.Pp
When exiting gracefully, the
.Nm
daemon removes LUNs it managed and forcibly disconnects all the clients.
-Otherwise - e.g. when killed with SIGKILL - LUNs stay configured
+Otherwise - for example, when killed with SIGKILL - LUNs stay configured
and clients remain connected.
.Pp
To perform administrative actions that apply to already connected
@@ -109,5 +109,5 @@ utility exits 0 on success, and >0 if an error occurs.
The
.Nm
was developed by
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
under sponsorship from the FreeBSD Foundation.
diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c
index 2cda31690ac4..c14be2124004 100644
--- a/usr.sbin/ctld/ctld.c
+++ b/usr.sbin/ctld/ctld.c
@@ -34,6 +34,7 @@
#include <sys/socket.h>
#include <sys/wait.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@@ -319,14 +320,56 @@ const struct auth_portal *
auth_portal_new(struct auth_group *ag, const char *portal)
{
struct auth_portal *ap;
+ char *net, *mask, *str, *tmp;
+ int len, dm, m;
ap = calloc(1, sizeof(*ap));
if (ap == NULL)
log_err(1, "calloc");
ap->ap_auth_group = ag;
ap->ap_initator_portal = checked_strdup(portal);
+ mask = str = checked_strdup(portal);
+ net = strsep(&mask, "/");
+ if (net[0] == '[')
+ net++;
+ len = strlen(net);
+ if (len == 0)
+ goto error;
+ if (net[len - 1] == ']')
+ net[len - 1] = 0;
+ if (strchr(net, ':') != NULL) {
+ struct sockaddr_in6 *sin6 =
+ (struct sockaddr_in6 *)&ap->ap_sa;
+
+ sin6->sin6_len = sizeof(*sin6);
+ sin6->sin6_family = AF_INET6;
+ if (inet_pton(AF_INET6, net, &sin6->sin6_addr) <= 0)
+ goto error;
+ dm = 128;
+ } else {
+ struct sockaddr_in *sin =
+ (struct sockaddr_in *)&ap->ap_sa;
+
+ sin->sin_len = sizeof(*sin);
+ sin->sin_family = AF_INET;
+ if (inet_pton(AF_INET, net, &sin->sin_addr) <= 0)
+ goto error;
+ dm = 32;
+ }
+ if (mask != NULL) {
+ m = strtol(mask, &tmp, 0);
+ if (m < 0 || m > dm || tmp[0] != 0)
+ goto error;
+ } else
+ m = dm;
+ ap->ap_mask = m;
+ free(str);
TAILQ_INSERT_TAIL(&ag->ag_portals, ap, ap_next);
return (ap);
+
+error:
+ log_errx(1, "Incorrect initiator portal '%s'", portal);
+ return (NULL);
}
static void
@@ -347,13 +390,39 @@ auth_portal_defined(const struct auth_group *ag)
}
const struct auth_portal *
-auth_portal_find(const struct auth_group *ag, const char *portal)
+auth_portal_find(const struct auth_group *ag, const struct sockaddr_storage *ss)
{
- const struct auth_portal *auth_portal;
+ const struct auth_portal *ap;
+ const uint8_t *a, *b;
+ int i;
+ uint8_t bmask;
- TAILQ_FOREACH(auth_portal, &ag->ag_portals, ap_next) {
- if (strcmp(auth_portal->ap_initator_portal, portal) == 0)
- return (auth_portal);
+ TAILQ_FOREACH(ap, &ag->ag_portals, ap_next) {
+ if (ap->ap_sa.ss_family != ss->ss_family)
+ continue;
+ if (ss->ss_family == AF_INET) {
+ a = (const uint8_t *)
+ &((const struct sockaddr_in *)ss)->sin_addr;
+ b = (const uint8_t *)
+ &((const struct sockaddr_in *)&ap->ap_sa)->sin_addr;
+ } else {
+ a = (const uint8_t *)
+ &((const struct sockaddr_in6 *)ss)->sin6_addr;
+ b = (const uint8_t *)
+ &((const struct sockaddr_in6 *)&ap->ap_sa)->sin6_addr;
+ }
+ for (i = 0; i < ap->ap_mask / 8; i++) {
+ if (a[i] != b[i])
+ goto next;
+ }
+ if (ap->ap_mask % 8) {
+ bmask = 0xff << (8 - (ap->ap_mask % 8));
+ if ((a[i] & bmask) != (b[i] & bmask))
+ goto next;
+ }
+ return (ap);
+next:
+ ;
}
return (NULL);
@@ -950,7 +1019,8 @@ lun_option_set(struct lun_option *lo, const char *value)
}
static struct connection *
-connection_new(struct portal *portal, int fd, const char *host)
+connection_new(struct portal *portal, int fd, const char *host,
+ const struct sockaddr *client_sa)
{
struct connection *conn;
@@ -960,6 +1030,7 @@ connection_new(struct portal *portal, int fd, const char *host)
conn->conn_portal = portal;
conn->conn_socket = fd;
conn->conn_initiator_addr = checked_strdup(host);
+ memcpy(&conn->conn_initiator_sa, client_sa, client_sa->sa_len);
/*
* Default values, from RFC 3720, section 12.
@@ -1120,7 +1191,6 @@ conf_verify(struct conf *conf)
if (!found_lun) {
log_warnx("no LUNs defined for target \"%s\"",
targ->t_name);
- return (1);
}
}
TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) {
@@ -1209,19 +1279,6 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
}
}
- if (oldconf->conf_kernel_port_on != newconf->conf_kernel_port_on) {
- if (newconf->conf_kernel_port_on == true) {
- log_debugx("enabling CTL iSCSI port");
- error = kernel_port_on();
- if (error != 0)
- log_errx(1, "failed to enable CTL iSCSI port; exiting");
- } else {
- error = kernel_port_off();
- if (error != 0)
- log_warnx("failed to disable CTL iSCSI port");
- }
- }
-
/*
* XXX: If target or lun removal fails, we should somehow "move"
* the old lun or target into newconf, so that subsequent
@@ -1253,6 +1310,7 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
}
lun_delete(oldlun);
}
+ kernel_port_remove(oldtarg);
target_delete(oldtarg);
continue;
}
@@ -1387,6 +1445,8 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
cumulated_error++;
}
}
+ if (oldtarg == NULL)
+ kernel_port_add(newtarg);
}
/*
@@ -1597,7 +1657,7 @@ wait_for_children(bool block)
static void
handle_connection(struct portal *portal, int fd,
- const struct sockaddr *client_sa, socklen_t client_salen, bool dont_fork)
+ const struct sockaddr *client_sa, bool dont_fork)
{
struct connection *conn;
int error;
@@ -1632,7 +1692,7 @@ handle_connection(struct portal *portal, int fd,
}
pidfile_close(conf->conf_pidfh);
- error = getnameinfo(client_sa, client_salen,
+ error = getnameinfo(client_sa, client_sa->sa_len,
host, sizeof(host), NULL, 0, NI_NUMERICHOST);
if (error != 0)
log_errx(1, "getnameinfo: %s", gai_strerror(error));
@@ -1642,7 +1702,7 @@ handle_connection(struct portal *portal, int fd,
log_set_peer_addr(host);
setproctitle("%s", host);
- conn = connection_new(portal, fd, host);
+ conn = connection_new(portal, fd, host, client_sa);
set_timeout(conf);
kernel_capsicate();
login(conn);
@@ -1698,6 +1758,9 @@ main_loop(struct conf *conf, bool dont_fork)
client_salen = sizeof(client_sa);
kernel_accept(&connection_id, &portal_id,
(struct sockaddr *)&client_sa, &client_salen);
+ if (client_salen < client_sa.ss_len)
+ log_errx(1, "salen %u < %u",
+ client_salen, client_sa.ss_len);
log_debugx("incoming connection, id %d, portal id %d",
connection_id, portal_id);
@@ -1714,8 +1777,7 @@ main_loop(struct conf *conf, bool dont_fork)
found:
handle_connection(portal, connection_id,
- (struct sockaddr *)&client_sa, client_salen,
- dont_fork);
+ (struct sockaddr *)&client_sa, dont_fork);
} else {
#endif
assert(proxy_mode == false);
@@ -1742,9 +1804,13 @@ found:
&client_salen);
if (client_fd < 0)
log_err(1, "accept");
+ if (client_salen < client_sa.ss_len)
+ log_errx(1, "salen %u < %u",
+ client_salen,
+ client_sa.ss_len);
handle_connection(portal, client_fd,
(struct sockaddr *)&client_sa,
- client_salen, dont_fork);
+ dont_fork);
break;
}
}
diff --git a/usr.sbin/ctld/ctld.h b/usr.sbin/ctld/ctld.h
index 33996483f25b..98d612f3fe2a 100644
--- a/usr.sbin/ctld/ctld.h
+++ b/usr.sbin/ctld/ctld.h
@@ -35,8 +35,8 @@
#include <sys/queue.h>
#ifdef ICL_KERNEL_PROXY
#include <sys/types.h>
-#include <sys/socket.h>
#endif
+#include <sys/socket.h>
#include <stdbool.h>
#include <libutil.h>
@@ -67,6 +67,8 @@ struct auth_portal {
TAILQ_ENTRY(auth_portal) ap_next;
struct auth_group *ap_auth_group;
char *ap_initator_portal;
+ struct sockaddr_storage ap_sa;
+ int ap_mask;
};
#define AG_TYPE_UNKNOWN 0
@@ -178,6 +180,8 @@ struct connection {
char *conn_initiator_name;
char *conn_initiator_addr;
char *conn_initiator_alias;
+ uint8_t conn_initiator_isid[6];
+ struct sockaddr_storage conn_initiator_sa;
uint32_t conn_cmdsn;
uint32_t conn_statsn;
size_t conn_max_data_segment_length;
@@ -234,7 +238,7 @@ const struct auth_portal *auth_portal_new(struct auth_group *ag,
const char *initiator_portal);
bool auth_portal_defined(const struct auth_group *ag);
const struct auth_portal *auth_portal_find(const struct auth_group *ag,
- const char *initiator_portal);
+ const struct sockaddr_storage *sa);
struct portal_group *portal_group_new(struct conf *conf, const char *name);
void portal_group_delete(struct portal_group *pg);
@@ -272,8 +276,8 @@ int kernel_lun_add(struct lun *lun);
int kernel_lun_resize(struct lun *lun);
int kernel_lun_remove(struct lun *lun);
void kernel_handoff(struct connection *conn);
-int kernel_port_on(void);
-int kernel_port_off(void);
+int kernel_port_add(struct target *targ);
+int kernel_port_remove(struct target *targ);
void kernel_capsicate(void);
#ifdef ICL_KERNEL_PROXY
diff --git a/usr.sbin/ctld/discovery.c b/usr.sbin/ctld/discovery.c
index 3612ce39c1d4..9908b961df7d 100644
--- a/usr.sbin/ctld/discovery.c
+++ b/usr.sbin/ctld/discovery.c
@@ -35,6 +35,8 @@
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
+#include <netdb.h>
+#include <sys/socket.h>
#include "ctld.h"
#include "iscsi_proto.h"
@@ -155,6 +157,48 @@ logout_new_response(struct pdu *request)
return (response);
}
+static void
+discovery_add_target(struct keys *response_keys, struct target *targ)
+{
+ struct portal *portal;
+ char *buf;
+ char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
+ struct addrinfo *ai;
+ int ret;
+
+ keys_add(response_keys, "TargetName", targ->t_name);
+ TAILQ_FOREACH(portal, &targ->t_portal_group->pg_portals, p_next) {
+ ai = portal->p_ai;
+ ret = getnameinfo(ai->ai_addr, ai->ai_addrlen,
+ hbuf, sizeof(hbuf), sbuf, sizeof(sbuf),
+ NI_NUMERICHOST | NI_NUMERICSERV);
+ if (ret != 0) {
+ log_warnx("getnameinfo: %s", gai_strerror(ret));
+ continue;
+ }
+ switch (ai->ai_addr->sa_family) {
+ case AF_INET:
+ if (strcmp(hbuf, "0.0.0.0") == 0)
+ continue;
+ ret = asprintf(&buf, "%s:%s,%d", hbuf, sbuf,
+ targ->t_portal_group->pg_tag);
+ break;
+ case AF_INET6:
+ if (strcmp(hbuf, "::") == 0)
+ continue;
+ ret = asprintf(&buf, "[%s]:%s,%d", hbuf, sbuf,
+ targ->t_portal_group->pg_tag);
+ break;
+ default:
+ continue;
+ }
+ if (ret <= 0)
+ log_err(1, "asprintf");
+ keys_add(response_keys, "TargetAddress", buf);
+ free(buf);
+ }
+}
+
void
discovery(struct connection *conn)
{
@@ -186,7 +230,7 @@ discovery(struct connection *conn)
targ->t_name);
continue;
}
- keys_add(response_keys, "TargetName", targ->t_name);
+ discovery_add_target(response_keys, targ);
}
} else {
targ = target_find(conn->conn_portal->p_portal_group->pg_conf,
@@ -194,9 +238,8 @@ discovery(struct connection *conn)
if (targ == NULL) {
log_debugx("initiator requested information on unknown "
"target \"%s\"; returning nothing", send_targets);
- } else {
- keys_add(response_keys, "TargetName", targ->t_name);
- }
+ } else
+ discovery_add_target(response_keys, targ);
}
keys_save(response_keys, response);
diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c
index 0d8383c704ff..3996e2164053 100644
--- a/usr.sbin/ctld/kernel.c
+++ b/usr.sbin/ctld/kernel.c
@@ -113,16 +113,27 @@ struct cctl_lun {
char *serial_number;
char *device_id;
char *cfiscsi_target;
- char *cfiscsi_target_alias;
int cfiscsi_lun;
STAILQ_HEAD(,cctl_lun_nv) attr_list;
STAILQ_ENTRY(cctl_lun) links;
};
+struct cctl_port {
+ uint32_t port_id;
+ int cfiscsi_status;
+ char *cfiscsi_target;
+ uint16_t cfiscsi_portal_group_tag;
+ STAILQ_HEAD(,cctl_lun_nv) attr_list;
+ STAILQ_ENTRY(cctl_port) links;
+};
+
struct cctl_devlist_data {
int num_luns;
STAILQ_HEAD(,cctl_lun) lun_list;
struct cctl_lun *cur_lun;
+ int num_ports;
+ STAILQ_HEAD(,cctl_port) port_list;
+ struct cctl_port *cur_port;
int level;
struct sbuf *cur_sb[32];
};
@@ -219,9 +230,6 @@ cctl_end_element(void *user_data, const char *name)
} else if (strcmp(name, "cfiscsi_target") == 0) {
cur_lun->cfiscsi_target = str;
str = NULL;
- } else if (strcmp(name, "cfiscsi_target_alias") == 0) {
- cur_lun->cfiscsi_target_alias = str;
- str = NULL;
} else if (strcmp(name, "cfiscsi_lun") == 0) {
cur_lun->cfiscsi_lun = strtoul(str, NULL, 0);
} else if (strcmp(name, "lun") == 0) {
@@ -247,6 +255,111 @@ cctl_end_element(void *user_data, const char *name)
}
static void
+cctl_start_pelement(void *user_data, const char *name, const char **attr)
+{
+ int i;
+ struct cctl_devlist_data *devlist;
+ struct cctl_port *cur_port;
+
+ devlist = (struct cctl_devlist_data *)user_data;
+ cur_port = devlist->cur_port;
+ devlist->level++;
+ if ((u_int)devlist->level >= (sizeof(devlist->cur_sb) /
+ sizeof(devlist->cur_sb[0])))
+ log_errx(1, "%s: too many nesting levels, %zd max", __func__,
+ sizeof(devlist->cur_sb) / sizeof(devlist->cur_sb[0]));
+
+ devlist->cur_sb[devlist->level] = sbuf_new_auto();
+ if (devlist->cur_sb[devlist->level] == NULL)
+ log_err(1, "%s: unable to allocate sbuf", __func__);
+
+ if (strcmp(name, "targ_port") == 0) {
+ if (cur_port != NULL)
+ log_errx(1, "%s: improper port element nesting (%s)",
+ __func__, name);
+
+ cur_port = calloc(1, sizeof(*cur_port));
+ if (cur_port == NULL)
+ log_err(1, "%s: cannot allocate %zd bytes", __func__,
+ sizeof(*cur_port));
+
+ devlist->num_ports++;
+ devlist->cur_port = cur_port;
+
+ STAILQ_INIT(&cur_port->attr_list);
+ STAILQ_INSERT_TAIL(&devlist->port_list, cur_port, links);
+
+ for (i = 0; attr[i] != NULL; i += 2) {
+ if (strcmp(attr[i], "id") == 0) {
+ cur_port->port_id = strtoul(attr[i+1], NULL, 0);
+ } else {
+ log_errx(1, "%s: invalid LUN attribute %s = %s",
+ __func__, attr[i], attr[i+1]);
+ }
+ }
+ }
+}
+
+static void
+cctl_end_pelement(void *user_data, const char *name)
+{
+ struct cctl_devlist_data *devlist;
+ struct cctl_port *cur_port;
+ char *str;
+
+ devlist = (struct cctl_devlist_data *)user_data;
+ cur_port = devlist->cur_port;
+
+ if ((cur_port == NULL)
+ && (strcmp(name, "ctlportlist") != 0))
+ log_errx(1, "%s: cur_port == NULL! (name = %s)", __func__, name);
+
+ if (devlist->cur_sb[devlist->level] == NULL)
+ log_errx(1, "%s: no valid sbuf at level %d (name %s)", __func__,
+ devlist->level, name);
+
+ sbuf_finish(devlist->cur_sb[devlist->level]);
+ str = checked_strdup(sbuf_data(devlist->cur_sb[devlist->level]));
+
+ if (strlen(str) == 0) {
+ free(str);
+ str = NULL;
+ }
+
+ sbuf_delete(devlist->cur_sb[devlist->level]);
+ devlist->cur_sb[devlist->level] = NULL;
+ devlist->level--;
+
+ if (strcmp(name, "cfiscsi_target") == 0) {
+ cur_port->cfiscsi_target = str;
+ str = NULL;
+ } else if (strcmp(name, "cfiscsi_status") == 0) {
+ cur_port->cfiscsi_status = strtoul(str, NULL, 0);
+ } else if (strcmp(name, "cfiscsi_portal_group_tag") == 0) {
+ cur_port->cfiscsi_portal_group_tag = strtoul(str, NULL, 0);
+ } else if (strcmp(name, "targ_port") == 0) {
+ devlist->cur_port = NULL;
+ } else if (strcmp(name, "ctlportlist") == 0) {
+
+ } else {
+ struct cctl_lun_nv *nv;
+
+ nv = calloc(1, sizeof(*nv));
+ if (nv == NULL)
+ log_err(1, "%s: can't allocate %zd bytes for nv pair",
+ __func__, sizeof(*nv));
+
+ nv->name = checked_strdup(name);
+
+ nv->value = str;
+ str = NULL;
+ STAILQ_INSERT_TAIL(&cur_port->attr_list, nv, links);
+ }
+
+ free(str);
+}
+
+static void
cctl_char_handler(void *user_data, const XML_Char *str, int len)
{
struct cctl_devlist_data *devlist;
@@ -266,50 +379,51 @@ conf_new_from_kernel(void)
struct ctl_lun_list list;
struct cctl_devlist_data devlist;
struct cctl_lun *lun;
+ struct cctl_port *port;
XML_Parser parser;
- char *lun_str = NULL;
- int lun_len;
- int retval;
-
- lun_len = 4096;
+ char *str;
+ int len, retval;
bzero(&devlist, sizeof(devlist));
STAILQ_INIT(&devlist.lun_list);
+ STAILQ_INIT(&devlist.port_list);
log_debugx("obtaining previously configured CTL luns from the kernel");
+ str = NULL;
+ len = 4096;
retry:
- lun_str = realloc(lun_str, lun_len);
- if (lun_str == NULL)
+ str = realloc(str, len);
+ if (str == NULL)
log_err(1, "realloc");
bzero(&list, sizeof(list));
- list.alloc_len = lun_len;
+ list.alloc_len = len;
list.status = CTL_LUN_LIST_NONE;
- list.lun_xml = lun_str;
+ list.lun_xml = str;
if (ioctl(ctl_fd, CTL_LUN_LIST, &list) == -1) {
log_warn("error issuing CTL_LUN_LIST ioctl");
- free(lun_str);
+ free(str);
return (NULL);
}
if (list.status == CTL_LUN_LIST_ERROR) {
log_warnx("error returned from CTL_LUN_LIST ioctl: %s",
list.error_str);
- free(lun_str);
+ free(str);
return (NULL);
}
if (list.status == CTL_LUN_LIST_NEED_MORE_SPACE) {
- lun_len = lun_len << 1;
+ len = len << 1;
goto retry;
}
parser = XML_ParserCreate(NULL);
if (parser == NULL) {
log_warnx("unable to create XML parser");
- free(lun_str);
+ free(str);
return (NULL);
}
@@ -317,9 +431,58 @@ retry:
XML_SetElementHandler(parser, cctl_start_element, cctl_end_element);
XML_SetCharacterDataHandler(parser, cctl_char_handler);
- retval = XML_Parse(parser, lun_str, strlen(lun_str), 1);
+ retval = XML_Parse(parser, str, strlen(str), 1);
XML_ParserFree(parser);
- free(lun_str);
+ free(str);
+ if (retval != 1) {
+ log_warnx("XML_Parse failed");
+ return (NULL);
+ }
+
+ str = NULL;
+ len = 4096;
+retry_port:
+ str = realloc(str, len);
+ if (str == NULL)
+ log_err(1, "realloc");
+
+ bzero(&list, sizeof(list));
+ list.alloc_len = len;
+ list.status = CTL_LUN_LIST_NONE;
+ list.lun_xml = str;
+
+ if (ioctl(ctl_fd, CTL_PORT_LIST, &list) == -1) {
+ log_warn("error issuing CTL_PORT_LIST ioctl");
+ free(str);
+ return (NULL);
+ }
+
+ if (list.status == CTL_PORT_LIST_ERROR) {
+ log_warnx("error returned from CTL_PORT_LIST ioctl: %s",
+ list.error_str);
+ free(str);
+ return (NULL);
+ }
+
+ if (list.status == CTL_LUN_LIST_NEED_MORE_SPACE) {
+ len = len << 1;
+ goto retry_port;
+ }
+
+ parser = XML_ParserCreate(NULL);
+ if (parser == NULL) {
+ log_warnx("unable to create XML parser");
+ free(str);
+ return (NULL);
+ }
+
+ XML_SetUserData(parser, &devlist);
+ XML_SetElementHandler(parser, cctl_start_pelement, cctl_end_pelement);
+ XML_SetCharacterDataHandler(parser, cctl_char_handler);
+
+ retval = XML_Parse(parser, str, strlen(str), 1);
+ XML_ParserFree(parser);
+ free(str);
if (retval != 1) {
log_warnx("XML_Parse failed");
return (NULL);
@@ -327,6 +490,33 @@ retry:
conf = conf_new();
+ STAILQ_FOREACH(port, &devlist.port_list, links) {
+
+ if (port->cfiscsi_target == NULL) {
+ log_debugx("CTL port %ju wasn't managed by ctld; "
+ "ignoring", (uintmax_t)port->port_id);
+ continue;
+ }
+ if (port->cfiscsi_status != 1) {
+ log_debugx("CTL port %ju is not active (%d); ignoring",
+ (uintmax_t)port->port_id, port->cfiscsi_status);
+ continue;
+ }
+
+ targ = target_find(conf, port->cfiscsi_target);
+ if (targ == NULL) {
+#if 0
+ log_debugx("found new kernel target %s for CTL port %ld",
+ port->cfiscsi_target, port->port_id);
+#endif
+ targ = target_new(conf, port->cfiscsi_target);
+ if (targ == NULL) {
+ log_warnx("target_new failed");
+ continue;
+ }
+ }
+ }
+
STAILQ_FOREACH(lun, &devlist.lun_list, links) {
struct cctl_lun_nv *nv;
@@ -391,6 +581,17 @@ retry:
return (conf);
}
+static void
+str_arg(struct ctl_be_arg *arg, const char *name, const char *value)
+{
+
+ arg->namelen = strlen(name) + 1;
+ arg->name = __DECONST(char *, name);
+ arg->vallen = strlen(value) + 1;
+ arg->value = __DECONST(char *, value);
+ arg->flags = CTL_BEARG_ASCII | CTL_BEARG_RD;
+}
+
int
kernel_lun_add(struct lun *lun)
{
@@ -413,13 +614,13 @@ kernel_lun_add(struct lun *lun)
req.reqdata.create.device_type = T_DIRECT;
if (lun->l_serial != NULL) {
- strlcpy(req.reqdata.create.serial_num, lun->l_serial,
+ strncpy(req.reqdata.create.serial_num, lun->l_serial,
sizeof(req.reqdata.create.serial_num));
req.reqdata.create.flags |= CTL_LUN_FLAG_SERIAL_NUM;
}
if (lun->l_device_id != NULL) {
- strlcpy(req.reqdata.create.device_id, lun->l_device_id,
+ strncpy(req.reqdata.create.device_id, lun->l_device_id,
sizeof(req.reqdata.create.device_id));
req.reqdata.create.flags |= CTL_LUN_FLAG_DEVID;
}
@@ -443,17 +644,6 @@ kernel_lun_add(struct lun *lun)
assert(lo != NULL);
}
- if (lun->l_target->t_alias != NULL) {
- lo = lun_option_find(lun, "cfiscsi_target_alias");
- if (lo != NULL) {
- lun_option_set(lo, lun->l_target->t_alias);
- } else {
- lo = lun_option_new(lun, "cfiscsi_target_alias",
- lun->l_target->t_alias);
- assert(lo != NULL);
- }
- }
-
asprintf(&tmp, "%d", lun->l_lun);
if (tmp == NULL)
log_errx(1, "asprintf");
@@ -467,6 +657,19 @@ kernel_lun_add(struct lun *lun)
assert(lo != NULL);
}
+ asprintf(&tmp, "%s,lun,%d", lun->l_target->t_name, lun->l_lun);
+ if (tmp == NULL)
+ log_errx(1, "asprintf");
+ lo = lun_option_find(lun, "scsiname");
+ if (lo != NULL) {
+ lun_option_set(lo, tmp);
+ free(tmp);
+ } else {
+ lo = lun_option_new(lun, "scsiname", tmp);
+ free(tmp);
+ assert(lo != NULL);
+ }
+
num_options = 0;
TAILQ_FOREACH(lo, &lun->l_options, lo_next)
num_options++;
@@ -482,14 +685,7 @@ kernel_lun_add(struct lun *lun)
i = 0;
TAILQ_FOREACH(lo, &lun->l_options, lo_next) {
- /*
- * +1 for the terminating '\0'
- */
- req.be_args[i].namelen = strlen(lo->lo_name) + 1;
- req.be_args[i].name = lo->lo_name;
- req.be_args[i].vallen = strlen(lo->lo_value) + 1;
- req.be_args[i].value = lo->lo_value;
- req.be_args[i].flags = CTL_BEARG_ASCII | CTL_BEARG_RD;
+ str_arg(&req.be_args[i], lo->lo_name, lo->lo_value);
i++;
}
assert(i == num_options);
@@ -599,6 +795,8 @@ kernel_handoff(struct connection *conn)
strlcpy(req.data.handoff.initiator_alias,
conn->conn_initiator_alias, sizeof(req.data.handoff.initiator_alias));
}
+ memcpy(req.data.handoff.initiator_isid, conn->conn_initiator_isid,
+ sizeof(req.data.handoff.initiator_isid));
strlcpy(req.data.handoff.target_name,
conn->conn_target->t_name, sizeof(req.data.handoff.target_name));
#ifdef ICL_KERNEL_PROXY
@@ -634,15 +832,53 @@ kernel_handoff(struct connection *conn)
}
int
-kernel_port_on(void)
+kernel_port_add(struct target *targ)
{
struct ctl_port_entry entry;
+ struct ctl_req req;
+ char tagstr[16];
int error;
+ uint32_t port_id = -1;
- bzero(&entry, sizeof(entry));
+ bzero(&req, sizeof(req));
+ strlcpy(req.driver, "iscsi", sizeof(req.driver));
+ req.reqtype = CTL_REQ_CREATE;
+ req.num_args = 4;
+ req.args = malloc(req.num_args * sizeof(*req.args));
+ req.args[0].namelen = sizeof("port_id");
+ req.args[0].name = __DECONST(char *, "port_id");
+ req.args[0].vallen = sizeof(port_id);
+ req.args[0].value = &port_id;
+ req.args[0].flags = CTL_BEARG_WR;
+ str_arg(&req.args[1], "cfiscsi_target", targ->t_name);
+ snprintf(tagstr, sizeof(tagstr), "%d", targ->t_portal_group->pg_tag);
+ str_arg(&req.args[2], "cfiscsi_portal_group_tag", tagstr);
+ if (targ->t_alias)
+ str_arg(&req.args[3], "cfiscsi_target_alias", targ->t_alias);
+ else
+ req.num_args--;
- entry.port_type = CTL_PORT_ISCSI;
- entry.targ_port = -1;
+ error = ioctl(ctl_fd, CTL_PORT_REQ, &req);
+ free(req.args);
+ if (error != 0) {
+ log_warn("error issuing CTL_PORT_REQ ioctl");
+ return (1);
+ }
+
+ if (req.status == CTL_LUN_ERROR) {
+ log_warnx("error returned from port creation request: %s",
+ req.error_str);
+ return (1);
+ }
+
+ if (req.status != CTL_LUN_OK) {
+ log_warnx("unknown port creation request status %d",
+ req.status);
+ return (1);
+ }
+
+ bzero(&entry, sizeof(entry));
+ entry.targ_port = port_id;
error = ioctl(ctl_fd, CTL_ENABLE_PORT, &entry);
if (error != 0) {
@@ -654,20 +890,42 @@ kernel_port_on(void)
}
int
-kernel_port_off(void)
+kernel_port_remove(struct target *targ)
{
- struct ctl_port_entry entry;
+ struct ctl_req req;
+ char tagstr[16];
int error;
- bzero(&entry, sizeof(entry));
+ bzero(&req, sizeof(req));
+ strlcpy(req.driver, "iscsi", sizeof(req.driver));
+ req.reqtype = CTL_REQ_REMOVE;
+ req.num_args = 2;
+ req.args = malloc(req.num_args * sizeof(*req.args));
+ str_arg(&req.args[0], "cfiscsi_target", targ->t_name);
+ if (targ->t_portal_group) {
+ snprintf(tagstr, sizeof(tagstr), "%d",
+ targ->t_portal_group->pg_tag);
+ str_arg(&req.args[1], "cfiscsi_portal_group_tag", tagstr);
+ } else
+ req.num_args--;
+
+ error = ioctl(ctl_fd, CTL_PORT_REQ, &req);
+ free(req.args);
+ if (error != 0) {
+ log_warn("error issuing CTL_PORT_REQ ioctl");
+ return (1);
+ }
- entry.port_type = CTL_PORT_ISCSI;
- entry.targ_port = -1;
+ if (req.status == CTL_LUN_ERROR) {
+ log_warnx("error returned from port removal request: %s",
+ req.error_str);
+ return (1);
+ }
- error = ioctl(ctl_fd, CTL_DISABLE_PORT, &entry);
- if (error != 0) {
- log_warn("CTL_DISABLE_PORT ioctl failed");
- return (-1);
+ if (req.status != CTL_LUN_OK) {
+ log_warnx("unknown port removal request status %d",
+ req.status);
+ return (1);
}
return (0);
diff --git a/usr.sbin/ctld/login.c b/usr.sbin/ctld/login.c
index f830d15fc929..20ed464011fa 100644
--- a/usr.sbin/ctld/login.c
+++ b/usr.sbin/ctld/login.c
@@ -850,6 +850,9 @@ login(struct connection *conn)
log_errx(1, "received Login PDU with non-zero TSIH");
}
+ memcpy(conn->conn_initiator_isid, bhslr->bhslr_isid,
+ sizeof(conn->conn_initiator_isid));
+
/*
* XXX: Implement the C flag some day.
*/
@@ -951,7 +954,7 @@ login(struct connection *conn)
}
if (auth_portal_defined(ag)) {
- if (auth_portal_find(ag, conn->conn_initiator_addr) == NULL) {
+ if (auth_portal_find(ag, &conn->conn_initiator_sa) == NULL) {
login_send_error(request, 0x02, 0x02);
log_errx(1, "initiator does not match allowed "
"initiator portals");
diff --git a/usr.sbin/ctld/parse.y b/usr.sbin/ctld/parse.y
index e4b160e204b1..645201be94d1 100644
--- a/usr.sbin/ctld/parse.y
+++ b/usr.sbin/ctld/parse.y
@@ -659,6 +659,19 @@ lun_serial: SERIAL STR
}
lun_set_serial(lun, $2);
free($2);
+ } | SERIAL NUM
+ {
+ char *str = NULL;
+
+ if (lun->l_serial != NULL) {
+ log_warnx("serial for lun %d, target \"%s\" "
+ "specified more than once",
+ lun->l_lun, target->t_name);
+ return (1);
+ }
+ asprintf(&str, "%ju", $2);
+ lun_set_serial(lun, str);
+ free(str);
}
;
diff --git a/usr.sbin/ctld/token.l b/usr.sbin/ctld/token.l
index 2846097e3b73..a47bf9a00ae0 100644
--- a/usr.sbin/ctld/token.l
+++ b/usr.sbin/ctld/token.l
@@ -74,8 +74,9 @@ target { return TARGET; }
timeout { return TIMEOUT; }
[0-9]+[kKmMgGtTpPeE]? { if (expand_number(yytext, &yylval.num) == 0)
return NUM;
- else
- return STR;
+ else {
+ yylval.str = strdup(yytext); return STR;
+ }
}
\"[^"]+\" { yylval.str = strndup(yytext + 1,
strlen(yytext) - 2); return STR; }
diff --git a/usr.sbin/ctm/ctm/ctm.1 b/usr.sbin/ctm/ctm/ctm.1
index d5cc6144d1d6..3684b9ff5e7c 100644
--- a/usr.sbin/ctm/ctm/ctm.1
+++ b/usr.sbin/ctm/ctm/ctm.1
@@ -316,10 +316,9 @@ The
command appeared in
.Fx 2.1 .
.Sh AUTHORS
+.An -nosplit
The CTM system has been designed and implemented by
-.An Poul-Henning Kamp
-.Aq phk@FreeBSD.org .
+.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .
.Pp
-.An Joerg Wunsch
-.Aq joerg@FreeBSD.org
+.An Joerg Wunsch Aq Mt joerg@FreeBSD.org
wrote this man-page.
diff --git a/usr.sbin/ctm/ctm/ctm.5 b/usr.sbin/ctm/ctm/ctm.5
index a51c93b00698..e48b09fc85bd 100644
--- a/usr.sbin/ctm/ctm/ctm.5
+++ b/usr.sbin/ctm/ctm/ctm.5
@@ -174,10 +174,9 @@ methods were hashed out.
The CTM system has been made publicly available in
.Fx 2.1 .
.Sh AUTHORS
+.An -nosplit
The CTM system has been designed and implemented by
-.An Poul-Henning Kamp
-.Aq phk@FreeBSD.org .
+.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .
.Pp
-.An Joerg Wunsch
-.Aq joerg@FreeBSD.org
+.An Joerg Wunsch Aq Mt joerg@FreeBSD.org
wrote this man-page.
diff --git a/usr.sbin/ctm/ctm_rmail/ctm_rmail.1 b/usr.sbin/ctm/ctm_rmail/ctm_rmail.1
index 5476e491f4ef..232f646529f8 100644
--- a/usr.sbin/ctm/ctm_rmail/ctm_rmail.1
+++ b/usr.sbin/ctm/ctm_rmail/ctm_rmail.1
@@ -507,4 +507,4 @@ Error messages should be self explanatory.
.Xr ctm 5
.\" .Sh HISTORY
.Sh AUTHORS
-.An Stephen McKay Aq mckay@FreeBSD.org
+.An Stephen McKay Aq Mt mckay@FreeBSD.org
diff --git a/usr.sbin/ctm/mkCTM/ctm_conf.gnats b/usr.sbin/ctm/mkCTM/ctm_conf.gnats
deleted file mode 100644
index c2223f02cd1d..000000000000
--- a/usr.sbin/ctm/mkCTM/ctm_conf.gnats
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/local/bin/tclsh
-
-#set CTMfirst 1
-set CTMname gnats
-set CTMref /home/gnats
-set CTMdest $CTMSW/../CTM-pub/$CTMname
-set CTMignore {\\.lock$}
-set CTMmail ctm-gnats@freebsd.org
diff --git a/usr.sbin/dconschat/dconschat.8 b/usr.sbin/dconschat/dconschat.8
index 4f8dcd459803..330f44c530c5 100644
--- a/usr.sbin/dconschat/dconschat.8
+++ b/usr.sbin/dconschat/dconschat.8
@@ -323,7 +323,7 @@ console remote {
.Xr eui64 5 ,
.Xr fwcontrol 8
.Sh AUTHORS
-.An Hidetoshi Shimokawa Aq simokawa@FreeBSD.org
+.An Hidetoshi Shimokawa Aq Mt simokawa@FreeBSD.org
.Sh BUGS
This utility is
.Ud
diff --git a/usr.sbin/devinfo/devinfo.8 b/usr.sbin/devinfo/devinfo.8
index ecb3b0126370..a1743fff3851 100644
--- a/usr.sbin/devinfo/devinfo.8
+++ b/usr.sbin/devinfo/devinfo.8
@@ -73,4 +73,4 @@ Without this flag, only those devices that have attached are reported.
.Xr devclass 9 ,
.Xr device 9
.Sh AUTHORS
-.An Mike Smith Aq msmith@FreeBSD.org
+.An Mike Smith Aq Mt msmith@FreeBSD.org
diff --git a/usr.sbin/dumpcis/dumpcis.8 b/usr.sbin/dumpcis/dumpcis.8
index 518eadd69074..86949df6f28b 100644
--- a/usr.sbin/dumpcis/dumpcis.8
+++ b/usr.sbin/dumpcis/dumpcis.8
@@ -44,6 +44,5 @@ utility translates a raw CIS stream into human readable form.
.Xr cbb 4 ,
.Xr pccard 4
.Sh AUTHORS
-.An -nosplit
The original version was written by
-.An Warner Losh Aq imp@FreeBSD.org .
+.An Warner Losh Aq Mt imp@FreeBSD.org .
diff --git a/usr.sbin/editmap/Makefile b/usr.sbin/editmap/Makefile
index 92d8392bf1f8..8b4562cf1163 100644
--- a/usr.sbin/editmap/Makefile
+++ b/usr.sbin/editmap/Makefile
@@ -33,6 +33,8 @@ DPADD+=${SENDMAIL_DPADD}
LDADD+=${SENDMAIL_LDADD}
LDFLAGS+=${SENDMAIL_LDFLAGS}
+NO_PIE= yes
+
sm_os.h:
ln -sf ${SENDMAIL_DIR}/include/sm/os/sm_os_freebsd.h sm_os.h
diff --git a/usr.sbin/eeprom/eeprom.8 b/usr.sbin/eeprom/eeprom.8
index e132da98b7e6..b5b08bb9ae4e 100644
--- a/usr.sbin/eeprom/eeprom.8
+++ b/usr.sbin/eeprom/eeprom.8
@@ -684,15 +684,15 @@ The
utility uses base code from the
.Nx
version written by
-.An "Jason R. Thorpe" .
+.An Jason R. Thorpe .
The handlers for the Open Firmware
.Pa /options
node were written by
-.An "Marius Strobl" Aq marius@FreeBSD.org .
+.An Marius Strobl Aq Mt marius@FreeBSD.org .
The code for accessing the Open Firmware device tree is shared with the
.Xr ofwdump 8
utility written by
-.An "Thomas Moestl" Aq tmm@FreeBSD.org .
+.An Thomas Moestl Aq Mt tmm@FreeBSD.org .
.Sh BUGS
Currently,
.Nm
diff --git a/usr.sbin/etcupdate/etcupdate.8 b/usr.sbin/etcupdate/etcupdate.8
index ffd051607312..1e722f9b2c12 100644
--- a/usr.sbin/etcupdate/etcupdate.8
+++ b/usr.sbin/etcupdate/etcupdate.8
@@ -801,7 +801,7 @@ utility first appeared in
The
.Nm
utility was written by
-.An John Baldwin Aq jhb@FreeBSD.org .
+.An John Baldwin Aq Mt jhb@FreeBSD.org .
.Sh BUGS
Rerunning a merge does not automatically delete conflicts left over from a
previous merge.
diff --git a/usr.sbin/fdwrite/fdwrite.1 b/usr.sbin/fdwrite/fdwrite.1
index 1c231a19bcdd..9f1270f72f03 100644
--- a/usr.sbin/fdwrite/fdwrite.1
+++ b/usr.sbin/fdwrite/fdwrite.1
@@ -104,7 +104,7 @@ Some of the code was taken from
.Xr fdformat 1 .
.Sh AUTHORS
The program has been contributed by
-.An Poul-Henning Kamp Aq phk@FreeBSD.org .
+.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .
.Sh BUGS
Diagnostics are less than complete at present.
.Pp
diff --git a/usr.sbin/fifolog/fifolog_create/Makefile b/usr.sbin/fifolog/fifolog_create/Makefile
index 8b59b25ed251..38a66233d35b 100644
--- a/usr.sbin/fifolog/fifolog_create/Makefile
+++ b/usr.sbin/fifolog/fifolog_create/Makefile
@@ -12,6 +12,8 @@ MLINKS= fifolog.1 fifolog_create.1 \
fifolog.1 fifolog_reader.1 \
fifolog.1 fifolog_writer.1
+NO_PIE= yes
+
regress:
rm -f /tmp/fifolog.?
./${PROG} /tmp/fifolog.0
diff --git a/usr.sbin/fifolog/fifolog_reader/Makefile b/usr.sbin/fifolog/fifolog_reader/Makefile
index c88f10e95295..dfbb73f0ce3c 100644
--- a/usr.sbin/fifolog/fifolog_reader/Makefile
+++ b/usr.sbin/fifolog/fifolog_reader/Makefile
@@ -9,6 +9,8 @@ MAN=
DPADD= ${LIBFIFOLOG} ${LIBUTIL} ${LIBZ}
LDADD= ${LIBFIFOLOG} -lutil -lz
+NO_PIE= yes
+
regress:
./${PROG} /tmp/fifolog.0
./${PROG} -t /tmp/fifolog.0
diff --git a/usr.sbin/fifolog/fifolog_writer/Makefile b/usr.sbin/fifolog/fifolog_writer/Makefile
index 9d802c7eb3ee..3e6e37790aac 100644
--- a/usr.sbin/fifolog/fifolog_writer/Makefile
+++ b/usr.sbin/fifolog/fifolog_writer/Makefile
@@ -9,6 +9,8 @@ MAN=
DPADD= ${LIBFIFOLOG} ${LIBUTIL} ${LIBZ}
LDADD= ${LIBFIFOLOG} -lutil -lz
+NO_PIE= yes
+
regress:
date | ./${PROG} -z 0 /tmp/fifolog.0
lptest 65 | ./${PROG} -z 9 /tmp/fifolog.1
diff --git a/usr.sbin/flowctl/flowctl.8 b/usr.sbin/flowctl/flowctl.8
index 5780e10a62d0..a8a1ce1c0bd2 100644
--- a/usr.sbin/flowctl/flowctl.8
+++ b/usr.sbin/flowctl/flowctl.8
@@ -83,8 +83,8 @@ parameter can be specify to show selected flows in human-readable format.
The
.Nm
utility was written by
-.An Gleb Smirnoff Aq glebius@FreeBSD.org ,
+.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org ,
based on
.Nm ipacctctl
written by
-.An Roman V. Palagin Aq romanp@unshadow.net .
+.An Roman V. Palagin Aq Mt romanp@unshadow.net .
diff --git a/usr.sbin/freebsd-update/freebsd-update.8 b/usr.sbin/freebsd-update/freebsd-update.8
index f372587eee8b..b85a4e4b7682 100644
--- a/usr.sbin/freebsd-update/freebsd-update.8
+++ b/usr.sbin/freebsd-update/freebsd-update.8
@@ -174,4 +174,4 @@ stores temporary files and downloaded updates.
.Sh SEE ALSO
.Xr freebsd-update.conf 5
.Sh AUTHORS
-.An Colin Percival Aq cperciva@FreeBSD.org
+.An Colin Percival Aq Mt cperciva@FreeBSD.org
diff --git a/usr.sbin/ftp-proxy/ftp-proxy/Makefile b/usr.sbin/ftp-proxy/ftp-proxy/Makefile
index de4988815016..686bac436e1e 100644
--- a/usr.sbin/ftp-proxy/ftp-proxy/Makefile
+++ b/usr.sbin/ftp-proxy/ftp-proxy/Makefile
@@ -14,4 +14,6 @@ DPADD+= ${LIBEVENT}
WARNS?= 3
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/fwcontrol/fwcontrol.8 b/usr.sbin/fwcontrol/fwcontrol.8
index a2767ebc240e..4e9b61b77c39 100644
--- a/usr.sbin/fwcontrol/fwcontrol.8
+++ b/usr.sbin/fwcontrol/fwcontrol.8
@@ -211,9 +211,9 @@ The
utility first appeared in
.Fx 5.0 .
.Sh AUTHORS
-.An Hidetoshi Shimokawa Aq simokawa@FreeBSD.org
-.An Petr Holub Aq hopet@ics.muni.cz
-- MPEG TS mode.
+.An Hidetoshi Shimokawa Aq Mt simokawa@FreeBSD.org
+.An Petr Holub Aq Mt hopet@ics.muni.cz
+(MPEG TS mode)
.Sh BUGS
This utility is still under development and provided for debugging purposes.
Especially MPEG TS reception support is very rudimental and supports only
diff --git a/usr.sbin/gpioctl/gpioctl.8 b/usr.sbin/gpioctl/gpioctl.8
index 4db6714f5bdc..8a433726391a 100644
--- a/usr.sbin/gpioctl/gpioctl.8
+++ b/usr.sbin/gpioctl/gpioctl.8
@@ -121,5 +121,4 @@ utility appeared in
The
.Nm
utility and this manual page were written by
-.An Oleksandr Tymoshenko
-.Aq gonzo@freebsd.org
+.An Oleksandr Tymoshenko Aq Mt gonzo@freebsd.org .
diff --git a/usr.sbin/gssd/gssd.8 b/usr.sbin/gssd/gssd.8
index 82c531701669..82611f847a15 100644
--- a/usr.sbin/gssd/gssd.8
+++ b/usr.sbin/gssd/gssd.8
@@ -116,4 +116,4 @@ manual page first appeared in
.Sh AUTHORS
This
manual page was written by
-.An Doug Rabson Aq dfr@FreeBSD.org .
+.An Doug Rabson Aq Mt dfr@FreeBSD.org .
diff --git a/usr.sbin/gstat/gstat.8 b/usr.sbin/gstat/gstat.8
index 9ac678911f2b..6c0430e58f78 100644
--- a/usr.sbin/gstat/gstat.8
+++ b/usr.sbin/gstat/gstat.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 12, 2009
+.Dd July 3, 2014
.Dt GSTAT 8
.Os
.Sh NAME
@@ -32,7 +32,7 @@
.Nd print statistics about GEOM disks
.Sh SYNOPSIS
.Nm
-.Op Fl abcd
+.Op Fl abcdop
.Op Fl f Ar filter
.Op Fl I Ar interval
.Sh DESCRIPTION
@@ -69,6 +69,9 @@ Only devices with the names matching
will be displayed.
The format of the regular expression is described in
.Xr re_format 7 .
+.It Fl o
+Enable display of statistics for other operations
+.Pq Dv BIO_FLUSH .
.It Fl I Ar interval
Refresh the
.Nm
@@ -81,6 +84,8 @@ or
.Cm us
(the default) indicates that the update interval is specified in
seconds, milliseconds, or microseconds, respectively.
+.It Fl p
+Only display physical providers (those with rank of 1).
.El
.Sh EXIT STATUS
.Ex -std
diff --git a/usr.sbin/gstat/gstat.c b/usr.sbin/gstat/gstat.c
index 39054eb09755..d83ef79d4874 100644
--- a/usr.sbin/gstat/gstat.c
+++ b/usr.sbin/gstat/gstat.c
@@ -51,7 +51,7 @@
#include <sysexits.h>
#include <unistd.h>
-static int flag_a, flag_b, flag_c, flag_d;
+static int flag_a, flag_b, flag_c, flag_d, flag_o, flag_p;
static int flag_I = 1000000;
#define PRINTMSG(...) do { \
@@ -88,7 +88,7 @@ main(int argc, char **argv)
char *p;
char f_s[100], pf_s[100], tmp_f_s[100];
const char *line;
- long double ld[11];
+ long double ld[13];
uint64_t u64;
EditLine *el;
History *hist;
@@ -104,7 +104,7 @@ main(int argc, char **argv)
flag_b = 1;
f_s[0] = '\0';
- while ((i = getopt(argc, argv, "adcf:I:b")) != -1) {
+ while ((i = getopt(argc, argv, "abdcf:I:op")) != -1) {
switch (i) {
case 'a':
flag_a = 1;
@@ -126,6 +126,9 @@ main(int argc, char **argv)
"Invalid filter - see re_format(7)");
strncpy(f_s, optarg, sizeof(f_s));
break;
+ case 'o':
+ flag_o = 1;
+ break;
case 'I':
p = NULL;
i = strtoul(optarg, &p, 0);
@@ -140,6 +143,9 @@ main(int argc, char **argv)
i *= 1;
flag_I = i;
break;
+ case 'p':
+ flag_p = 1;
+ break;
case '?':
default:
usage();
@@ -229,6 +235,8 @@ main(int argc, char **argv)
PRINTMSG(" w/s kBps ms/w ");
if (flag_d)
PRINTMSG(" d/s kBps ms/d ");
+ if (flag_o)
+ PRINTMSG(" o/s ms/o ");
PRINTMSG("%%busy Name\n");
for (;;) {
gsp = geom_stats_snapshot_next(sp);
@@ -249,6 +257,9 @@ main(int argc, char **argv)
continue;
if (gid->lg_what == ISCONSUMER && !flag_c)
continue;
+ if (flag_p && gid->lg_what == ISPROVIDER &&
+ ((struct gprovider *)(gid->lg_ptr))->lg_geom->lg_rank != 1)
+ continue;
/* Do not print past end of window */
if (!flag_b) {
getyx(stdscr, cury, curx);
@@ -279,9 +290,14 @@ main(int argc, char **argv)
DSM_MS_PER_TRANSACTION_WRITE, &ld[6],
DSM_BUSY_PCT, &ld[7],
+
DSM_TRANSFERS_PER_SECOND_FREE, &ld[8],
DSM_MB_PER_SECOND_FREE, &ld[9],
DSM_MS_PER_TRANSACTION_FREE, &ld[10],
+
+ DSM_TRANSFERS_PER_SECOND_OTHER, &ld[11],
+ DSM_MS_PER_TRANSACTION_OTHER, &ld[12],
+
DSM_NONE);
if (flag_a && ld[7] < 0.1) {
@@ -313,6 +329,14 @@ main(int argc, char **argv)
PRINTMSG(" %6.1f", (double)ld[10]);
}
+ if (flag_o) {
+ PRINTMSG(" %6.0f", (double)ld[11]);
+ if (ld[12] > 1e3)
+ PRINTMSG(" %6.0f", (double)ld[12]);
+ else
+ PRINTMSG(" %6.1f", (double)ld[12]);
+ }
+
if (ld[7] > 80)
i = 3;
else if (ld[7] > 50)
@@ -425,7 +449,7 @@ main(int argc, char **argv)
static void
usage(void)
{
- fprintf(stderr, "usage: gstat [-abcd] [-f filter] [-I interval]\n");
+ fprintf(stderr, "usage: gstat [-abcdp] [-f filter] [-I interval]\n");
exit(EX_USAGE);
/* NOTREACHED */
}
diff --git a/usr.sbin/i2c/i2c.8 b/usr.sbin/i2c/i2c.8
index cd269fa6e1ae..27f7621156b6 100644
--- a/usr.sbin/i2c/i2c.8
+++ b/usr.sbin/i2c/i2c.8
@@ -159,8 +159,6 @@ utility appeared in
The
.Nm
utility and this manual page were written by
-.An Bartlomiej Sieka
-.Aq tur@semihalf.com
+.An Bartlomiej Sieka Aq Mt tur@semihalf.com
and
-.An Michal Hajduk
-.Aq mih@semihalf.com .
+.An Michal Hajduk Aq Mt mih@semihalf.com .
diff --git a/usr.sbin/iostat/iostat.8 b/usr.sbin/iostat/iostat.8
index 1d2d517e328e..5223b72cf5f7 100644
--- a/usr.sbin/iostat/iostat.8
+++ b/usr.sbin/iostat/iostat.8
@@ -506,7 +506,7 @@ This version of
first appeared in
.Fx 3.0 .
.Sh AUTHORS
-.An Kenneth Merry Aq ken@FreeBSD.org
+.An Kenneth Merry Aq Mt ken@FreeBSD.org
.Sh BUGS
The use of
.Nm
diff --git a/usr.sbin/ipfwpcap/ipfwpcap.8 b/usr.sbin/ipfwpcap/ipfwpcap.8
index 523b059a156f..a161ebbffb47 100644
--- a/usr.sbin/ipfwpcap/ipfwpcap.8
+++ b/usr.sbin/ipfwpcap/ipfwpcap.8
@@ -127,6 +127,6 @@ utility first appeared in
.An -nosplit
.Nm
was written by
-.An P. Kern Aq pkern@cns.utoronto.ca .
+.An P. Kern Aq Mt pkern@cns.utoronto.ca .
This manual page was written by
-.An Niclas Zeising Aq zeising@FreeBSD.org .
+.An Niclas Zeising Aq Mt zeising@FreeBSD.org .
diff --git a/usr.sbin/iscsid/iscsid.8 b/usr.sbin/iscsid/iscsid.8
index 89c7c257e7f0..fbfc55d72c2c 100644
--- a/usr.sbin/iscsid/iscsid.8
+++ b/usr.sbin/iscsid/iscsid.8
@@ -109,5 +109,5 @@ command appeared in
The
.Nm
was developed by
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
under sponsorship from the FreeBSD Foundation.
diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c
index cea996de6c3e..4e85b1ce345c 100644
--- a/usr.sbin/iscsid/iscsid.c
+++ b/usr.sbin/iscsid/iscsid.c
@@ -149,8 +149,8 @@ resolve_addr(const struct connection *conn, const char *address,
}
static struct connection *
-connection_new(unsigned int session_id, const struct iscsi_session_conf *conf,
- int iscsi_fd)
+connection_new(unsigned int session_id, const uint8_t isid[8], uint16_t tsih,
+ const struct iscsi_session_conf *conf, int iscsi_fd)
{
struct connection *conn;
struct addrinfo *from_ai, *to_ai;
@@ -176,6 +176,8 @@ connection_new(unsigned int session_id, const struct iscsi_session_conf *conf,
conn->conn_first_burst_length = 65536;
conn->conn_session_id = session_id;
+ memcpy(&conn->conn_isid, isid, sizeof(conn->conn_isid));
+ conn->conn_tsih = tsih;
conn->conn_iscsi_fd = iscsi_fd;
/*
@@ -264,7 +266,7 @@ handoff(struct connection *conn)
idh.idh_socket = conn->conn_socket;
strlcpy(idh.idh_target_alias, conn->conn_target_alias,
sizeof(idh.idh_target_alias));
- memcpy(idh.idh_isid, conn->conn_isid, sizeof(idh.idh_isid));
+ idh.idh_tsih = conn->conn_tsih;
idh.idh_statsn = conn->conn_statsn;
idh.idh_header_digest = conn->conn_header_digest;
idh.idh_data_digest = conn->conn_data_digest;
@@ -304,10 +306,10 @@ capsicate(struct connection *conn)
cap_rights_t rights;
#ifdef ICL_KERNEL_PROXY
const unsigned long cmds[] = { ISCSIDCONNECT, ISCSIDSEND, ISCSIDRECEIVE,
- ISCSIDHANDOFF, ISCSIDFAIL, ISCSISADD, ISCSISREMOVE };
+ ISCSIDHANDOFF, ISCSIDFAIL, ISCSISADD, ISCSISREMOVE, ISCSISMODIFY };
#else
const unsigned long cmds[] = { ISCSIDHANDOFF, ISCSIDFAIL, ISCSISADD,
- ISCSISREMOVE };
+ ISCSISREMOVE, ISCSISMODIFY };
#endif
cap_rights_init(&rights, CAP_IOCTL);
@@ -430,7 +432,8 @@ handle_request(int iscsi_fd, const struct iscsi_daemon_request *request, int tim
setproctitle("%s", request->idr_conf.isc_target_addr);
}
- conn = connection_new(request->idr_session_id, &request->idr_conf, iscsi_fd);
+ conn = connection_new(request->idr_session_id, request->idr_isid,
+ request->idr_tsih, &request->idr_conf, iscsi_fd);
set_timeout(timeout);
capsicate(conn);
login(conn);
diff --git a/usr.sbin/iscsid/iscsid.h b/usr.sbin/iscsid/iscsid.h
index b19542d24250..962355947a4f 100644
--- a/usr.sbin/iscsid/iscsid.h
+++ b/usr.sbin/iscsid/iscsid.h
@@ -51,6 +51,7 @@ struct connection {
struct iscsi_session_conf conn_conf;
char conn_target_alias[ISCSI_ADDR_LEN];
uint8_t conn_isid[6];
+ uint16_t conn_tsih;
uint32_t conn_statsn;
int conn_header_digest;
int conn_data_digest;
diff --git a/usr.sbin/iscsid/login.c b/usr.sbin/iscsid/login.c
index 4f5325807fc3..f4fd29f2c3bf 100644
--- a/usr.sbin/iscsid/login.c
+++ b/usr.sbin/iscsid/login.c
@@ -30,6 +30,7 @@
*/
#include <sys/types.h>
+#include <sys/ioctl.h>
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
@@ -158,12 +159,67 @@ login_target_error_str(int class, int detail)
}
}
+static void
+kernel_modify(const struct connection *conn, const char *target_address)
+{
+ struct iscsi_session_modify ism;
+ int error;
+
+ memset(&ism, 0, sizeof(ism));
+ ism.ism_session_id = conn->conn_session_id;
+ memcpy(&ism.ism_conf, &conn->conn_conf, sizeof(ism.ism_conf));
+ strlcpy(ism.ism_conf.isc_target_addr, target_address,
+ sizeof(ism.ism_conf.isc_target));
+ error = ioctl(conn->conn_iscsi_fd, ISCSISMODIFY, &ism);
+ if (error != 0) {
+ log_err(1, "failed to redirect to %s: ISCSISMODIFY",
+ target_address);
+ }
+}
+
+/*
+ * XXX: The way it works is suboptimal; what should happen is described
+ * in draft-gilligan-iscsi-fault-tolerance-00. That, however, would
+ * be much more complicated: we would need to keep "dependencies"
+ * for sessions, so that, in case described in draft and using draft
+ * terminology, we would have three sessions: one for discovery,
+ * one for initial target portal, and one for redirect portal.
+ * This would allow us to "backtrack" on connection failure,
+ * as described in draft.
+ */
+static void
+login_handle_redirection(struct connection *conn, struct pdu *response)
+{
+ struct iscsi_bhs_login_response *bhslr;
+ struct keys *response_keys;
+ const char *target_address;
+
+ bhslr = (struct iscsi_bhs_login_response *)response->pdu_bhs;
+ assert (bhslr->bhslr_status_class == 1);
+
+ response_keys = keys_new();
+ keys_load(response_keys, response);
+
+ target_address = keys_find(response_keys, "TargetAddress");
+ if (target_address == NULL)
+ log_errx(1, "received redirection without TargetAddress");
+ if (target_address[0] == '\0')
+ log_errx(1, "received redirection with empty TargetAddress");
+ if (strlen(target_address) >=
+ sizeof(conn->conn_conf.isc_target_addr) - 1)
+ log_errx(1, "received TargetAddress is too long");
+
+ log_debugx("received redirection to \"%s\"", target_address);
+ kernel_modify(conn, target_address);
+}
+
static struct pdu *
-login_receive(struct connection *conn, bool initial)
+login_receive(struct connection *conn)
{
struct pdu *response;
struct iscsi_bhs_login_response *bhslr;
const char *errorstr;
+ static bool initial = true;
response = pdu_new(conn);
pdu_receive(response);
@@ -183,6 +239,11 @@ login_receive(struct connection *conn, bool initial)
if (bhslr->bhslr_version_active != 0x00)
log_errx(1, "received Login PDU with unsupported "
"Version-active 0x%x", bhslr->bhslr_version_active);
+ if (bhslr->bhslr_status_class == 1) {
+ login_handle_redirection(conn, response);
+ log_debugx("redirection handled; exiting");
+ exit(0);
+ }
if (bhslr->bhslr_status_class != 0) {
errorstr = login_target_error_str(bhslr->bhslr_status_class,
bhslr->bhslr_status_detail);
@@ -199,25 +260,43 @@ login_receive(struct connection *conn, bool initial)
"is %d, should be %d", ntohl(bhslr->bhslr_statsn),
conn->conn_statsn + 1);
}
+ conn->conn_tsih = ntohs(bhslr->bhslr_tsih);
conn->conn_statsn = ntohl(bhslr->bhslr_statsn);
+ initial = false;
+
return (response);
}
static struct pdu *
-login_new_request(struct connection *conn)
+login_new_request(struct connection *conn, int csg)
{
struct pdu *request;
struct iscsi_bhs_login_request *bhslr;
+ int nsg;
request = pdu_new(conn);
bhslr = (struct iscsi_bhs_login_request *)request->pdu_bhs;
bhslr->bhslr_opcode = ISCSI_BHS_OPCODE_LOGIN_REQUEST |
ISCSI_BHS_OPCODE_IMMEDIATE;
+
bhslr->bhslr_flags = BHSLR_FLAGS_TRANSIT;
- login_set_csg(request, BHSLR_STAGE_SECURITY_NEGOTIATION);
- login_set_nsg(request, BHSLR_STAGE_OPERATIONAL_NEGOTIATION);
+ switch (csg) {
+ case BHSLR_STAGE_SECURITY_NEGOTIATION:
+ nsg = BHSLR_STAGE_OPERATIONAL_NEGOTIATION;
+ break;
+ case BHSLR_STAGE_OPERATIONAL_NEGOTIATION:
+ nsg = BHSLR_STAGE_FULL_FEATURE_PHASE;
+ break;
+ default:
+ assert(!"invalid csg");
+ log_errx(1, "invalid csg %d", csg);
+ }
+ login_set_csg(request, csg);
+ login_set_nsg(request, nsg);
+
memcpy(bhslr->bhslr_isid, &conn->conn_isid, sizeof(bhslr->bhslr_isid));
+ bhslr->bhslr_tsih = htons(conn->conn_tsih);
bhslr->bhslr_initiator_task_tag = 0;
bhslr->bhslr_cmdsn = 0;
bhslr->bhslr_expstatsn = htonl(conn->conn_statsn + 1);
@@ -495,10 +574,8 @@ login_negotiate(struct connection *conn)
struct iscsi_bhs_login_response *bhslr;
int i;
- log_debugx("beginning parameter negotiation");
- request = login_new_request(conn);
- login_set_csg(request, BHSLR_STAGE_OPERATIONAL_NEGOTIATION);
- login_set_nsg(request, BHSLR_STAGE_FULL_FEATURE_PHASE);
+ log_debugx("beginning operational parameter negotiation");
+ request = login_new_request(conn, BHSLR_STAGE_OPERATIONAL_NEGOTIATION);
request_keys = keys_new();
/*
@@ -538,7 +615,7 @@ login_negotiate(struct connection *conn)
pdu_delete(request);
request = NULL;
- response = login_receive(conn, false);
+ response = login_receive(conn);
response_keys = keys_new();
keys_load(response_keys, response);
for (i = 0; i < KEYS_MAX; i++) {
@@ -557,7 +634,7 @@ login_negotiate(struct connection *conn)
log_warnx("received final login response with wrong NSG 0x%x",
login_nsg(response));
- log_debugx("parameter negotiation done; "
+ log_debugx("operational parameter negotiation done; "
"transitioning to Full Feature phase");
keys_delete(response_keys);
@@ -570,7 +647,7 @@ login_send_chap_a(struct connection *conn)
struct pdu *request;
struct keys *request_keys;
- request = login_new_request(conn);
+ request = login_new_request(conn, BHSLR_STAGE_SECURITY_NEGOTIATION);
request_keys = keys_new();
keys_add(request_keys, "CHAP_A", "5");
keys_save(request_keys, request);
@@ -632,7 +709,7 @@ login_send_chap_r(struct pdu *response)
keys_delete(response_keys);
- request = login_new_request(conn);
+ request = login_new_request(conn, BHSLR_STAGE_SECURITY_NEGOTIATION);
request_keys = keys_new();
keys_add(request_keys, "CHAP_N", conn->conn_conf.isc_user);
keys_add(request_keys, "CHAP_R", chap_r);
@@ -730,7 +807,7 @@ login_chap(struct connection *conn)
login_send_chap_a(conn);
log_debugx("waiting for CHAP_A/CHAP_C/CHAP_I");
- response = login_receive(conn, false);
+ response = login_receive(conn);
log_debugx("sending CHAP_N/CHAP_R");
login_send_chap_r(response);
@@ -741,7 +818,7 @@ login_chap(struct connection *conn)
*/
log_debugx("waiting for CHAP result");
- response = login_receive(conn, false);
+ response = login_receive(conn);
if (conn->conn_conf.isc_mutual_user[0] != '\0')
login_verify_mutual(response);
pdu_delete(response);
@@ -749,41 +826,17 @@ login_chap(struct connection *conn)
log_debugx("CHAP authentication done");
}
-static void
-login_create_isid(struct connection *conn)
-{
- int rv;
-
- /*
- * RFC 3720, 10.12.5: 10b, "Random" ISID.
- *
- */
- conn->conn_isid[0] = 0x80;
-
- rv = RAND_bytes(&conn->conn_isid[1], 3);
- if (rv != 1) {
- log_errx(1, "RAND_bytes failed: %s",
- ERR_error_string(ERR_get_error(), NULL));
- }
-}
-
void
login(struct connection *conn)
{
struct pdu *request, *response;
struct keys *request_keys, *response_keys;
- struct iscsi_bhs_login_request *bhslr;
struct iscsi_bhs_login_response *bhslr2;
const char *auth_method;
int i;
- login_create_isid(conn);
-
log_debugx("beginning Login phase; sending Login PDU");
- request = login_new_request(conn);
-
- bhslr = (struct iscsi_bhs_login_request *)request->pdu_bhs;
-
+ request = login_new_request(conn, BHSLR_STAGE_SECURITY_NEGOTIATION);
request_keys = keys_new();
if (conn->conn_conf.isc_mutual_user[0] != '\0') {
keys_add(request_keys, "AuthMethod", "CHAP");
@@ -823,7 +876,7 @@ login(struct connection *conn)
pdu_send(request);
pdu_delete(request);
- response = login_receive(conn, true);
+ response = login_receive(conn);
response_keys = keys_new();
keys_load(response_keys, response);
@@ -852,12 +905,12 @@ login(struct connection *conn)
login_nsg(response) == BHSLR_STAGE_OPERATIONAL_NEGOTIATION) {
if (conn->conn_conf.isc_mutual_user[0] != '\0') {
log_errx(1, "target requested transition "
- "to operational negotiation, but we require "
- "mutual CHAP");
+ "to operational parameter negotiation, "
+ "but we require mutual CHAP");
}
log_debugx("target requested transition "
- "to operational negotiation");
+ "to operational parameter negotiation");
keys_delete(response_keys);
pdu_delete(response);
login_negotiate(conn);
diff --git a/usr.sbin/jail/jail.8 b/usr.sbin/jail/jail.8
index 8ebe210c9c8c..e43928a75cd1 100644
--- a/usr.sbin/jail/jail.8
+++ b/usr.sbin/jail/jail.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 12, 2013
+.Dd July 10, 2014
.Dt JAIL 8
.Os
.Sh NAME
@@ -63,7 +63,9 @@
The
.Nm
utility creates new jails, or modifies or removes existing jails.
-A jail is specified via parameters on the command line, or in the
+A jail
+.Pq or Dq prison
+is specified via parameters on the command line, or in the
.Xr jail.conf 5
file.
.Pp
@@ -73,7 +75,7 @@ At least one of the options
or
.Fl r
must be specified.
-These options are used alone or in combination describe the operation to
+These options are used alone or in combination to describe the operation to
perform:
.Bl -tag -width indent
.It Fl c
@@ -82,8 +84,7 @@ The jail
.Va jid
and
.Va name
-parameters (if specified) on the command line,
-or any jails
+parameters (if specified on the command line)
must not refer to an existing jail.
.It Fl m
Modify an existing jail.
@@ -97,14 +98,15 @@ Some parameters may not be changed on a running jail.
Remove the
.Ar jail
specified by jid or name.
-All jailed processes are killed, and all children of this jail are also
+All jailed processes are killed, and all jails that are
+children of this jail are also
removed.
.It Fl rc
Restart an existing jail.
The jail is first removed and then re-created, as if
-.Dq Nm Fl c
-and
.Dq Nm Fl r
+and
+.Dq Nm Fl c
were run in succession.
.It Fl cm
Create a jail if it does not exist, or modify the jail if it does exist.
@@ -134,7 +136,7 @@ Resolve the
parameter (or
.Va hostname )
and add all IP addresses returned by the resolver
-to the list of addresses for this prison.
+to the list of addresses for this jail.
This is equivalent to the
.Va ip_hostname
parameter.
@@ -146,7 +148,7 @@ option.
.It Fl J Ar jid_file
Write a
.Ar jid_file
-file, containing parameters used to start the jail.
+file, containing the parameters used to start the jail.
.It Fl l
Run commands in a clean environment.
This is deprecated and is equivalent to the exec.clean parameter.
@@ -166,7 +168,7 @@ Only error messages will be printed.
A variation of the
.Fl r
option that removes an existing jail without using the configuration file.
-No removal-related parameters for this jail will be used - the jail will
+No removal-related parameters for this jail will be used \(em the jail will
simply be removed.
.It Fl s Ar securelevel
Set the
@@ -183,7 +185,7 @@ and
.Va exec.system_jail_user
parameters.
.It Fl U Ar username
-The user name from jailed environment as whom jailed commands should run.
+The user name from the jailed environment as whom jailed commands should run.
This is deprecated and is equivalent to the
.Va exec.jail_user
parameter.
@@ -237,13 +239,12 @@ This mode will always create a new jail, and the
.Fl c
and
.Fl m
-options don't apply (and must not exist).
+options do not apply (and must not be present).
.Ss Jail Parameters
Parameters in the
.Xr jail.conf 5
-file, or on the command line, are generally in
-.Dq name=value
-form.
+file, or on the command line, are generally of the form
+.Dq name=value .
Some parameters are boolean, and do not have a value but are set by the
name alone with or without a
.Dq no
@@ -264,9 +265,10 @@ for details).
.Pp
The
.Nm
-utility recognizes two classes of parameters. There are the true jail
+utility recognizes two classes of parameters.
+There are the true jail
parameters that are passed to the kernel when the jail is created,
-can be seen with
+which can be seen with
.Xr jls 8 ,
and can (usually) be changed with
.Dq Nm Fl m .
@@ -314,26 +316,26 @@ parameter is implied by the
file format, and need not be explicitly set when using the configuration
file.
.It Va path
-The directory which is to be the root of the prison.
-Any commands run inside the prison, either by
+The directory which is to be the root of the jail.
+Any commands run inside the jail, either by
.Nm
or from
.Xr jexec 8 ,
are run from this directory.
.It Va ip4.addr
-A list of IPv4 addresses assigned to the prison.
+A list of IPv4 addresses assigned to the jail.
If this is set, the jail is restricted to using only these addresses.
Any attempts to use other addresses fail, and attempts to use wildcard
addresses silently use the jailed address instead.
-For IPv4 the first address given will be kept used as the source address
-in case source address selection on unbound sockets cannot find a better
+For IPv4 the first address given will be used as the source address
+when source address selection on unbound sockets cannot find a better
match.
-It is only possible to start multiple jails with the same IP address,
+It is only possible to start multiple jails with the same IP address
if none of the jails has more than this single overlapping IP address
assigned to itself.
.It Va ip4.saddrsel
A boolean option to change the formerly mentioned behaviour and disable
-IPv4 source address selection for the prison in favour of the primary
+IPv4 source address selection for the jail in favour of the primary
IPv4 address of the jail.
Source address selection is enabled by default for all jails and the
.Va ip4.nosaddrsel
@@ -345,8 +347,8 @@ Possible values are
to allow unrestricted access to all system addresses,
.Dq new
to restrict addresses via
-.Va ip4.addr
-above, and
+.Va ip4.addr ,
+and
.Dq disable
to stop the jail from using IPv4 entirely.
Setting the
@@ -354,14 +356,14 @@ Setting the
parameter implies a value of
.Dq new .
.It Va ip6.addr , Va ip6.saddrsel , Va ip6
-A set of IPv6 options for the prison, the counterparts to
+A set of IPv6 options for the jail, the counterparts to
.Va ip4.addr ,
.Va ip4.saddrsel
and
.Va ip4
above.
.It vnet
-Create the prison with its own virtual network stack,
+Create the jail with its own virtual network stack,
with its own network interfaces, addresses, routing table, etc.
The kernel must have been compiled with the
.Sy VIMAGE option
@@ -373,7 +375,7 @@ and
.Dq new
to create a new network stack.
.It Va host.hostname
-The hostname of the prison.
+The hostname of the jail.
Other similar parameters are
.Va host.domainname ,
.Va host.hostuuid
@@ -392,7 +394,7 @@ Setting any of the above fields implies a value of
The value of the jail's
.Va kern.securelevel
sysctl.
-A jail never has a lower securelevel than the default system, but by
+A jail never has a lower securelevel than its parent system, but by
setting this parameter it may have a higher one.
If the system securelevel is changed, any jail securelevels will be at
least as secure.
@@ -432,12 +434,12 @@ section for more information.
The number of descendants of this jail, including its own child jails
and any jails created under them.
.It Va enforce_statfs
-This determines which information processes in a jail are able to get
+This determines what information processes in a jail are able to get
about mount points.
It affects the behaviour of the following syscalls:
.Xr statfs 2 ,
.Xr fstatfs 2 ,
-.Xr getfsstat 2
+.Xr getfsstat 2 ,
and
.Xr fhstatfs 2
(as well as similar compatibility syscalls).
@@ -488,12 +490,12 @@ namespace across the host and jail environments, meaning that processes
within a jail would be able to communicate with (and potentially interfere
with) processes outside of the jail, and in other jails.
.It Va allow.raw_sockets
-The prison root is allowed to create raw sockets.
+The jail root is allowed to create raw sockets.
Setting this parameter allows utilities like
.Xr ping 8
and
.Xr traceroute 8
-to operate inside the prison.
+to operate inside the jail.
If this is set, the source IP addresses are enforced to comply
with the IP address bound to the jail, regardless of whether or not
the
@@ -523,10 +525,10 @@ privileged users inside the jail will be able to mount and unmount the
devfs file system.
This permission is effective only together with
.Va allow.mount
-and if
+and only when
.Va enforce_statfs
is set to a value lower than 2.
-Please consider restricting the devfs ruleset with the
+The devfs ruleset should be restricted from the default by using the
.Va devfs_ruleset
option.
.It Va allow.mount.nullfs
@@ -534,7 +536,7 @@ privileged users inside the jail will be able to mount and unmount the
nullfs file system.
This permission is effective only together with
.Va allow.mount
-and if
+and only when
.Va enforce_statfs
is set to a value lower than 2.
.It Va allow.mount.procfs
@@ -542,7 +544,7 @@ privileged users inside the jail will be able to mount and unmount the
procfs file system.
This permission is effective only together with
.Va allow.mount
-and if
+and only when
.Va enforce_statfs
is set to a value lower than 2.
.It Va allow.mount.tmpfs
@@ -550,7 +552,7 @@ privileged users inside the jail will be able to mount and unmount the
tmpfs file system.
This permission is effective only together with
.Va allow.mount
-and if
+and only when
.Va enforce_statfs
is set to a value lower than 2.
.It Va allow.mount.zfs
@@ -558,7 +560,7 @@ privileged users inside the jail will be able to mount and unmount the
ZFS file system.
This permission is effective only together with
.Va allow.mount
-and if
+and only when
.Va enforce_statfs
is set to a value lower than 2.
See
@@ -566,7 +568,7 @@ See
for information on how to configure the ZFS filesystem to operate from
within a jail.
.It Va allow.quotas
-The prison root may administer quotas on the jail's filesystem(s).
+The jail root may administer quotas on the jail's filesystem(s).
This includes filesystems that the jail may share with other jails or
with non-jailed parts of the system.
.It Va allow.socket_af
@@ -576,33 +578,33 @@ have not had jail functionality added to them.
.El
.El
.Pp
-There are pseudo-parameters that aren't passed to the kernel, but are
+There are pseudo-parameters that are not passed to the kernel, but are
used by
.Nm
-to set up the prison environment, often by running specified commands
+to set up the jail environment, often by running specified commands
when jails are created or removed.
The
.Va exec.*
command parameters are
.Xr sh 1
-command lines that are run in either the system or prison environment.
+command lines that are run in either the system or jail environment.
They may be given multiple values, which run would the specified
commands in sequence.
All commands must succeed (return a zero exit status), or the jail will
-not be created or removed.
+not be created or removed, as appropriate.
.Pp
The pseudo-parameters are:
.Bl -tag -width indent
.It Va exec.prestart
-Command(s) to run in the system environment before a prison is created.
+Command(s) to run in the system environment before a jail is created.
.It Va exec.start
-Command(s) to run in the prison environment when a jail is created.
+Command(s) to run in the jail environment when a jail is created.
A typical command to run is
.Dq sh /etc/rc .
.It Va command
A synonym for
.Va exec.start
-for use when specifying a prison directly on the command line.
+for use when specifying a jail directly on the command line.
Unlike other parameters whose value is a single string,
.Va command
uses the remainder of the
@@ -616,7 +618,7 @@ commands have completed.
.It Va exec.prestop
Command(s) to run in the system environment before a jail is removed.
.It Va exec.stop
-Command(s) to run in the prison environment before a jail is removed,
+Command(s) to run in the jail environment before a jail is removed,
and after any
.Va exec.prestop
commands have completed.
@@ -641,76 +643,78 @@ is imported from the current environment.
The environment variables from the login class capability database for the
target login are also set.
.It Va exec.jail_user
-The user to run commands as, when running in the prison environment.
+The user to run commands as, when running in the jail environment.
The default is to run the commands as the current user.
.It Va exec.system_jail_user
This boolean option looks for the
.Va exec.jail_user
in the system
.Xr passwd 5
-file, instead of in the prison's file.
+file, instead of in the jail's file.
.It Va exec.system_user
The user to run commands as, when running in the system environment.
The default is to run the commands as the current user.
.It Va exec.timeout
-The maximum amount of time to wait for a command to complete.
-If a command is still running after this many seconds have passed,
-the jail not be created or removed.
+The maximum amount of time to wait for a command to complete, in
+seconds.
+If a command is still running after this timeout has passed,
+the jail will not be created or removed, as appropriate.
.It Va exec.consolelog
A file to direct command output (stdout and stderr) to.
.It Va exec.fib
-The FIB (routing table) to set when running commands inside the prison.
+The FIB (routing table) to set when running commands inside the jail.
.It Va stop.timeout
-The maximum amount of time to wait for a prison's processes to exit
+The maximum amount of time to wait for a jail's processes to exit
after sending them a
.Dv SIGTERM
signal (which happens after the
.Va exec.stop
commands have completed).
-After this many seconds have passed, the prison will be removed, which
+After this many seconds have passed, the jail will be removed, which
will kill any remaining processes.
If this is set to zero, no
.Dv SIGTERM
-is sent and the prison is immediately removed.
+is sent and the jail is immediately removed.
The default is 10 seconds.
.It Va interface
-A network interface to add the prison's IP addresses
+A network interface to add the jail's IP addresses
.Va ( ip4.addr
and
.Va ip6.addr )
to.
An alias for each address will be added to the interface before the
-prison is created, and will be removed from the interface after the
-prison is removed.
+jail is created, and will be removed from the interface after the
+jail is removed.
.It Va ip4.addr
-In addition to the IP addresses that are passed to the kernel, and
+In addition to the IP addresses that are passed to the kernel, an
interface and/or a netmask may also be specified, in the form
.Dq Ar interface Ns | Ns Ar ip-address Ns / Ns Ar netmask .
If an interface is given before the IP address, an alias for the address
will be added to that interface, as it is with the
.Va interface
-parameter. If a netmask in either dotted-quad or CIDR form is given
-after IP address, it will be used when adding the IP alias.
+parameter.
+If a netmask in either dotted-quad or CIDR form is given
+after an IP address, it will be used when adding the IP alias.
.It Va ip6.addr
In addition to the IP addresses that are passed to the kernel,
-and interface and/or a prefix may also be specified, in the form
+an interface and/or a prefix may also be specified, in the form
.Dq Ar interface Ns | Ns Ar ip-address Ns / Ns Ar prefix .
.It Va vnet.interface
A network interface to give to a vnet-enabled jail after is it created.
-The interface will automatically be returned when the jail is removed.
+The interface will automatically be released when the jail is removed.
.It Va ip_hostname
Resolve the
.Va host.hostname
parameter and add all IP addresses returned by the resolver
to the list of addresses
-.Va ( ip4.addr
+.Po Va ip4.addr
or
-.Va ip6.addr )
-for this prison.
+.Va ip6.addr Pc
+for this jail.
This may affect default address selection for outgoing IPv4 connections
-of prisons.
+from jails.
The address first returned by the resolver for each address family
-will be used as primary address.
+will be used as the primary address.
.It Va mount
A filesystem to mount before creating the jail (and to unmount after
removing it), given as a single
@@ -728,7 +732,7 @@ filesystem on the chrooted
directory, and apply the ruleset in the
.Va devfs_ruleset
parameter (or a default of ruleset 4: devfsrules_jail)
-to restrict the devices visible inside the prison.
+to restrict the devices visible inside the jail.
.It Va mount.fdescfs
Mount a
.Xr fdescfs 5
@@ -761,11 +765,11 @@ is
required, so as to provide the necessary command line tools, daemons,
libraries, application configuration files, etc.
However, for a virtual server configuration, a fair amount of
-additional work is required so as to configure the
+additional work is required so as to replace the
.Dq boot
process.
This manual page documents the configuration steps necessary to support
-either of these steps, although the configuration steps may be
+either of these steps, although the configuration steps may need to be
refined based on local requirements.
.Ss "Setting up a Jail Directory Tree"
To set up a jail directory tree containing an entire
@@ -785,7 +789,7 @@ In many cases this example would put far more in the jail than needed.
In the other extreme case a jail might contain only one file:
the executable to be run in the jail.
.Pp
-We recommend experimentation and caution that it is a lot easier to
+We recommend experimentation, and caution that it is a lot easier to
start with a
.Dq fat
jail and remove things until it stops working,
@@ -804,13 +808,13 @@ for a jail named
Substitute below as needed with your
own directory, IP address, and hostname.
.Ss "Setting up the Host Environment"
-First, you will want to set up your real system's environment to be
+First, set up the real system's environment to be
.Dq jail-friendly .
For consistency, we will refer to the parent box as the
.Dq "host environment" ,
and to the jailed virtual machine as the
.Dq "jail environment" .
-Since jail is implemented using IP aliases, one of the first things to do
+Since jails are implemented using IP aliases, one of the first things to do
is to disable IP services on the host system that listen on all local
IP addresses for a service.
If a network service is present in the host environment that binds all
@@ -833,13 +837,12 @@ rpcbind_enable="NO"
is the native IP address for the host system, in this example.
Daemons that run out of
.Xr inetd 8
-can be easily set to use only the specified host IP address.
+can be easily configured to use only the specified host IP address.
Other daemons
-will need to be manually configured\(emfor some this is possible through
-the
+will need to be manually configured \(em for some this is possible through
.Xr rc.conf 5
flags entries; for others it is necessary to modify per-application
-configuration files, or to recompile the applications.
+configuration files, or to recompile the application.
The following frequently deployed services must have their individual
configuration files modified to limit the application to listening
to a specific IP address:
@@ -877,7 +880,7 @@ easily reconfigured to use only specific IPs, as some NFS services are
hosted directly from the kernel.
Any third-party network software running
in the host environment should also be checked and configured so that it
-does not bind all IP addresses, which would result in those services' also
+does not bind all IP addresses, which would result in those services also
appearing to be offered by the jail environments.
.Pp
Once
@@ -890,7 +893,7 @@ etc.).
Start any jail for the first time without configuring the network
interface so that you can clean it up a little and set up accounts.
As
-with any machine (virtual or not) you will need to set a root password, time
+with any machine (virtual or not), you will need to set a root password, time
zone, etc.
Some of these steps apply only if you intend to run a full virtual server
inside the jail; others apply both for constraining a particular application
@@ -915,7 +918,7 @@ etc.
.It
Configure
.Pa /etc/resolv.conf
-so that name resolution within the jail will work correctly
+so that name resolution within the jail will work correctly.
.It
Run
.Xr newaliases 1
@@ -923,13 +926,13 @@ to quell
.Xr sendmail 8
warnings.
.It
-Set a root password, probably different from the real host system
+Set a root password, probably different from the real host system.
.It
-Set the timezone
+Set the timezone.
.It
-Add accounts for users in the jail environment
+Add accounts for users in the jail environment.
.It
-Install any packages the environment requires
+Install any packages the environment requires.
.El
.Pp
You may also want to perform any package-specific configuration (web servers,
@@ -989,11 +992,12 @@ and other processes running within the jail using
with the
.Ql J
flag appearing beside jailed processes.
-To see an active list of jails, use the
-.Xr jls 8
-utility.
-You should also be able to
-.Xr telnet 1
+To see an active list of jails, use
+.Xr jls 8 .
+If
+.Xr sshd 8
+is enabled in the jail environment, you should be able to
+.Xr ssh 1
to the hostname or IP address of the jailed environment, and log
in using the accounts you created previously.
.Pp
@@ -1021,7 +1025,7 @@ This will send the
.Dv SIGTERM
or
.Dv SIGKILL
-signals to all processes in the jail - be careful not to run this from
+signals to all processes in the jail \(em be careful not to run this from
the host environment!
Once all of the jail's processes have died, unless the jail was created
with the
@@ -1076,18 +1080,18 @@ or
any file system inside a jail unless the file system is marked
jail-friendly, the jail's
.Va allow.mount
-parameter is set and the jail's
+parameter is set, and the jail's
.Va enforce_statfs
parameter is lower than 2.
.Pp
Multiple jails sharing the same file system can influence each other.
-For example a user in one jail can fill the file system also
+For example, a user in one jail can fill the file system,
leaving no space for processes in the other jail.
Trying to use
.Xr quota 1
-to prevent this will not work either as the file system quotas
+to prevent this will not work either, as the file system quotas
are not aware of jails but only look at the user and group IDs.
-This means the same user ID in two jails share the same file
+This means the same user ID in two jails share a single file
system quota.
One would need to use one file system per jail to make this work.
.Ss "Sysctl MIB Entries"
@@ -1098,11 +1102,11 @@ is one) or not (value is zero).
.Pp
The variable
.Va security.jail.max_af_ips
-determines how may address per address family a prison may have.
+determines how may address per address family a jail may have.
The default is 255.
.Pp
Some MIB variables have per-jail settings.
-Changes to these variables by a jailed process do not effect the host
+Changes to these variables by a jailed process do not affect the host
environment, only the jail environment.
These variables are
.Va kern.securelevel ,
@@ -1127,7 +1131,7 @@ of 0 indicates the jail is a child of the current jail (or is a top-level
jail if the current process isn't jailed).
.Pp
Jailed processes are not allowed to confer greater permissions than they
-themselves are given, e.g. if a jail is created with
+themselves are given, e.g., if a jail is created with
.Va allow.nomount ,
it is not able to create a jail with
.Va allow.mount
diff --git a/usr.sbin/kbdcontrol/kbdcontrol.1 b/usr.sbin/kbdcontrol/kbdcontrol.1
index 76cc5bb38032..3ffa2709601c 100644
--- a/usr.sbin/kbdcontrol/kbdcontrol.1
+++ b/usr.sbin/kbdcontrol/kbdcontrol.1
@@ -271,6 +271,6 @@ kbdcontrol -k /dev/kbdmux0 < /dev/console
.Xr kbdmap 5 ,
.Xr rc.conf 5
.Sh AUTHORS
-.An S\(/oren Schmidt Aq sos@FreeBSD.org
+.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org
.Sh BUGS
Report when found.
diff --git a/usr.sbin/kbdcontrol/kbdcontrol.c b/usr.sbin/kbdcontrol/kbdcontrol.c
index 8c9bb81bf2d0..241e10d3fcf2 100644
--- a/usr.sbin/kbdcontrol/kbdcontrol.c
+++ b/usr.sbin/kbdcontrol/kbdcontrol.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <fcntl.h>
#include <sys/kbio.h>
#include <sys/consio.h>
+#include <sys/sysctl.h>
#include "path.h"
#include "lex.h"
@@ -141,6 +142,18 @@ static void set_keyrates(char *opt);
static void show_kbd_info(void);
static void usage(void) __dead2;
+/* Detect presence of vt(4). */
+static int
+is_vt4(void)
+{
+ char vty_name[4] = "";
+ size_t len = sizeof(vty_name);
+
+ if (sysctlbyname("kern.vty", vty_name, &len, NULL, 0) != 0)
+ return (0);
+ return (strcmp(vty_name, "vt") == 0);
+}
+
static char *
nextarg(int ac, char **av, int *indp, int oc)
{
@@ -785,10 +798,13 @@ load_keymap(char *opt, int dumponly)
FILE *fd;
int i, j;
char *name, *cp;
- char blank[] = "", keymap_path[] = KEYMAP_PATH, dotkbd[] = ".kbd";
- char *prefix[] = {blank, blank, keymap_path, NULL};
+ char blank[] = "", keymap_path[] = KEYMAP_PATH;
+ char vt_keymap_path[] = VT_KEYMAP_PATH, dotkbd[] = ".kbd";
+ char *prefix[] = {blank, blank, blank, keymap_path, NULL};
char *postfix[] = {blank, dotkbd, NULL};
+ if (is_vt4())
+ prefix[2] = vt_keymap_path;
cp = getenv("KEYMAP_PATH");
if (cp != NULL)
asprintf(&(prefix[0]), "%s/", cp);
diff --git a/usr.sbin/kbdcontrol/path.h b/usr.sbin/kbdcontrol/path.h
index 709acbc375dc..e1fa341e0c78 100644
--- a/usr.sbin/kbdcontrol/path.h
+++ b/usr.sbin/kbdcontrol/path.h
@@ -1,4 +1,8 @@
+/* $FreeBSD$ */
+
#define KEYMAP_PATH "/usr/share/syscons/keymaps/"
#define FONT_PATH "/usr/share/syscons/fonts/"
#define SCRNMAP_PATH "/usr/share/syscons/scrnmaps/"
+#define VT_KEYMAP_PATH "/usr/share/vt/keymaps/"
+#define VT_FONT_PATH "/usr/share/vt/fonts/"
diff --git a/usr.sbin/kbdmap/kbdmap.1 b/usr.sbin/kbdmap/kbdmap.1
index 4201fde148d7..6769c307fbbc 100644
--- a/usr.sbin/kbdmap/kbdmap.1
+++ b/usr.sbin/kbdmap/kbdmap.1
@@ -131,12 +131,10 @@ commands appeared in
.Fx 2.1 .
.Sh AUTHORS
.An -nosplit
-.An Wolfram Schneider
-.Aq wosch@FreeBSD.org
+.An Wolfram Schneider Aq Mt wosch@FreeBSD.org
wrote the original Perl version.
The current version was rewritten in C by
-.An Jonathan Belson
-.Aq jon@witchspace.com
+.An Jonathan Belson Aq Mt jon@witchspace.com
for
.Fx 5.0 .
.Sh BUGS
diff --git a/usr.sbin/kgzip/kgzip.8 b/usr.sbin/kgzip/kgzip.8
index 7f810d4e6460..72d0bf5cfe86 100644
--- a/usr.sbin/kgzip/kgzip.8
+++ b/usr.sbin/kgzip/kgzip.8
@@ -132,7 +132,7 @@ The default loader
.Xr boot 8 ,
.Xr loader 8
.Sh AUTHORS
-.An Robert Nordier Aq rnordier@FreeBSD.org .
+.An Robert Nordier Aq Mt rnordier@FreeBSD.org
.Sh BUGS
As symbols are lost, the usefulness of this utility for compressing
kernels is limited to situations where
diff --git a/usr.sbin/kldxref/kldxref.8 b/usr.sbin/kldxref/kldxref.8
index a69af33d1829..1a3b9118dd5c 100644
--- a/usr.sbin/kldxref/kldxref.8
+++ b/usr.sbin/kldxref/kldxref.8
@@ -88,8 +88,8 @@ utility first appeared in
The
.Nm
utility was implemented by
-.An Boris Popov Aq bp@FreeBSD.org .
+.An Boris Popov Aq Mt bp@FreeBSD.org .
This manual page was written by
-.An Boris Popov Aq bp@FreeBSD.org
+.An Boris Popov Aq Mt bp@FreeBSD.org
and
-.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
+.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
diff --git a/usr.sbin/lmcconfig/lmcconfig.8 b/usr.sbin/lmcconfig/lmcconfig.8
index 06fcc9e1a224..6eac2574c8b1 100644
--- a/usr.sbin/lmcconfig/lmcconfig.8
+++ b/usr.sbin/lmcconfig/lmcconfig.8
@@ -718,6 +718,6 @@ the user is not privileged and tried to alter an interface's configuration.
This is a total rewrite of the program
.Nm lmcctl
by
-.An "Andrew Stanley-Jones" .
+.An Andrew Stanley-Jones .
.Sh AUTHORS
-.An "David Boggs" Aq boggs@boggs.palo-alto.ca.us
+.An David Boggs Aq Mt boggs@boggs.palo-alto.ca.us
diff --git a/usr.sbin/lpr/chkprintcap/Makefile b/usr.sbin/lpr/chkprintcap/Makefile
index ffffffbb2bd1..1ea2254f958e 100644
--- a/usr.sbin/lpr/chkprintcap/Makefile
+++ b/usr.sbin/lpr/chkprintcap/Makefile
@@ -11,4 +11,6 @@ CFLAGS+= -I${.CURDIR}/../common_source
DPADD= ${LIBLPR}
LDADD= ${LIBLPR}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/lpr/chkprintcap/chkprintcap.8 b/usr.sbin/lpr/chkprintcap/chkprintcap.8
index c2524a159c70..b41546242b15 100644
--- a/usr.sbin/lpr/chkprintcap/chkprintcap.8
+++ b/usr.sbin/lpr/chkprintcap/chkprintcap.8
@@ -88,7 +88,7 @@ capability in the database (default 1, which corresponds to user
The
.Nm
utility was written by
-.An Garrett A. Wollman Aq wollman@lcs.mit.edu .
+.An Garrett A. Wollman Aq Mt wollman@lcs.mit.edu .
.Sh BUGS
Not enough sanity-checking is done.
At a minimum, the ownership and
diff --git a/usr.sbin/lpr/lpc/Makefile b/usr.sbin/lpr/lpc/Makefile
index 35fa52ab138a..7f228d666c38 100644
--- a/usr.sbin/lpr/lpc/Makefile
+++ b/usr.sbin/lpr/lpc/Makefile
@@ -13,7 +13,9 @@ CFLAGS+= -I${.CURDIR}/../common_source
WARNS?= 0
-DPADD= ${LIBLPR} ${LIBEDIT} ${LIBTERMCAP}
-LDADD= ${LIBLPR} -ledit -ltermcap
+DPADD= ${LIBLPR} ${LIBEDIT} ${LIBTERMCAPW}
+LDADD= ${LIBLPR} -ledit -ltermcapw
+
+NO_PIE= yes
.include <bsd.prog.mk>
diff --git a/usr.sbin/lpr/lpc/Makefile.depend b/usr.sbin/lpr/lpc/Makefile.depend
index 4db22878234b..fbbafd5e06c0 100644
--- a/usr.sbin/lpr/lpc/Makefile.depend
+++ b/usr.sbin/lpr/lpc/Makefile.depend
@@ -11,7 +11,7 @@ DIRDEPS = \
lib/libc \
lib/libcompiler_rt \
lib/libedit \
- lib/ncurses/ncurses \
+ lib/ncurses/ncursesw \
usr.sbin/lpr/common_source \
diff --git a/usr.sbin/lpr/lpd/Makefile b/usr.sbin/lpr/lpd/Makefile
index 0d7d93ef79d9..bd3e25a8b545 100644
--- a/usr.sbin/lpr/lpd/Makefile
+++ b/usr.sbin/lpr/lpd/Makefile
@@ -12,4 +12,6 @@ WARNS?= 1
DPADD= ${LIBLPR}
LDADD= ${LIBLPR}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/lpr/lpq/Makefile b/usr.sbin/lpr/lpq/Makefile
index 4df437e06c32..1c2504b899e5 100644
--- a/usr.sbin/lpr/lpq/Makefile
+++ b/usr.sbin/lpr/lpq/Makefile
@@ -13,4 +13,6 @@ CFLAGS+= -I${.CURDIR}/../common_source
DPADD= ${LIBLPR}
LDADD= ${LIBLPR}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/lpr/lpr/Makefile b/usr.sbin/lpr/lpr/Makefile
index 1894b0089c04..cfeebb059d0c 100644
--- a/usr.sbin/lpr/lpr/Makefile
+++ b/usr.sbin/lpr/lpr/Makefile
@@ -18,4 +18,6 @@ WARNS?= 2
DPADD= ${LIBLPR}
LDADD= ${LIBLPR}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/lpr/lprm/Makefile b/usr.sbin/lpr/lprm/Makefile
index 44bc93ac27ec..bd7e321b5501 100644
--- a/usr.sbin/lpr/lprm/Makefile
+++ b/usr.sbin/lpr/lprm/Makefile
@@ -15,4 +15,6 @@ CFLAGS+= -I${.CURDIR}/../common_source
DPADD= ${LIBLPR}
LDADD= ${LIBLPR}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/lpr/pac/Makefile b/usr.sbin/lpr/pac/Makefile
index bd895a71a305..3a157c9258ca 100644
--- a/usr.sbin/lpr/pac/Makefile
+++ b/usr.sbin/lpr/pac/Makefile
@@ -11,4 +11,6 @@ CFLAGS+= -I${.CURDIR}/../common_source
DPADD= ${LIBLPR}
LDADD= ${LIBLPR}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/mailstats/Makefile b/usr.sbin/mailstats/Makefile
index bd72fc6c5b76..a3cd5623b3f0 100644
--- a/usr.sbin/mailstats/Makefile
+++ b/usr.sbin/mailstats/Makefile
@@ -31,6 +31,8 @@ DPADD+= ${SENDMAIL_DPADD}
LDADD+= ${SENDMAIL_LDADD}
LDFLAGS+= ${SENDMAIL_LDFLAGS}
+NO_PIE= yes
+
sm_os.h:
ln -sf ${SENDMAIL_DIR}/include/sm/os/sm_os_freebsd.h sm_os.h
diff --git a/usr.sbin/mailwrapper/mailwrapper.8 b/usr.sbin/mailwrapper/mailwrapper.8
index 6e498f643f1b..11bfe9539585 100644
--- a/usr.sbin/mailwrapper/mailwrapper.8
+++ b/usr.sbin/mailwrapper/mailwrapper.8
@@ -153,7 +153,7 @@ utility first appeared in
and then
.Fx 4.0 .
.Sh AUTHORS
-.An Perry E. Metzger Aq perry@piermont.com
+.An Perry E. Metzger Aq Mt perry@piermont.com
.Sh BUGS
The entire reason this program exists is a crock.
Instead, a command
diff --git a/usr.sbin/makefs/Makefile b/usr.sbin/makefs/Makefile
index 62531488128e..0e03fd3e35af 100644
--- a/usr.sbin/makefs/Makefile
+++ b/usr.sbin/makefs/Makefile
@@ -38,4 +38,6 @@ LDADD+= ${LIBNETBSD}
DPADD+= ${LIBSBUF} ${LIBUTIL}
LDADD+= -lsbuf -lutil
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c
index f99ecab503ab..274d1c2c7685 100644
--- a/usr.sbin/makefs/ffs/mkfs.c
+++ b/usr.sbin/makefs/ffs/mkfs.c
@@ -253,10 +253,10 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
if (Oflag <= 1) {
sblock.fs_magic = FS_UFS1_MAGIC;
sblock.fs_sblockloc = SBLOCK_UFS1;
- sblock.fs_nindir = sblock.fs_bsize / sizeof(int32_t);
+ sblock.fs_nindir = sblock.fs_bsize / sizeof(ufs1_daddr_t);
sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs1_dinode);
sblock.fs_maxsymlinklen = ((NDADDR + NIADDR) *
- sizeof (int32_t));
+ sizeof (ufs1_daddr_t));
sblock.fs_old_inodefmt = FS_44INODEFMT;
sblock.fs_old_cgoffset = 0;
sblock.fs_old_cgmask = 0xffffffff;
@@ -272,15 +272,11 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
sblock.fs_old_nrpos = 1;
} else {
sblock.fs_magic = FS_UFS2_MAGIC;
-#if 0 /* XXX makefs is used for small filesystems. */
sblock.fs_sblockloc = SBLOCK_UFS2;
-#else
- sblock.fs_sblockloc = SBLOCK_UFS1;
-#endif
- sblock.fs_nindir = sblock.fs_bsize / sizeof(int64_t);
+ sblock.fs_nindir = sblock.fs_bsize / sizeof(ufs2_daddr_t);
sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs2_dinode);
sblock.fs_maxsymlinklen = ((NDADDR + NIADDR) *
- sizeof (int64_t));
+ sizeof (ufs2_daddr_t));
}
sblock.fs_sblkno =
diff --git a/usr.sbin/makefs/makefs.8 b/usr.sbin/makefs/makefs.8
index 51e536f030ae..91ab2048718d 100644
--- a/usr.sbin/makefs/makefs.8
+++ b/usr.sbin/makefs/makefs.8
@@ -363,12 +363,11 @@ The
utility appeared in
.Nx 1.6 .
.Sh AUTHORS
-.An Luke Mewburn
-.Aq lukem@NetBSD.org
+.An Luke Mewburn Aq Mt lukem@NetBSD.org
(original program)
-.An Daniel Watt ,
-.An Walter Deignan ,
-.An Ryan Gabrys ,
-.An Alan Perez-Rathke ,
+.An Daniel Watt
+.An Walter Deignan
+.An Ryan Gabrys
+.An Alan Perez-Rathke
.An Ram Vedam
(cd9660 support)
diff --git a/usr.sbin/makemap/Makefile b/usr.sbin/makemap/Makefile
index 80cafcbcfdba..2c2eef555c7b 100644
--- a/usr.sbin/makemap/Makefile
+++ b/usr.sbin/makemap/Makefile
@@ -34,6 +34,8 @@ DPADD+=${SENDMAIL_DPADD}
LDADD+=${SENDMAIL_LDADD}
LDFLAGS+=${SENDMAIL_LDFLAGS}
+NO_PIE= yes
+
sm_os.h:
ln -sf ${SENDMAIL_DIR}/include/sm/os/sm_os_freebsd.h sm_os.h
diff --git a/usr.sbin/mergemaster/mergemaster.8 b/usr.sbin/mergemaster/mergemaster.8
index 1cff9841ebd7..c3e22a055961 100644
--- a/usr.sbin/mergemaster/mergemaster.8
+++ b/usr.sbin/mergemaster/mergemaster.8
@@ -473,4 +473,4 @@ temporary root environment comes from Nik Clayton's
make world tutorial which is referenced above.
.Sh AUTHORS
This manual page and the script itself were written by
-.An Douglas Barton Aq dougb@FreeBSD.org .
+.An Douglas Barton Aq Mt dougb@FreeBSD.org .
diff --git a/usr.sbin/mergemaster/mergemaster.sh b/usr.sbin/mergemaster/mergemaster.sh
index a200088b1194..9bf4f9f67a01 100755
--- a/usr.sbin/mergemaster/mergemaster.sh
+++ b/usr.sbin/mergemaster/mergemaster.sh
@@ -760,7 +760,7 @@ CONFIRMED_UMASK=${NEW_UMASK:-0022}
# Warn users who still have old rc files
#
for file in atm devfs diskless1 diskless2 network network6 pccard \
- serial syscons sysctl alpha amd64 i386 ia64 sparc64; do
+ serial syscons sysctl alpha amd64 i386 sparc64; do
if [ -f "${DESTDIR}/etc/rc.${file}" ]; then
OLD_RC_PRESENT=1
break
@@ -786,7 +786,7 @@ case "${OLD_RC_PRESENT}" in
*)
mkdir -p /var/tmp/mergemaster/old_rc
for file in atm devfs diskless1 diskless2 network network6 pccard \
- serial syscons sysctl alpha amd64 i386 ia64 sparc64; do
+ serial syscons sysctl alpha amd64 i386 sparc64; do
if [ -f "${DESTDIR}/etc/rc.${file}" ]; then
mv ${DESTDIR}/etc/rc.${file} /var/tmp/mergemaster/old_rc/
fi
diff --git a/usr.sbin/mixer/mixer.8 b/usr.sbin/mixer/mixer.8
index b31b326d2384..6e569cc8cfd9 100644
--- a/usr.sbin/mixer/mixer.8
+++ b/usr.sbin/mixer/mixer.8
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 14, 2008
+.Dd June 2, 2014
.Dt MIXER 8
.Os
.Sh NAME
@@ -161,7 +161,8 @@ as the mixer device.
the default mixer device
.El
.Sh SEE ALSO
-.Xr cdcontrol 1
+.Xr cdcontrol 1 ,
+.Xr sound 4
.Sh HISTORY
The
.Nm
@@ -170,11 +171,11 @@ utility first appeared in
.Sh AUTHORS
.An -nosplit
Original source by
-.An Craig Metz Aq cmetz@thor.tjhsst.edu
+.An Craig Metz Aq Mt cmetz@thor.tjhsst.edu
and
.An Hannu Savolainen .
Mostly rewritten by
-.An John-Mark Gurney Aq jmg@FreeBSD.org .
+.An John-Mark Gurney Aq Mt jmg@FreeBSD.org .
This
manual page was written by
-.An Mike Pritchard Aq mpp@FreeBSD.org .
+.An Mike Pritchard Aq Mt mpp@FreeBSD.org .
diff --git a/usr.sbin/mlxcontrol/mlxcontrol.8 b/usr.sbin/mlxcontrol/mlxcontrol.8
index 4ad6b63b8c6c..33788b94b070 100644
--- a/usr.sbin/mlxcontrol/mlxcontrol.8
+++ b/usr.sbin/mlxcontrol/mlxcontrol.8
@@ -136,9 +136,10 @@ Print usage information for
.Ar command .
.El
.Sh AUTHORS
-The mlxcontrol utility was written by
-.An Michael Smith
-.Aq msmith@FreeBSD.org .
+The
+.Nm
+utility was written by
+.An Michael Smith Aq Mt msmith@FreeBSD.org .
.Sh BUGS
The
.Ar config
diff --git a/usr.sbin/moused/moused.8 b/usr.sbin/moused/moused.8
index 5e4dd432a7f1..27990929e7be 100644
--- a/usr.sbin/moused/moused.8
+++ b/usr.sbin/moused/moused.8
@@ -819,11 +819,11 @@ utility first appeared in
The
.Nm
utility was written by
-.An Michael Smith Aq msmith@FreeBSD.org .
+.An Michael Smith Aq Mt msmith@FreeBSD.org .
This manual page was written by
-.An Mike Pritchard Aq mpp@FreeBSD.org .
+.An Mike Pritchard Aq Mt mpp@FreeBSD.org .
The command and manual page have since been updated by
-.An Kazutaka Yokota Aq yokota@FreeBSD.org .
+.An Kazutaka Yokota Aq Mt yokota@FreeBSD.org .
.Sh CAVEATS
Many pad devices behave as if the first (left) button were pressed if
the user
diff --git a/usr.sbin/mptable/mptable.1 b/usr.sbin/mptable/mptable.1
index 56f901a7c7ce..83e4cea1908e 100644
--- a/usr.sbin/mptable/mptable.1
+++ b/usr.sbin/mptable/mptable.1
@@ -66,4 +66,4 @@ The
command first appeared in
.Fx 3.0 .
.Sh AUTHORS
-.An Steve Passe Aq fsmp@FreeBSD.org
+.An Steve Passe Aq Mt fsmp@FreeBSD.org
diff --git a/usr.sbin/nandsim/nandsim.8 b/usr.sbin/nandsim/nandsim.8
index 5b318a233dae..c7bdb9a4f019 100644
--- a/usr.sbin/nandsim/nandsim.8
+++ b/usr.sbin/nandsim/nandsim.8
@@ -224,6 +224,6 @@ The
.Nm
utility first appeared in
.Fx 10.0 .
-.Sh AUTHOR
+.Sh AUTHORS
This utility was written by
.An Lukasz Wojcik .
diff --git a/usr.sbin/ndiscvt/ndiscvt.8 b/usr.sbin/ndiscvt/ndiscvt.8
index a9bc916141f2..f4974958e005 100644
--- a/usr.sbin/ndiscvt/ndiscvt.8
+++ b/usr.sbin/ndiscvt/ndiscvt.8
@@ -273,11 +273,11 @@ utility first appeared in
The
.Nm
utility was written by
-.An Bill Paul Aq wpaul@windriver.com .
+.An Bill Paul Aq Mt wpaul@windriver.com .
The
.Xr lex 1
and
.Xr yacc 1
.Pa INF
file parser was written by
-.An Matthew Dodd Aq mdodd@FreeBSD.org .
+.An Matthew Dodd Aq Mt mdodd@FreeBSD.org .
diff --git a/usr.sbin/ndiscvt/ndisgen.8 b/usr.sbin/ndiscvt/ndisgen.8
index c4ad4950be49..2fb4f401596e 100644
--- a/usr.sbin/ndiscvt/ndisgen.8
+++ b/usr.sbin/ndiscvt/ndisgen.8
@@ -83,4 +83,4 @@ utility first appeared in
The
.Nm
utility was written by
-.An Bill Paul Aq wpaul@windriver.com .
+.An Bill Paul Aq Mt wpaul@windriver.com .
diff --git a/usr.sbin/ndp/ndp.8 b/usr.sbin/ndp/ndp.8
index 19da8bb6e164..c2a4c1de3e22 100644
--- a/usr.sbin/ndp/ndp.8
+++ b/usr.sbin/ndp/ndp.8
@@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd Jan 10, 2013
+.Dd May 9, 2014
.Dt NDP 8
.Os
.\"
@@ -136,9 +136,26 @@ seconds.
Erase all the NDP entries.
.It Fl d
Delete specified NDP entry.
-.It Fl f
-Parse the file specified by
-.Ar filename .
+.It Fl f Ar filename
+Cause the file
+.Ar filename
+to be read and multiple entries to be set in the
+.Tn NDP
+table.
+Entries
+in the file should be of the form
+.Pp
+.Bd -ragged -offset indent -compact
+.Ar hostname ether_addr
+.Op Cm temp
+.Op Cm proxy
+.Ed
+.Pp
+with argument meanings as given above.
+Leading whitespace and empty lines are ignored.
+A
+.Ql #
+character will mark the rest of the line as a comment.
.It Fl H
Harmonize consistency between the routing table and the default router
list; install the top entry of the list into the kernel routing table.
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c
index 3888b057b857..e8960102de25 100644
--- a/usr.sbin/ndp/ndp.c
+++ b/usr.sbin/ndp/ndp.c
@@ -97,6 +97,7 @@
#include <arpa/inet.h>
+#include <ctype.h>
#include <netdb.h>
#include <errno.h>
#include <nlist.h>
@@ -126,7 +127,7 @@ char host_buf[NI_MAXHOST]; /* getnameinfo() */
char ifix_buf[IFNAMSIZ]; /* if_indextoname() */
int main(int, char **);
-int file(char *);
+static int file(char *);
void getsocket(void);
int set(int, char **);
void get(char *);
@@ -187,9 +188,10 @@ main(int argc, char **argv)
mode = ch;
arg = NULL;
break;
- case 'd':
case 'f':
- case 'i' :
+ exit(file(optarg) ? 1 : 0);
+ case 'd':
+ case 'i':
if (mode) {
usage();
/*NOTREACHED*/
@@ -312,17 +314,15 @@ main(int argc, char **argv)
/*
* Process a file to set standard ndp entries
*/
-int
+static int
file(char *name)
{
FILE *fp;
int i, retval;
- char line[100], arg[5][50], *args[5];
+ char line[100], arg[5][50], *args[5], *p;
- if ((fp = fopen(name, "r")) == NULL) {
- fprintf(stderr, "ndp: cannot open %s\n", name);
- exit(1);
- }
+ if ((fp = fopen(name, "r")) == NULL)
+ err(1, "cannot open %s", name);
args[0] = &arg[0][0];
args[1] = &arg[1][0];
args[2] = &arg[2][0];
@@ -330,10 +330,15 @@ file(char *name)
args[4] = &arg[4][0];
retval = 0;
while (fgets(line, sizeof(line), fp) != NULL) {
+ if ((p = strchr(line, '#')) != NULL)
+ *p = '\0';
+ for (p = line; isblank(*p); p++);
+ if (*p == '\n' || *p == '\0')
+ continue;
i = sscanf(line, "%49s %49s %49s %49s %49s",
arg[0], arg[1], arg[2], arg[3], arg[4]);
if (i < 2) {
- fprintf(stderr, "ndp: bad line: %s\n", line);
+ warnx("bad line: %s", line);
retval = 1;
continue;
}
diff --git a/usr.sbin/newsyslog/newsyslog.8 b/usr.sbin/newsyslog/newsyslog.8
index 87f60ac46f5b..e6d79a468ef8 100644
--- a/usr.sbin/newsyslog/newsyslog.8
+++ b/usr.sbin/newsyslog/newsyslog.8
@@ -17,7 +17,7 @@
.\" the suitability of this software for any purpose. It is
.\" provided "as is" without express or implied warranty.
.\"
-.Dd January 31, 2011
+.Dd May 19, 2014
.Dt NEWSYSLOG 8
.Os
.Sh NAME
@@ -261,10 +261,16 @@ If additional command line arguments are given,
will only examine log files that match those arguments; otherwise, it
will examine all files listed in the configuration file.
.Sh FILES
-.Bl -tag -width /etc/newsyslog.confxxxx -compact
+.Bl -tag -width /usr/local/etc/newsyslog.conf.d -compact
.It Pa /etc/newsyslog.conf
.Nm
configuration file
+.It Pa /etc/newsyslog.conf.d
+Each file in this directory will be included by the default
+.Pa newsyslog.conf .
+.It Pa /usr/local/etc/newsyslog.conf.d
+Each file in this directory will be included by the default
+.Pa newsyslog.conf .
.El
.Sh COMPATIBILITY
Previous versions of the
diff --git a/usr.sbin/nfsd/nfsd.8 b/usr.sbin/nfsd/nfsd.8
index 19e56449532b..d865d7ea4f7c 100644
--- a/usr.sbin/nfsd/nfsd.8
+++ b/usr.sbin/nfsd/nfsd.8
@@ -28,7 +28,7 @@
.\" @(#)nfsd.8 8.4 (Berkeley) 3/29/95
.\" $FreeBSD$
.\"
-.Dd April 23, 2011
+.Dd July 18, 2014
.Dt NFSD 8
.Os
.Sh NAME
@@ -53,7 +53,7 @@ At least one
.Nm
must be running for a machine to operate as a server.
.Pp
-Unless otherwise specified, four servers for
+Unless otherwise specified, eight servers per CPU for
.Tn UDP
transport are started.
.Pp
diff --git a/usr.sbin/ngctl/Makefile b/usr.sbin/ngctl/Makefile
index a1d1e6b375c8..cf72f39a6644 100644
--- a/usr.sbin/ngctl/Makefile
+++ b/usr.sbin/ngctl/Makefile
@@ -22,8 +22,8 @@ LDADD= -lnetgraph
.if !defined(NGCTL_NO_LIBEDIT)
CFLAGS+= -DEDITLINE
-DPADD+= ${LIBPTHREAD} ${LIBEDIT} ${LIBTERMCAP}
-LDADD+= -lpthread -ledit -ltermcap
+DPADD+= ${LIBPTHREAD} ${LIBEDIT} ${LIBTERMCAPW}
+LDADD+= -lpthread -ledit -ltermcapw
.endif
.include <bsd.prog.mk>
diff --git a/usr.sbin/ngctl/Makefile.depend b/usr.sbin/ngctl/Makefile.depend
index 35c7a73c52d6..2e9e2ab5e978 100644
--- a/usr.sbin/ngctl/Makefile.depend
+++ b/usr.sbin/ngctl/Makefile.depend
@@ -13,7 +13,7 @@ DIRDEPS = \
lib/libedit \
lib/libnetgraph \
lib/libthr \
- lib/ncurses/ncurses \
+ lib/ncurses/ncursesw \
.include <dirdeps.mk>
diff --git a/usr.sbin/ngctl/ngctl.8 b/usr.sbin/ngctl/ngctl.8
index ce77069d3185..8ba9f5d2854d 100644
--- a/usr.sbin/ngctl/ngctl.8
+++ b/usr.sbin/ngctl/ngctl.8
@@ -138,4 +138,4 @@ a version of
.Fx 2.2
customized for the Whistle InterJet.
.Sh AUTHORS
-.An Archie Cobbs Aq archie@whistle.com
+.An Archie Cobbs Aq Mt archie@whistle.com
diff --git a/usr.sbin/nghook/nghook.8 b/usr.sbin/nghook/nghook.8
index 7d2c7fa5f5cc..651a6fad1bc0 100644
--- a/usr.sbin/nghook/nghook.8
+++ b/usr.sbin/nghook/nghook.8
@@ -135,7 +135,7 @@ in a version of
.Fx 2.2
customized for the Whistle InterJet.
.Sh AUTHORS
-.An Archie Cobbs Aq archie@whistle.com
+.An Archie Cobbs Aq Mt archie@whistle.com
.Sh BUGS
Although all input is read in unbuffered mode,
there is no way to control the packetization of the input.
diff --git a/usr.sbin/nmtree/Makefile b/usr.sbin/nmtree/Makefile
index 9d24c0c4f92f..e09f3c410feb 100644
--- a/usr.sbin/nmtree/Makefile
+++ b/usr.sbin/nmtree/Makefile
@@ -23,4 +23,6 @@ LDADD+= ${LIBNETBSD}
LINKS= ${BINDIR}/mtree ${BINDIR}/nmtree
MLINKS= mtree.8 nmtree.8
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/nscd/nscd.8 b/usr.sbin/nscd/nscd.8
index 7e19af93cd5b..f54c18582ee3 100644
--- a/usr.sbin/nscd/nscd.8
+++ b/usr.sbin/nscd/nscd.8
@@ -159,7 +159,7 @@ The default configuration file.
.Xr nscd.conf 5 ,
.Xr nsswitch.conf 5
.Sh AUTHORS
-.An Michael Bushkov Aq bushman@FreeBSD.org
+.An Michael Bushkov Aq Mt bushman@FreeBSD.org
.Sh BUGS
Please send bug reports and suggestions to
-.Aq bushman@FreeBSD.org .
+.Aq Mt bushman@FreeBSD.org .
diff --git a/usr.sbin/nscd/nscd.conf.5 b/usr.sbin/nscd/nscd.conf.5
index b59449b11157..eb28eca7db2f 100644
--- a/usr.sbin/nscd/nscd.conf.5
+++ b/usr.sbin/nscd/nscd.conf.5
@@ -152,8 +152,7 @@ symbol at the beginning of the line for comments.
.Sh SEE ALSO
.Xr nscd 8
.Sh AUTHORS
-.An Michael Bushkov
-.Aq bushman@FreeBSD.org
+.An Michael Bushkov Aq Mt bushman@FreeBSD.org
.Sh BUGS
Please send bug reports and suggestions to
-.Aq bushman@FreeBSD.org .
+.Aq Mt bushman@FreeBSD.org .
diff --git a/usr.sbin/ntp/config.h b/usr.sbin/ntp/config.h
index 41622f10c862..d4b3685f471a 100644
--- a/usr.sbin/ntp/config.h
+++ b/usr.sbin/ntp/config.h
@@ -1176,7 +1176,7 @@
/* #undef SCO5_CLOCK */
/* The size of a `char*', as computed by sizeof. */
-#if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) || defined(__amd64__)
+#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
#define SIZEOF_CHARP 8
#else
#define SIZEOF_CHARP 4
@@ -1186,7 +1186,7 @@
#define SIZEOF_INT 4
/* The size of a `long', as computed by sizeof. */
-#if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) || defined(__amd64__)
+#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
#define SIZEOF_LONG 8
#else
#define SIZEOF_LONG 4
@@ -1199,7 +1199,7 @@
#define SIZEOF_SIGNED_CHAR 1
/* The size of a `time_t', as computed by sizeof. */
-#if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) || defined(__amd64__)
+#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
#define SIZEOF_TIME_T 8
#else
#define SIZEOF_TIME_T 4
@@ -1227,8 +1227,6 @@
#define STR_SYSTEM "sparc64-undermydesk-freebsd"
#elif defined(__amd64__)
#define STR_SYSTEM "amd64-undermydesk-freebsd"
-#elif defined(__ia64__)
-#define STR_SYSTEM "ia64-undermydesk-freebsd"
#else
#define STR_SYSTEM "i386-undermydesk-freebsd"
#endif
diff --git a/usr.sbin/ntp/ntp-keygen/Makefile b/usr.sbin/ntp/ntp-keygen/Makefile
index fea148cb076c..50753508461d 100644
--- a/usr.sbin/ntp/ntp-keygen/Makefile
+++ b/usr.sbin/ntp/ntp-keygen/Makefile
@@ -16,9 +16,11 @@ CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../ \
DPADD= ${LIBNTP} ${LIBOPTS}
LDADD= ${LIBNTP} ${LIBOPTS}
-.if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH)
+.if ${MK_OPENSSL} != "no"
DPADD+= ${LIBMD} ${LIBCRYPTO}
LDADD+= -lmd -lcrypto
.endif
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/ntp/ntpd/Makefile b/usr.sbin/ntp/ntpd/Makefile
index 53f537f71343..3422ad2ad0de 100644
--- a/usr.sbin/ntp/ntpd/Makefile
+++ b/usr.sbin/ntp/ntpd/Makefile
@@ -4,6 +4,8 @@ MAN=
.include <src.opts.mk>
+NO_PIE= yes
+
.PATH: ${.CURDIR}/../../../contrib/ntp/ntpd
PROG= ntpd
@@ -35,7 +37,7 @@ CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../ \
DPADD= ${LIBPARSE} ${LIBNTP} ${LIBM} ${LIBMD} ${LIBRT} ${LIBOPTS}
LDADD= ${LIBPARSE} ${LIBNTP} -lm -lmd -lrt ${LIBOPTS}
-.if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH)
+.if ${MK_OPENSSL} != "no"
DPADD+= ${LIBCRYPTO}
LDADD+= -lcrypto
.endif
diff --git a/usr.sbin/ntp/ntpd/Makefile.depend b/usr.sbin/ntp/ntpd/Makefile.depend
index d6638a0fc0e3..73ae1796648b 100644
--- a/usr.sbin/ntp/ntpd/Makefile.depend
+++ b/usr.sbin/ntp/ntpd/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.sbin/ntp/ntpdate/Makefile b/usr.sbin/ntp/ntpdate/Makefile
index f55ec92bc5d9..ea0fe1e4b2f8 100644
--- a/usr.sbin/ntp/ntpdate/Makefile
+++ b/usr.sbin/ntp/ntpdate/Makefile
@@ -13,6 +13,8 @@ LDADD= ${LIBNTP} -lm -lmd -lrt
CLEANFILES+= .version version.c
+NO_PIE= yes
+
version.c:
sh -e ${.CURDIR}/../scripts/mkver ntpdate
diff --git a/usr.sbin/ntp/ntpdate/Makefile.depend b/usr.sbin/ntp/ntpdate/Makefile.depend
index 8dabf4f76a44..0701136fa0f2 100644
--- a/usr.sbin/ntp/ntpdate/Makefile.depend
+++ b/usr.sbin/ntp/ntpdate/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.sbin/ntp/ntpdc/Makefile b/usr.sbin/ntp/ntpdc/Makefile
index 81d2671078af..e4e8960982d4 100644
--- a/usr.sbin/ntp/ntpdc/Makefile
+++ b/usr.sbin/ntp/ntpdc/Makefile
@@ -15,13 +15,15 @@ CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../ \
DPADD= ${LIBNTP} ${LIBM} ${LIBMD} ${LIBOPTS}
LDADD= ${LIBNTP} -lm -lmd ${LIBOPTS}
-DPADD+= ${LIBEDIT} ${LIBTERMCAP}
-LDADD+= -ledit -ltermcap
+DPADD+= ${LIBEDIT} ${LIBTERMCAPW}
+LDADD+= -ledit -ltermcapw
CFLAGS+= -DHAVE_LIBEDIT -DHAVE_READLINE_READLINE_H \
-I${DESTDIR}/${INCLUDEDIR}/edit
CLEANFILES+= .version version.c
+NO_PIE= yes
+
version.c:
sh -e ${.CURDIR}/../scripts/mkver ntpdc
diff --git a/usr.sbin/ntp/ntpdc/Makefile.depend b/usr.sbin/ntp/ntpdc/Makefile.depend
index 799bdb767365..d3c16eb1539d 100644
--- a/usr.sbin/ntp/ntpdc/Makefile.depend
+++ b/usr.sbin/ntp/ntpdc/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
@@ -15,7 +16,7 @@ DIRDEPS = \
lib/libedit/edit/readline \
lib/libmd \
lib/msun \
- lib/ncurses/ncurses \
+ lib/ncurses/ncursesw \
secure/lib/libcrypto \
usr.sbin/ntp/libntp \
usr.sbin/ntp/libopts \
diff --git a/usr.sbin/ntp/ntpq/Makefile b/usr.sbin/ntp/ntpq/Makefile
index eb4297341d1c..a1ddcd4cd931 100644
--- a/usr.sbin/ntp/ntpq/Makefile
+++ b/usr.sbin/ntp/ntpq/Makefile
@@ -17,13 +17,15 @@ CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../ \
DPADD= ${LIBNTP} ${LIBM} ${LIBMD} ${LIBOPTS}
LDADD= ${LIBNTP} -lm -lmd ${LIBOPTS}
-DPADD+= ${LIBEDIT} ${LIBTERMCAP}
-LDADD+= -ledit -ltermcap
+DPADD+= ${LIBEDIT} ${LIBTERMCAPW}
+LDADD+= -ledit -ltermcapw
CFLAGS+= -DHAVE_LIBEDIT -DHAVE_READLINE_READLINE_H \
-I${DESTDIR}/${INCLUDEDIR}/edit
CLEANFILES+= .version version.c
+NO_PIE= yes
+
version.c:
sh -e ${.CURDIR}/../scripts/mkver ntpq
diff --git a/usr.sbin/ntp/ntpq/Makefile.depend b/usr.sbin/ntp/ntpq/Makefile.depend
index 799bdb767365..d3c16eb1539d 100644
--- a/usr.sbin/ntp/ntpq/Makefile.depend
+++ b/usr.sbin/ntp/ntpq/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
@@ -15,7 +16,7 @@ DIRDEPS = \
lib/libedit/edit/readline \
lib/libmd \
lib/msun \
- lib/ncurses/ncurses \
+ lib/ncurses/ncursesw \
secure/lib/libcrypto \
usr.sbin/ntp/libntp \
usr.sbin/ntp/libopts \
diff --git a/usr.sbin/ntp/ntptime/Makefile b/usr.sbin/ntp/ntptime/Makefile
index d3bf7a74cfd9..af3f9051e875 100644
--- a/usr.sbin/ntp/ntptime/Makefile
+++ b/usr.sbin/ntp/ntptime/Makefile
@@ -10,4 +10,6 @@ CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../
DPADD= ${LIBNTP}
LDADD= ${LIBNTP}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/nvram/nvram.8 b/usr.sbin/nvram/nvram.8
index 5c41a41454dd..ffc005e4364f 100644
--- a/usr.sbin/nvram/nvram.8
+++ b/usr.sbin/nvram/nvram.8
@@ -110,7 +110,7 @@ Darwin/Mac OS X
.Nm
utility.
.Sh AUTHORS
-.An Maxim Sobolev Aq sobomax@FreeBSD.org
+.An Maxim Sobolev Aq Mt sobomax@FreeBSD.org
.Sh BUGS
Currently,
.Nm
diff --git a/usr.sbin/ofwdump/ofwdump.8 b/usr.sbin/ofwdump/ofwdump.8
index ad9cfa76890b..b21d87822a10 100644
--- a/usr.sbin/ofwdump/ofwdump.8
+++ b/usr.sbin/ofwdump/ofwdump.8
@@ -104,4 +104,4 @@ The
.Nm
utility
was written by
-.An Thomas Moestl Aq tmm@FreeBSD.org .
+.An Thomas Moestl Aq Mt tmm@FreeBSD.org .
diff --git a/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8 b/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8
index c3eef64d276f..bcc1f30c309e 100644
--- a/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8
+++ b/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8
@@ -112,7 +112,7 @@ This version of
first appeared in
.Fx 9.0 .
.Sh AUTHORS
-.An Kris Moore Aq kmoore@FreeBSD.org
+.An Kris Moore Aq Mt kmoore@FreeBSD.org
.Sh BUGS
This utility was written to install PC-BSD and has seen limited use as an
installer for FreeBSD. It's likely that usage to install FreeBSD will expose
diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c
index 0177dc98702f..12e83ec93380 100644
--- a/usr.sbin/pciconf/pciconf.c
+++ b/usr.sbin/pciconf/pciconf.c
@@ -466,6 +466,7 @@ static struct
{PCIC_BASEPERIPH, PCIS_BASEPERIPH_RTC, "realtime clock"},
{PCIC_BASEPERIPH, PCIS_BASEPERIPH_PCIHOT, "PCI hot-plug controller"},
{PCIC_BASEPERIPH, PCIS_BASEPERIPH_SDHC, "SD host controller"},
+ {PCIC_BASEPERIPH, PCIS_BASEPERIPH_IOMMU, "IOMMU"},
{PCIC_INPUTDEV, -1, "input device"},
{PCIC_INPUTDEV, PCIS_INPUTDEV_KEYBOARD, "keyboard"},
{PCIC_INPUTDEV, PCIS_INPUTDEV_DIGITIZER,"digitizer"},
diff --git a/usr.sbin/periodic/periodic.8 b/usr.sbin/periodic/periodic.8
index 22a96a2a647d..175119de5a39 100644
--- a/usr.sbin/periodic/periodic.8
+++ b/usr.sbin/periodic/periodic.8
@@ -245,8 +245,8 @@ The
utility first appeared in
.Fx 3.0 .
.Sh AUTHORS
-.An Paul Traina Aq pst@FreeBSD.org
-.An Brian Somers Aq brian@Awfulhak.org
+.An Paul Traina Aq Mt pst@FreeBSD.org
+.An Brian Somers Aq Mt brian@Awfulhak.org
.Sh BUGS
Since one specifies information about a directory using shell
variables containing the string,
diff --git a/usr.sbin/pkg/elf_tables.h b/usr.sbin/pkg/elf_tables.h
index 0589ecf9425e..55fd3bbd2e95 100644
--- a/usr.sbin/pkg/elf_tables.h
+++ b/usr.sbin/pkg/elf_tables.h
@@ -42,7 +42,6 @@ static struct _elf_corres mach_corres[] = {
{ EM_PPC, "powerpc" },
{ EM_PPC64, "powerpc" },
{ EM_SPARCV9, "sparc64" },
- { EM_IA_64, "ia64" },
{ -1, NULL },
};
diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c
index 1b1a01cf60eb..8f26c611e016 100644
--- a/usr.sbin/pkg/pkg.c
+++ b/usr.sbin/pkg/pkg.c
@@ -126,7 +126,8 @@ extract_pkg_static(int fd, char *p, int sz)
if (r == ARCHIVE_OK)
ret = 0;
else
- warnx("fail to extract pkg-static");
+ warnx("failed to extract pkg-static: %s",
+ archive_error_string(a));
cleanup:
archive_read_free(a);
diff --git a/usr.sbin/pmcannotate/pmcannotate.8 b/usr.sbin/pmcannotate/pmcannotate.8
index 8f791c15cc9d..08967d9d7bf9 100644
--- a/usr.sbin/pmcannotate/pmcannotate.8
+++ b/usr.sbin/pmcannotate/pmcannotate.8
@@ -106,4 +106,4 @@ of interest.
.Xr objdump 1 ,
.Xr pmcstat 8
.Sh AUTHORS
-.An Attilio Rao Aq attilio@FreeBSD.org
+.An Attilio Rao Aq Mt attilio@FreeBSD.org
diff --git a/usr.sbin/pmcannotate/pmcannotate.c b/usr.sbin/pmcannotate/pmcannotate.c
index 374290fde22e..b22d0dc82787 100644
--- a/usr.sbin/pmcannotate/pmcannotate.c
+++ b/usr.sbin/pmcannotate/pmcannotate.c
@@ -41,8 +41,9 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
-#define FNBUFF 161
-#define LNBUFF 161
+/* NB: Make sure FNBUFF is as large as LNBUFF, otherwise it could overflow */
+#define FNBUFF 512
+#define LNBUFF 512
#define TMPPATH "/tmp/pmcannotate.XXXXXX"
diff --git a/usr.sbin/pmccontrol/pmccontrol.8 b/usr.sbin/pmccontrol/pmccontrol.8
index f436753dd372..a5b6baa2874f 100644
--- a/usr.sbin/pmccontrol/pmccontrol.8
+++ b/usr.sbin/pmccontrol/pmccontrol.8
@@ -124,4 +124,4 @@ The
utility first appeared in
.Fx 6.0 .
.Sh AUTHORS
-.An Joseph Koshy Aq jkoshy@FreeBSD.org
+.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org
diff --git a/usr.sbin/pmcstat/Makefile b/usr.sbin/pmcstat/Makefile
index b8c8081b6f61..78cde444948e 100644
--- a/usr.sbin/pmcstat/Makefile
+++ b/usr.sbin/pmcstat/Makefile
@@ -5,8 +5,8 @@
PROG= pmcstat
MAN= pmcstat.8
-DPADD= ${LIBELF} ${LIBKVM} ${LIBPMC} ${LIBM} ${LIBNCURSES}
-LDADD= -lelf -lkvm -lpmc -lm -lncurses
+DPADD= ${LIBELF} ${LIBKVM} ${LIBPMC} ${LIBM} ${LIBNCURSESW}
+LDADD= -lelf -lkvm -lpmc -lm -lncursesw
SRCS= pmcstat.c pmcstat.h pmcstat_log.c \
pmcpl_callgraph.c pmcpl_gprof.c pmcpl_annotate.c \
diff --git a/usr.sbin/pmcstat/Makefile.depend b/usr.sbin/pmcstat/Makefile.depend
index 063d52f4ddc5..f382224b173e 100644
--- a/usr.sbin/pmcstat/Makefile.depend
+++ b/usr.sbin/pmcstat/Makefile.depend
@@ -14,7 +14,6 @@ DIRDEPS = \
lib/libkvm \
lib/libpmc \
lib/msun \
- lib/ncurses/ncurses \
lib/ncurses/ncursesw \
diff --git a/usr.sbin/pmcstat/pmcstat.8 b/usr.sbin/pmcstat/pmcstat.8
index 97a2f626ca6d..6662d43c21d9 100644
--- a/usr.sbin/pmcstat/pmcstat.8
+++ b/usr.sbin/pmcstat/pmcstat.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 29, 2014
+.Dd May 16, 2014
.Dt PMCSTAT 8
.Os
.Sh NAME
@@ -52,6 +52,7 @@
.Op Fl f Ar pluginopt
.Op Fl g
.Op Fl k Ar kerneldir
+.Op Fl l Ar secs
.Op Fl m Ar pathname
.Op Fl n Ar rate
.Op Fl o Ar outputfile
@@ -274,6 +275,13 @@ This directory specifies where
should look for the kernel and its modules.
The default is
.Pa /boot/kernel .
+.It Fl l Ar secs
+Set system-wide performance measurement duration for
+.Ar secs
+seconds.
+The argument
+.Ar secs
+may be a fractional value.
.It Fl m Ar pathname
Print the sampled PCs with the name, the start and ending addresses
of the function within they live.
@@ -463,7 +471,7 @@ utility first appeared in
It is
.Ud
.Sh AUTHORS
-.An Joseph Koshy Aq jkoshy@FreeBSD.org
+.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org
.Sh BUGS
The
.Nm
diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c
index ae93b9387da2..a045706dda13 100644
--- a/usr.sbin/pmcstat/pmcstat.c
+++ b/usr.sbin/pmcstat/pmcstat.c
@@ -509,6 +509,7 @@ pmcstat_show_usage(void)
"\t -f spec\t pass \"spec\" to as plugin option\n"
"\t -g\t\t produce gprof(1) compatible profiles\n"
"\t -k dir\t\t set the path to the kernel\n"
+ "\t -l secs\t set duration time\n"
"\t -m file\t print sampled PCs to \"file\"\n"
"\t -n rate\t set sampling rate\n"
"\t -o file\t send print output to \"file\"\n"
@@ -551,6 +552,7 @@ main(int argc, char **argv)
{
cpuset_t cpumask;
double interval;
+ double duration;
int hcpu, option, npmc, ncpu;
int c, check_driver_stats, current_sampling_count;
int do_callchain, do_descendants, do_logproccsw, do_logprocexit;
@@ -600,6 +602,7 @@ main(int argc, char **argv)
args.pa_toptty = 0;
args.pa_topcolor = 0;
args.pa_mergepmc = 0;
+ args.pa_duration = 0.0;
STAILQ_INIT(&args.pa_events);
SLIST_INIT(&args.pa_targets);
bzero(&ds_start, sizeof(ds_start));
@@ -618,7 +621,7 @@ main(int argc, char **argv)
CPU_SET(hcpu, &cpumask);
while ((option = getopt(argc, argv,
- "CD:EF:G:M:NO:P:R:S:TWa:c:df:gk:m:n:o:p:qr:s:t:vw:z:")) != -1)
+ "CD:EF:G:M:NO:P:R:S:TWa:c:df:gk:l:m:n:o:p:qr:s:t:vw:z:")) != -1)
switch (option) {
case 'a': /* Annotate + callgraph */
args.pa_flags |= FLAG_DO_ANNOTATE;
@@ -692,6 +695,15 @@ main(int argc, char **argv)
args.pa_flags |= FLAG_HAS_KERNELPATH;
break;
+ case 'l': /* time duration in seconds */
+ duration = strtod(optarg, &end);
+ if (*end != '\0' || duration <= 0)
+ errx(EX_USAGE, "ERROR: Illegal duration time "
+ "value \"%s\".", optarg);
+ args.pa_flags |= FLAG_HAS_DURATION;
+ args.pa_duration = duration;
+ break;
+
case 'm':
args.pa_flags |= FLAG_DO_ANNOTATE;
args.pa_plugin = PMCSTAT_PL_ANNOTATE;
@@ -922,6 +934,12 @@ main(int argc, char **argv)
errx(EX_USAGE,
"ERROR: options -O and -R are mutually exclusive.");
+ /* disallow -T and -l together */
+ if ((args.pa_flags & FLAG_HAS_DURATION) &&
+ (args.pa_flags & FLAG_DO_TOP))
+ errx(EX_USAGE, "ERROR: options -T and -l are mutually "
+ "exclusive.");
+
/* -m option is allowed with -R only. */
if (args.pa_flags & FLAG_DO_ANNOTATE && args.pa_inputpath == NULL)
errx(EX_USAGE, "ERROR: option %s requires an input file",
@@ -1279,6 +1297,20 @@ main(int argc, char **argv)
"ERROR: Cannot register kevent for timer");
}
+ /*
+ * Setup a duration timer if we have sampling mode PMCs and
+ * a duration time is set
+ */
+ if ((args.pa_flags & FLAG_HAS_SAMPLING_PMCS) &&
+ (args.pa_flags & FLAG_HAS_DURATION)) {
+ EV_SET(&kev, 0, EVFILT_TIMER, EV_ADD, 0,
+ args.pa_duration * 1000, NULL);
+
+ if (kevent(pmcstat_kq, &kev, 1, NULL, 0, NULL) < 0)
+ err(EX_OSERR, "ERROR: Cannot register kevent for "
+ "time duration");
+ }
+
/* attach PMCs to the target process, starting it if specified */
if (args.pa_flags & FLAG_HAS_COMMANDLINE)
pmcstat_create_process();
@@ -1355,7 +1387,7 @@ main(int argc, char **argv)
/*
* loop till either the target process (if any) exits, or we
- * are killed by a SIGINT.
+ * are killed by a SIGINT or we reached the time duration.
*/
runstate = PMCSTAT_RUNNING;
do_print = do_read = 0;
@@ -1422,7 +1454,13 @@ main(int argc, char **argv)
break;
- case EVFILT_TIMER: /* print out counting PMCs */
+ case EVFILT_TIMER:
+ /* time duration reached, exit */
+ if (args.pa_flags & FLAG_HAS_DURATION) {
+ runstate = PMCSTAT_FINISHED;
+ break;
+ }
+ /* print out counting PMCs */
if ((args.pa_flags & FLAG_DO_TOP) &&
pmc_flush_logfile() == 0)
do_read = 1;
diff --git a/usr.sbin/pmcstat/pmcstat.h b/usr.sbin/pmcstat/pmcstat.h
index c8ec14de19c9..29dfeb790fa2 100644
--- a/usr.sbin/pmcstat/pmcstat.h
+++ b/usr.sbin/pmcstat/pmcstat.h
@@ -54,13 +54,14 @@
#define FLAG_DO_TOP 0x00010000 /* -T */
#define FLAG_DO_ANALYSIS 0x00020000 /* -g or -G or -m or -T */
#define FLAGS_HAS_CPUMASK 0x00040000 /* -c */
+#define FLAG_HAS_DURATION 0x00080000 /* -l secs */
#define DEFAULT_SAMPLE_COUNT 65536
#define DEFAULT_WAIT_INTERVAL 5.0
#define DEFAULT_DISPLAY_HEIGHT 256 /* file virtual height */
#define DEFAULT_DISPLAY_WIDTH 1024 /* file virtual width */
#define DEFAULT_BUFFER_SIZE 4096
-#define DEFAULT_CALLGRAPH_DEPTH 4
+#define DEFAULT_CALLGRAPH_DEPTH 16
#define PRINT_HEADER_PREFIX "# "
#define READPIPEFD 0
@@ -149,6 +150,7 @@ struct pmcstat_args {
int pa_toptty; /* output to tty or file */
int pa_topcolor; /* terminal support color */
int pa_mergepmc; /* merge PMC with same name */
+ double pa_duration; /* time duration */
int pa_argc;
char **pa_argv;
STAILQ_HEAD(, pmcstat_ev) pa_events;
diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c
index f0e493959acb..40de320f17a1 100644
--- a/usr.sbin/pmcstat/pmcstat_log.c
+++ b/usr.sbin/pmcstat/pmcstat_log.c
@@ -307,10 +307,10 @@ pmcstat_stats_reset(int reset_global)
static int
pmcstat_string_compute_hash(const char *s)
{
- int hash;
+ unsigned hash;
- for (hash = 0; *s; s++)
- hash ^= *s;
+ for (hash = 2166136261; *s; s++)
+ hash = (hash ^ *s) * 16777619;
return (hash & PMCSTAT_HASH_MASK);
}
diff --git a/usr.sbin/portsnap/portsnap/portsnap.8 b/usr.sbin/portsnap/portsnap/portsnap.8
index 0e9bd7efce3e..db215f184332 100644
--- a/usr.sbin/portsnap/portsnap/portsnap.8
+++ b/usr.sbin/portsnap/portsnap/portsnap.8
@@ -274,4 +274,4 @@ Default location where the ports tree is extracted.
.Xr fetch 3 ,
.Xr portsnap.conf 5
.Sh AUTHORS
-.An Colin Percival Aq cperciva@FreeBSD.org
+.An Colin Percival Aq Mt cperciva@FreeBSD.org
diff --git a/usr.sbin/ppp/Makefile b/usr.sbin/ppp/Makefile
index a61ebf57501e..beea0ab6600f 100644
--- a/usr.sbin/ppp/Makefile
+++ b/usr.sbin/ppp/Makefile
@@ -76,8 +76,7 @@ CFLAGS+=-DNOSUID
SRCS+= id.c
.endif
-.if defined(RELEASE_CRUNCH) || ${MK_OPENSSL} == "no" || \
- defined(PPP_NO_DES)
+.if ${MK_OPENSSL} == "no" || defined(PPP_NO_DES)
CFLAGS+=-DNODES
.else
SRCS+= chap_ms.c mppe.c
diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8
index c4ebe501c725..59eeaed23d33 100644
--- a/usr.sbin/ppp/ppp.8
+++ b/usr.sbin/ppp/ppp.8
@@ -6061,14 +6061,14 @@ This socket is used to pass links between different instances of
.Xr vipw 8
.Sh HISTORY
This program was originally written by
-.An Toshiharu OHNO Aq tony-o@iij.ad.jp ,
+.An Toshiharu OHNO Aq Mt tony-o@iij.ad.jp ,
and was submitted to
.Fx 2.0.5
by
-.An Atsushi Murai Aq amurai@spec.co.jp .
+.An Atsushi Murai Aq Mt amurai@spec.co.jp .
.Pp
It was substantially modified during 1997 by
-.An Brian Somers Aq brian@Awfulhak.org ,
+.An Brian Somers Aq Mt brian@Awfulhak.org ,
and was ported to
.Ox
in November that year
diff --git a/usr.sbin/pppctl/Makefile b/usr.sbin/pppctl/Makefile
index 2f2be4bb5035..4a03b86ad48a 100644
--- a/usr.sbin/pppctl/Makefile
+++ b/usr.sbin/pppctl/Makefile
@@ -5,7 +5,7 @@ MAN= pppctl.8
WARNS?= 2
-DPADD= ${LIBPTHREAD} ${LIBEDIT} ${LIBTERMCAP}
-LDADD= -lpthread -ledit -ltermcap
+DPADD= ${LIBPTHREAD} ${LIBEDIT} ${LIBTERMCAPW}
+LDADD= -lpthread -ledit -ltermcapw
.include <bsd.prog.mk>
diff --git a/usr.sbin/pppctl/Makefile.depend b/usr.sbin/pppctl/Makefile.depend
index 8c91260ab083..17daa8577fad 100644
--- a/usr.sbin/pppctl/Makefile.depend
+++ b/usr.sbin/pppctl/Makefile.depend
@@ -13,7 +13,7 @@ DIRDEPS = \
lib/libcompiler_rt \
lib/libedit \
lib/libthr \
- lib/ncurses/ncurses \
+ lib/ncurses/ncursesw \
.include <dirdeps.mk>
diff --git a/usr.sbin/praliases/Makefile b/usr.sbin/praliases/Makefile
index 120028d6997b..e1a9a2a79384 100644
--- a/usr.sbin/praliases/Makefile
+++ b/usr.sbin/praliases/Makefile
@@ -34,6 +34,8 @@ LDFLAGS+=${SENDMAIL_LDFLAGS}
DPADD+= ${SENDMAIL_DPADD}
LDADD+= ${SENDMAIL_LDADD}
+NO_PIE= yes
+
sm_os.h:
ln -sf ${SENDMAIL_DIR}/include/sm/os/sm_os_freebsd.h sm_os.h
diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c
index 4b3f55007f6b..36c5d9df527c 100644
--- a/usr.sbin/pw/pw_user.c
+++ b/usr.sbin/pw/pw_user.c
@@ -438,14 +438,13 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
delgrent(GETGRNAM(a_name->val));
SETGRENT();
while ((grp = GETGRENT()) != NULL) {
- int i;
+ int i, j;
char group[MAXLOGNAME];
if (grp->gr_mem != NULL) {
for (i = 0; grp->gr_mem[i] != NULL; i++) {
if (!strcmp(grp->gr_mem[i], a_name->val)) {
- while (grp->gr_mem[i] != NULL) {
- grp->gr_mem[i] = grp->gr_mem[i+1];
- }
+ for (j = i; grp->gr_mem[j] != NULL; j++)
+ grp->gr_mem[j] = grp->gr_mem[j+1];
strlcpy(group, grp->gr_name, MAXLOGNAME);
chggrent(group, grp);
}
diff --git a/usr.sbin/pw/pwupd.c b/usr.sbin/pw/pwupd.c
index 22662dbd0b34..c2a9a535ec45 100644
--- a/usr.sbin/pw/pwupd.c
+++ b/usr.sbin/pw/pwupd.c
@@ -45,9 +45,6 @@ static const char rcsid[] =
#include "pwupd.h"
-#define HAVE_PWDB_C 1
-#define HAVE_PWDB_U 1
-
static char pathpwd[] = _PATH_PWD;
static char * pwpath = pathpwd;
@@ -112,22 +109,14 @@ pw_update(struct passwd * pwd, char const * user)
{
int rc = 0;
- /*
- * First, let's check the see if the database is alright
- * Note: -C is only available in FreeBSD 2.2 and above
- */
-#ifdef HAVE_PWDB_C
rc = pwdb("-C", (char *)NULL); /* Check only */
if (rc == 0) {
-#else
- { /* No -C */
-#endif
int pfd, tfd;
struct passwd *pw = NULL;
struct passwd *old_pw = NULL;
- if (pwd != NULL)
- pw = pw_dup(pwd);
+ if (pwd != NULL)
+ pw = pw_dup(pwd);
if (user != NULL)
old_pw = GETPWNAM(user);
@@ -150,7 +139,7 @@ pw_update(struct passwd * pwd, char const * user)
* in case of deletion of a user, the whole database
* needs to be regenerated
*/
- if (pw_mkdb(pw != NULL ? user : NULL) == -1) {
+ if (pw_mkdb(pw != NULL ? pw->pw_name : NULL) == -1) {
pw_fini();
err(1, "pw_mkdb()");
}
diff --git a/usr.sbin/rarpd/rarpd.8 b/usr.sbin/rarpd/rarpd.8
index 3c75de0032fa..4b00c9e7b83a 100644
--- a/usr.sbin/rarpd/rarpd.8
+++ b/usr.sbin/rarpd/rarpd.8
@@ -141,9 +141,9 @@ Enable verbose syslogging.
.Re
.Sh AUTHORS
.An -nosplit
-.An Craig Leres Aq leres@ee.lbl.gov
+.An Craig Leres Aq Mt leres@ee.lbl.gov
and
-.An Steven McCanne Aq mccanne@ee.lbl.gov .
+.An Steven McCanne Aq Mt mccanne@ee.lbl.gov .
Lawrence Berkeley Laboratory, University of California, Berkeley, CA.
.Sh BUGS
The
diff --git a/usr.sbin/rpc.umntall/rpc.umntall.8 b/usr.sbin/rpc.umntall/rpc.umntall.8
index 623663575532..7f294a0457d3 100644
--- a/usr.sbin/rpc.umntall/rpc.umntall.8
+++ b/usr.sbin/rpc.umntall/rpc.umntall.8
@@ -123,4 +123,4 @@ The
utility first appeared in
.Fx 4.0 .
.Sh AUTHORS
-.An Martin Blapp Aq mb@imp.ch
+.An Martin Blapp Aq Mt mb@imp.ch
diff --git a/usr.sbin/rpc.yppasswdd/rpc.yppasswdd.8 b/usr.sbin/rpc.yppasswdd/rpc.yppasswdd.8
index 376390866a84..3d0b48664ba6 100644
--- a/usr.sbin/rpc.yppasswdd/rpc.yppasswdd.8
+++ b/usr.sbin/rpc.yppasswdd/rpc.yppasswdd.8
@@ -335,7 +335,7 @@ The template password file(s) for non-default domains
.Xr ypserv 8 ,
.Xr ypxfr 8
.Sh AUTHORS
-.An Bill Paul Aq wpaul@ctr.columbia.edu
+.An Bill Paul Aq Mt wpaul@ctr.columbia.edu
.Sh BUGS
As listed in the yppasswd.x protocol definition, the YPPASSWDPROC_UPDATE
procedure takes two arguments: a V7-style passwd structure containing
diff --git a/usr.sbin/rpc.ypxfrd/rpc.ypxfrd.8 b/usr.sbin/rpc.ypxfrd/rpc.ypxfrd.8
index ad0c03e04575..5a7f8dab24b9 100644
--- a/usr.sbin/rpc.ypxfrd/rpc.ypxfrd.8
+++ b/usr.sbin/rpc.ypxfrd/rpc.ypxfrd.8
@@ -134,7 +134,7 @@ The NIS maps for a particular NIS domain.
.Xr ypserv 8 ,
.Xr ypxfr 8
.Sh AUTHORS
-.An Bill Paul Aq wpaul@ctr.columbia.edu
+.An Bill Paul Aq Mt wpaul@ctr.columbia.edu
.Sh BUGS
The
.Fx
diff --git a/usr.sbin/rtadvctl/rtadvctl.8 b/usr.sbin/rtadvctl/rtadvctl.8
index be3eefea7c54..5df6e5cc2349 100644
--- a/usr.sbin/rtadvctl/rtadvctl.8
+++ b/usr.sbin/rtadvctl/rtadvctl.8
@@ -102,4 +102,4 @@ command first appeared in
.Sh AUTHORS
.Nm
was written by
-.An "Hiroki Sato" Aq hrs@FreeBSD.org .
+.An Hiroki Sato Aq Mt hrs@FreeBSD.org .
diff --git a/usr.sbin/rtprio/rtprio.1 b/usr.sbin/rtprio/rtprio.1
index 22d064513a82..85130c87f7e0 100644
--- a/usr.sbin/rtprio/rtprio.1
+++ b/usr.sbin/rtprio/rtprio.1
@@ -171,7 +171,7 @@ utility appeared in
but is similar to the HP-UX version.
.Sh AUTHORS
.An -nosplit
-.An Henrik Vestergaard Draboel Aq hvd@terry.ping.dk
+.An Henrik Vestergaard Draboel Aq Mt hvd@terry.ping.dk
is the original author.
This
implementation in
diff --git a/usr.sbin/rwhod/rwhod.c b/usr.sbin/rwhod/rwhod.c
index 30a4ae857d2c..ed45fe9aa0b5 100644
--- a/usr.sbin/rwhod/rwhod.c
+++ b/usr.sbin/rwhod/rwhod.c
@@ -488,7 +488,6 @@ sender_process(void)
for (we = mywd.wd_we; we < wend; we++) {
if (stat(we->we_utmp.out_line, &stb) >= 0)
we->we_idle = htonl(now - stb.st_atime);
- we++;
}
(void) getloadavg(avenrun,
sizeof(avenrun) / sizeof(avenrun[0]));
diff --git a/usr.sbin/sa/sa.8 b/usr.sbin/sa/sa.8
index 56c6994dc516..1b66ac2a12e9 100644
--- a/usr.sbin/sa/sa.8
+++ b/usr.sbin/sa/sa.8
@@ -235,7 +235,7 @@ per-user accounting summary database
.Xr ac 8 ,
.Xr accton 8
.Sh AUTHORS
-.An Chris G. Demetriou Aq cgd@postgres.berkeley.edu
+.An Chris G. Demetriou Aq Mt cgd@postgres.berkeley.edu
.Sh CAVEATS
While the behavior of the options in this version of
.Nm
diff --git a/usr.sbin/sendmail/Makefile b/usr.sbin/sendmail/Makefile
index f8a910bc1844..ffd22bd06a3b 100644
--- a/usr.sbin/sendmail/Makefile
+++ b/usr.sbin/sendmail/Makefile
@@ -7,6 +7,8 @@ SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail
SMDIR= ${SENDMAIL_DIR}/src
.PATH: ${SMDIR}
+NO_PIE= yes
+
BINDIR= /usr/libexec/sendmail
PROG= sendmail
@@ -60,7 +62,7 @@ LDADD+= ${LIBSMUTIL} ${LIBSM}
SRCS+= sm_os.h
CLEANFILES+=sm_os.h
-.if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH)
+.if ${MK_OPENSSL} != "no"
# STARTTLS support
CFLAGS+= -DSTARTTLS -D_FFR_TLS_1
DPADD+= ${LIBSSL} ${LIBCRYPTO}
diff --git a/usr.sbin/service/service.8 b/usr.sbin/service/service.8
index 0c2b2d30c912..81d24a035c4a 100644
--- a/usr.sbin/service/service.8
+++ b/usr.sbin/service/service.8
@@ -132,4 +132,4 @@ utility first appeared in
.Sh AUTHORS
This
manual page was written by
-.An Douglas Barton <dougb@FreeBSD.org> .
+.An Douglas Barton Aq Mt dougb@FreeBSD.org .
diff --git a/usr.sbin/service/service.sh b/usr.sbin/service/service.sh
index 8c12b8984a7c..b5fd60750d61 100755
--- a/usr.sbin/service/service.sh
+++ b/usr.sbin/service/service.sh
@@ -109,7 +109,7 @@ fi
if [ -n "$LIST" ]; then
for dir in /etc/rc.d $local_startup; do
[ -n "$VERBOSE" ] && echo "From ${dir}:"
- cd $dir && for file in *; do echo $file; done
+ [ -d ${dir} ] && /bin/ls -1 ${dir}
done
exit 0
fi
diff --git a/usr.sbin/sicontrol/sicontrol.8 b/usr.sbin/sicontrol/sicontrol.8
index a3aa87a191a8..1503591ecf51 100644
--- a/usr.sbin/sicontrol/sicontrol.8
+++ b/usr.sbin/sicontrol/sicontrol.8
@@ -99,11 +99,11 @@ The
utility is loosely based on a utility called
.Nm siconfig
which was written by
-.An Andy Rutter Aq andy@acronym.co.uk
+.An Andy Rutter Aq Mt andy@acronym.co.uk .
.Pp
Specialix International do not support this device driver in any way.
.Sh AUTHORS
-.An Peter Wemm Aq peter@FreeBSD.org
+.An Peter Wemm Aq Mt peter@FreeBSD.org
.Sh BUGS
Bound to be many...
:-)
diff --git a/usr.sbin/snapinfo/snapinfo.8 b/usr.sbin/snapinfo/snapinfo.8
index a7857fca8b47..010291ecb2c7 100644
--- a/usr.sbin/snapinfo/snapinfo.8
+++ b/usr.sbin/snapinfo/snapinfo.8
@@ -63,4 +63,4 @@ The
utility first appeared in
.Fx 6.1 .
.Sh AUTHORS
-.An Mark Santcroos Aq marks@FreeBSD.org
+.An Mark Santcroos Aq Mt marks@FreeBSD.org
diff --git a/usr.sbin/sysrc/sysrc b/usr.sbin/sysrc/sysrc
index bc603b1c6998..f37a496aecad 100644
--- a/usr.sbin/sysrc/sysrc
+++ b/usr.sbin/sysrc/sysrc
@@ -1,6 +1,6 @@
#!/bin/sh
#-
-# Copyright (c) 2010-2013 Devin Teske
+# Copyright (c) 2010-2014 Devin Teske
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ BSDCFG_SHARE="/usr/share/bsdconfig"
#
# Version information
#
-SYSRC_VERSION="6.0 Nov-07,2013"
+SYSRC_VERSION="6.1 Jul-18,2014"
#
# Options
@@ -102,7 +102,7 @@ help()
f_err "$optfmt" "-A" \
"Dump a list of all configuration variables (incl. defaults)."
f_err "$optfmt" "-c" \
- "Check. Return success if no changes needed, else error."
+ "Check. Return success if set or no changes, else error."
f_err "$optfmt" "-d" \
"Print a description of the given variable."
f_err "$optfmt" "-D" \
@@ -134,7 +134,7 @@ help()
f_err "$optfmt" "-N" \
"Show only variable names, not their values."
f_err "$optfmt" "-q" \
- "Quiet. Ignore previous \`-v' and/or SYSRC_VERBOSE."
+ "Quiet. Disable verbose and hide certain errors."
f_err "$optfmt" "-R dir" \
"Operate within the root directory \`dir' rather than \`/'."
f_err "$optfmt" "-v" \
@@ -152,8 +152,6 @@ help()
"Override default rc_conf_files (even if set to NULL)."
f_err "$envfmt" "RC_DEFAULTS" \
"Location of \`/etc/defaults/rc.conf' file."
- f_err "$envfmt" "SYSRC_VERBOSE" \
- "Default verbosity. Set to non-NULL to enable."
die
}
@@ -527,7 +525,7 @@ fi
#
# Process command-line arguments
#
-costatus=$SUCCESS
+status=$SUCCESS
while [ $# -gt 0 ]; do
NAME="${1%%=*}"
@@ -558,7 +556,7 @@ while [ $# -gt 0 ]; do
# desire to set some value
#
if [ "$DELETE" ]; then
- f_sysrc_delete "$NAME"
+ f_sysrc_delete "$NAME" || status=$FAILURE
shift 1
continue
fi
@@ -568,10 +566,23 @@ while [ $# -gt 0 ]; do
#
if [ "$CHECK_ONLY" ]; then
if ! IGNORED=$( f_sysrc_get "$NAME?" ); then
- costatus=$FAILURE
- else
- value=$( f_sysrc_get "$NAME" )
- [ "$value" = "${1#*=}" ] || costatus=$FAILURE
+ status=$FAILURE
+ [ "$SYSRC_VERBOSE" ] &&
+ echo "$NAME: not currently set"
+ shift 1
+ continue
+ fi
+ value=$( f_sysrc_get "$NAME" )
+ if [ "$value" != "${1#*=}" ]; then
+ status=$FAILURE
+ if [ "$SYSRC_VERBOSE" ]; then
+ echo -n "$( f_sysrc_find "$NAME" ): "
+ echo -n "$NAME: would change from "
+ echo "\`$value' to \`${1#*=}'"
+ fi
+ elif [ "$SYSRC_VERBOSE" ]; then
+ echo -n "$( f_sysrc_find "$NAME" ): "
+ echo "$NAME: already set to \`$value'"
fi
shift 1
continue
@@ -604,10 +615,10 @@ while [ $# -gt 0 ]; do
;;
*)
if ! IGNORED=$( f_sysrc_get "$NAME?" ); then
- [ "$IGNORE_UNKNOWNS" ] ||
+ [ "$IGNORE_UNKNOWNS" -o "$QUIET" ] ||
echo "$pgm: unknown variable '$NAME'"
shift 1
- costatus=$FAILURE
+ status=$FAILURE
continue
fi
@@ -631,7 +642,7 @@ while [ $# -gt 0 ]; do
# If `-x' or `-X' is passed, delete the variable
#
if [ "$DELETE" ]; then
- f_sysrc_delete "$NAME"
+ f_sysrc_delete "$NAME" || status=$FAILURE
shift 1
continue
fi
@@ -667,7 +678,7 @@ while [ $# -gt 0 ]; do
shift 1
done
-[ ! "$CHECK_ONLY" ] || exit $costatus
+exit $status # $SUCCESS unless error occurred with either `-c' or `-x'
################################################################################
# END
diff --git a/usr.sbin/sysrc/sysrc.8 b/usr.sbin/sysrc/sysrc.8
index e3b873fee1a9..28d8de61e113 100644
--- a/usr.sbin/sysrc/sysrc.8
+++ b/usr.sbin/sysrc/sysrc.8
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2011-2013 Devin Teske
+.\" Copyright (c) 2011-2014 Devin Teske
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd Nov 20, 2013
+.Dd Jul 18, 2014
.Dt SYSRC 8
.Os
.Sh NAME
@@ -58,11 +58,14 @@ Dump a list of all non-default configuration variables.
Dump a list of all configuration variables
.Pq incl. defaults .
.It Fl c
-Check if the value will change when assigning a new value.
+Check only.
+For querying, return success if all requested variables are set
+.Pq even if NULL ,
+otherwise return error status.
+For assignments, return success if no changes are required, otherwise failure.
If verbose
.Pq see Dq Fl v
-prints a message stating whether a change would occur.
-Exits with success if no change is necessary, else returns error status.
+prints a message stating whether variables are set and/or changes are required.
.It Fl d
Print a description of the given variable.
.It Fl D
@@ -108,14 +111,12 @@ Show only variable values, not their names.
Show only variable names, not their values.
.It Fl q
Quiet.
-Ignore previous occurrences of
-.Fl v
-flag.
+Disable verbose and hide certain errors.
.It Fl R Ar dir
Operate within the root directory
-.Pq Sq Ar dir
+.Sq Ar dir
rather than
-.Pq Sq / .
+.Sq / .
.It Fl v
Verbose.
Print the pathname of the specific
@@ -127,13 +128,13 @@ Print version information to stdout and exit.
Remove variable(s) from specified file(s).
.El
.Pp
-This utility works similar to
+This utility has a similar syntax to
.Xr sysctl 8 .
It shares the `-e' and `-n' options
.Pq detailed above
and also has the same
.Ql name[=value]
-syntax for querying/setting configuration options.
+syntax for making queries/assignments.
.Pp
However, while
.Xr sysctl 8
@@ -301,8 +302,8 @@ A
utility first appeared in
.Fx 9.2 .
.Sh AUTHORS
-.An Devin Teske Aq dteske@FreeBSD.org
+.An Devin Teske Aq Mt dteske@FreeBSD.org
.Sh THANKS TO
Brandon Gooch, Garrett Cooper, Julian Elischer, Pawel Jakub Dawidek,
-Cyrille Lefevre, Ross West, Stefan Esser, Marco Steinbach, and Jilles Tjoelker
-for suggestions and help.
+Cyrille Lefevre, Ross West, Stefan Esser, Marco Steinbach, Jilles Tjoelker,
+Allan Jude, and Lars Engels for suggestions, help, and testing.
diff --git a/usr.sbin/tcpdrop/tcpdrop.8 b/usr.sbin/tcpdrop/tcpdrop.8
index 9649dec81419..61c3f372c762 100644
--- a/usr.sbin/tcpdrop/tcpdrop.8
+++ b/usr.sbin/tcpdrop/tcpdrop.8
@@ -93,5 +93,5 @@ port 22, the port used by
.Xr netstat 1 ,
.Xr sockstat 1
.Sh AUTHORS
-.An Markus Friedl Aq markus@openbsd.org
-.An Juli Mallett Aq jmallett@FreeBSD.org
+.An Markus Friedl Aq Mt markus@openbsd.org
+.An Juli Mallett Aq Mt jmallett@FreeBSD.org
diff --git a/usr.sbin/tcpdump/tcpdump/Makefile b/usr.sbin/tcpdump/tcpdump/Makefile
index 498287320737..fcaa13e3a354 100644
--- a/usr.sbin/tcpdump/tcpdump/Makefile
+++ b/usr.sbin/tcpdump/tcpdump/Makefile
@@ -167,7 +167,7 @@ DPADD+= ${LIBCAPSICUM} ${LIBNV}
LDADD+= -lcapsicum -lnv
CFLAGS+=-DHAVE_LIBCAPSICUM
.endif
-.if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH)
+.if ${MK_OPENSSL} != "no"
DPADD+= ${LIBCRYPTO}
LDADD+= -lcrypto
CFLAGS+= -I${DESTDIR}/usr/include/openssl
diff --git a/usr.sbin/tzsetup/Makefile b/usr.sbin/tzsetup/Makefile
index 5646b2acec04..4ef65331cc15 100644
--- a/usr.sbin/tzsetup/Makefile
+++ b/usr.sbin/tzsetup/Makefile
@@ -7,17 +7,7 @@ CFLAGS+= -I${.CURDIR}/../../contrib/dialog -I.
WARNS?= 3
-DPADD= ${LIBDIALOG} ${LIBM}
-LDADD= -ldialog -lm
-
-.include <src.opts.mk>
-
-.if ${MK_NCURSESW} == "no"
-DPADD+= ${LIBNCURSES}
-LDADD+= -lncurses
-.else
-DPADD+= ${LIBNCURSESW}
-LDADD+= -lncursesw
-.endif
+DPADD= ${LIBDIALOG} ${LIBNCURSESW} ${LIBM}
+LDADD= -ldialog -lncursesw -lm
.include <bsd.prog.mk>
diff --git a/usr.sbin/uhsoctl/uhsoctl.c b/usr.sbin/uhsoctl/uhsoctl.c
index 46a9d0aacf7a..21b62209aaad 100644
--- a/usr.sbin/uhsoctl/uhsoctl.c
+++ b/usr.sbin/uhsoctl/uhsoctl.c
@@ -601,7 +601,7 @@ at_cmd(struct ctx *ctx, const char *resp, resp_cb cb, resp_arg *ra, const char *
if (resp != NULL) {
l = strlen(resp);
#ifdef DEBUG
- fprintf(stderr, "SYNC_EXP: %s (%d)\n", resp, l);
+ fprintf(stderr, "SYNC_EXP: %s (%zu)\n", resp, l);
#endif
}
diff --git a/usr.sbin/unbound/local-setup/local-unbound-setup.sh b/usr.sbin/unbound/local-setup/local-unbound-setup.sh
index 99c93243553f..837cf9a19148 100755
--- a/usr.sbin/unbound/local-setup/local-unbound-setup.sh
+++ b/usr.sbin/unbound/local-setup/local-unbound-setup.sh
@@ -33,7 +33,9 @@
user=""
unbound_conf=""
forward_conf=""
+lanzones_conf=""
workdir=""
+confdir=""
chrootdir=""
anchor=""
pidfile=""
@@ -55,8 +57,10 @@ bkext=$(date "+%Y%m%d.%H%M%S")
set_defaults() {
: ${user:=unbound}
: ${workdir:=/var/unbound}
+ : ${confdir:=${workdir}/conf.d}
: ${unbound_conf:=${workdir}/unbound.conf}
: ${forward_conf:=${workdir}/forward.conf}
+ : ${lanzones_conf:=${workdir}/lan-zones.conf}
: ${anchor:=${workdir}/root.key}
: ${pidfile:=/var/run/local_unbound.pid}
: ${resolv_conf:=/etc/resolv.conf}
@@ -71,7 +75,8 @@ set_defaults() {
#
set_chrootdir() {
chrootdir="${workdir}"
- for file in "${unbound_conf}" "${forward_conf}" "${anchor}" ; do
+ for file in "${unbound_conf}" "${forward_conf}" \
+ "${lanzones_conf}" "${anchor}" ; do
if [ "${file#${workdir%/}/}" = "${file}" ] ; then
echo "warning: ${file} is outside ${workdir}" >&2
chrootdir=""
@@ -169,6 +174,7 @@ gen_resolvconf_conf() {
#
gen_forward_conf() {
echo "# Generated by $self"
+ echo "# Do not edit this file."
echo "forward-zone:"
echo " name: ."
for forwarder ; do
@@ -181,6 +187,42 @@ gen_forward_conf() {
}
#
+# Generate lan-zones.conf
+#
+gen_lanzones_conf() {
+ echo "# Generated by $self"
+ echo "# Do not edit this file."
+ echo "server:"
+ echo " # Unblock reverse lookups for LAN addresses"
+ echo " unblock-lan-zones: yes"
+ echo " domain-insecure: 10.in-addr.arpa."
+ echo " domain-insecure: 127.in-addr.arpa."
+ echo " domain-insecure: 16.172.in-addr.arpa."
+ echo " domain-insecure: 17.172.in-addr.arpa."
+ echo " domain-insecure: 18.172.in-addr.arpa."
+ echo " domain-insecure: 19.172.in-addr.arpa."
+ echo " domain-insecure: 20.172.in-addr.arpa."
+ echo " domain-insecure: 21.172.in-addr.arpa."
+ echo " domain-insecure: 22.172.in-addr.arpa."
+ echo " domain-insecure: 23.172.in-addr.arpa."
+ echo " domain-insecure: 24.172.in-addr.arpa."
+ echo " domain-insecure: 25.172.in-addr.arpa."
+ echo " domain-insecure: 26.172.in-addr.arpa."
+ echo " domain-insecure: 27.172.in-addr.arpa."
+ echo " domain-insecure: 28.172.in-addr.arpa."
+ echo " domain-insecure: 29.172.in-addr.arpa."
+ echo " domain-insecure: 30.172.in-addr.arpa."
+ echo " domain-insecure: 31.172.in-addr.arpa."
+ echo " domain-insecure: 168.192.in-addr.arpa."
+ echo " domain-insecure: 254.169.in-addr.arpa."
+ echo " domain-insecure: d.f.ip6.arpa."
+ echo " domain-insecure: 8.e.ip6.arpa."
+ echo " domain-insecure: 9.e.ip6.arpa."
+ echo " domain-insecure: a.e.ip6.arpa."
+ echo " domain-insecure: b.e.ip6.arpa."
+}
+
+#
# Generate unbound.conf
#
gen_unbound_conf() {
@@ -195,6 +237,12 @@ gen_unbound_conf() {
if [ -f "${forward_conf}" ] ; then
echo "include: ${forward_conf}"
fi
+ if [ -f "${lanzones_conf}" ] ; then
+ echo "include: ${lanzones_conf}"
+ fi
+ if [ -d "${confdir}" ] ; then
+ echo "include: ${confdir}/*.conf"
+ fi
}
#
@@ -227,7 +275,8 @@ usage() {
echo "options:"
echo " -n do not start unbound"
echo " -a path full path to trust anchor file"
- echo " -c path full path to unbound configuration"
+ echo " -C path full path to additional configuration directory"
+ echo " -c path full path to unbound configuration file"
echo " -f path full path to forwarding configuration"
echo " -p path full path to pid file"
echo " -R path full path to resolvconf.conf"
@@ -247,11 +296,14 @@ main() {
#
# Parse and validate command-line options
#
- while getopts "a:c:f:np:R:r:s:u:w:" option ; do
+ while getopts "a:C:c:f:np:R:r:s:u:w:" option ; do
case $option in
a)
anchor="$OPTARG"
;;
+ C)
+ confdir="$OPTARG"
+ ;;
c)
unbound_conf="$OPTARG"
;;
@@ -314,6 +366,13 @@ main() {
fi
#
+ # Generate lan-zones.conf.
+ #
+ local tmp_lanzones_conf=$(mktemp -u "${lanzones_conf}.XXXXX")
+ gen_lanzones_conf >"${tmp_lanzones_conf}"
+ replace "${lanzones_conf}" "${tmp_lanzones_conf}"
+
+ #
# Generate unbound.conf.
#
local tmp_unbound_conf=$(mktemp -u "${unbound_conf}.XXXXX")
diff --git a/usr.sbin/usbdump/usbdump.8 b/usr.sbin/usbdump/usbdump.8
index 05ff3f9668cc..475e832cd03b 100644
--- a/usr.sbin/usbdump/usbdump.8
+++ b/usr.sbin/usbdump/usbdump.8
@@ -154,5 +154,4 @@ Optional field used for printing an error string if the packet is from USB done.
.Sh SEE ALSO
.Xr usbconfig 8
.Sh AUTHORS
-.An Weongyo Jeong
-.Aq weongyo@FreeBSD.org
+.An Weongyo Jeong Aq Mt weongyo@FreeBSD.org
diff --git a/usr.sbin/usbdump/usbdump.c b/usr.sbin/usbdump/usbdump.c
index 43fde90e88f5..99307a48805c 100644
--- a/usr.sbin/usbdump/usbdump.c
+++ b/usr.sbin/usbdump/usbdump.c
@@ -473,7 +473,6 @@ print_apacket(const struct header_32 *hdr, const uint8_t *ptr, int ptr_len)
*/
up->up_totlen = le32toh(up->up_totlen);
up->up_busunit = le32toh(up->up_busunit);
- up->up_address = le32toh(up->up_address);
up->up_flags = le32toh(up->up_flags);
up->up_status = le32toh(up->up_status);
up->up_error = le32toh(up->up_error);
diff --git a/usr.sbin/utx/utx.8 b/usr.sbin/utx/utx.8
index 363a46a281d4..21794964add3 100644
--- a/usr.sbin/utx/utx.8
+++ b/usr.sbin/utx/utx.8
@@ -94,4 +94,4 @@ utility replaced
in
.Fx 10.0 .
.Sh AUTHORS
-.An Ed Schouten Aq ed@FreeBSD.org
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/usr.sbin/vidcontrol/path.h b/usr.sbin/vidcontrol/path.h
index 709acbc375dc..e1fa341e0c78 100644
--- a/usr.sbin/vidcontrol/path.h
+++ b/usr.sbin/vidcontrol/path.h
@@ -1,4 +1,8 @@
+/* $FreeBSD$ */
+
#define KEYMAP_PATH "/usr/share/syscons/keymaps/"
#define FONT_PATH "/usr/share/syscons/fonts/"
#define SCRNMAP_PATH "/usr/share/syscons/scrnmaps/"
+#define VT_KEYMAP_PATH "/usr/share/vt/keymaps/"
+#define VT_FONT_PATH "/usr/share/vt/fonts/"
diff --git a/usr.sbin/vidcontrol/vidcontrol.1 b/usr.sbin/vidcontrol/vidcontrol.1
index a36d3780c8b7..d46bd6d71681 100644
--- a/usr.sbin/vidcontrol/vidcontrol.1
+++ b/usr.sbin/vidcontrol/vidcontrol.1
@@ -535,8 +535,9 @@ and
categories of the
.Em "Ports Collection" .
.Sh AUTHORS
-.An S\(/oren Schmidt Aq sos@FreeBSD.org
-.An Sascha Wildner
+.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org
+.An Sascha Wildner Aq Mt saw@online.de
.Sh CONTRIBUTORS
-.An Maxim Sobolev Aq sobomax@FreeBSD.org ,
-.An Nik Clayton Aq nik@FreeBSD.org
+.An -split
+.An Maxim Sobolev Aq Mt sobomax@FreeBSD.org
+.An Nik Clayton Aq Mt nik@FreeBSD.org
diff --git a/usr.sbin/vidcontrol/vidcontrol.c b/usr.sbin/vidcontrol/vidcontrol.c
index f4f1f0d158f0..32e4de64fbe6 100644
--- a/usr.sbin/vidcontrol/vidcontrol.c
+++ b/usr.sbin/vidcontrol/vidcontrol.c
@@ -45,9 +45,12 @@ static const char rcsid[] =
#include <unistd.h>
#include <sys/fbio.h>
#include <sys/consio.h>
+#include <sys/endian.h>
#include <sys/errno.h>
+#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/sysctl.h>
#include "path.h"
#include "decode.h"
@@ -78,6 +81,15 @@ static struct {
struct video_info video_mode_info;
} cur_info;
+struct vt4font_header {
+ uint8_t magic[8];
+ uint8_t width;
+ uint8_t height;
+ uint16_t pad;
+ uint32_t glyph_count;
+ uint32_t map_count[4];
+} __packed;
+
static int hex = 0;
static int vesa_cols;
static int vesa_rows;
@@ -86,6 +98,7 @@ static int colors_changed;
static int video_mode_changed;
static int normal_fore_color, normal_back_color;
static int revers_fore_color, revers_back_color;
+static int vt4_mode = 0;
static struct vid_info info;
static struct video_info new_mode_info;
@@ -115,7 +128,9 @@ init(void)
if (ioctl(0, CONS_GETINFO, &cur_info.console_info) == -1)
errc(1, errno, "getting console information");
- if (ioctl(0, GIO_SCRNMAP, &cur_info.screen_map) == -1)
+ /* vt(4) use unicode, so no screen mapping required. */
+ if (vt4_mode == 0 &&
+ ioctl(0, GIO_SCRNMAP, &cur_info.screen_map) == -1)
errc(1, errno, "getting screen map");
if (ioctl(0, CONS_GET, &cur_info.video_mode_number) == -1)
@@ -153,7 +168,8 @@ revert(void)
fprintf(stderr, "\033[=%dH", cur_info.console_info.mv_rev.fore);
fprintf(stderr, "\033[=%dI", cur_info.console_info.mv_rev.back);
- ioctl(0, PIO_SCRNMAP, &cur_info.screen_map);
+ if (vt4_mode == 0)
+ ioctl(0, PIO_SCRNMAP, &cur_info.screen_map);
if (cur_info.video_mode_number >= M_VESA_BASE)
ioctl(0, _IO('V', cur_info.video_mode_number - M_VESA_BASE),
@@ -179,7 +195,15 @@ revert(void)
static void
usage(void)
{
- fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
+ if (vt4_mode)
+ fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
+"usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [size] file]",
+" [-g geometry] [-h size] [-i adapter | mode]",
+" [-M char] [-m on | off] [-r foreground background]",
+" [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]",
+" [mode] [foreground [background]] [show]");
+ else
+ fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
"usage: vidcontrol [-CdHLPpx] [-b color] [-c appearance] [-f [size] file]",
" [-g geometry] [-h size] [-i adapter | mode] [-l screen_map]",
" [-M char] [-m on | off] [-r foreground background]",
@@ -188,6 +212,17 @@ usage(void)
exit(1);
}
+/* Detect presence of vt(4). */
+static int
+is_vt4(void)
+{
+ char vty_name[4] = "";
+ size_t len = sizeof(vty_name);
+
+ if (sysctlbyname("kern.vty", vty_name, &len, NULL, 0) != 0)
+ return (0);
+ return (strcmp(vty_name, "vt") == 0);
+}
/*
* Retrieve the next argument from the command line (for options that require
@@ -349,6 +384,72 @@ fsize(FILE *file)
return -1;
}
+static vfnt_map_t *
+load_vt4mappingtable(unsigned int nmappings, FILE *f)
+{
+ vfnt_map_t *t;
+ unsigned int i;
+
+ if (nmappings == 0)
+ return (NULL);
+
+ t = malloc(sizeof *t * nmappings);
+
+ if (fread(t, sizeof *t * nmappings, 1, f) != 1) {
+ perror("mappings");
+ exit(1);
+ }
+
+ for (i = 0; i < nmappings; i++) {
+ t[i].src = be32toh(t[i].src);
+ t[i].dst = be16toh(t[i].dst);
+ t[i].len = be16toh(t[i].len);
+ }
+
+ return (t);
+}
+
+static int
+load_vt4font(FILE *f)
+{
+ struct vt4font_header fh;
+ static vfnt_t vfnt;
+ size_t glyphsize;
+ unsigned int i;
+
+ if (fread(&fh, sizeof fh, 1, f) != 1) {
+ perror("file_header");
+ return (1);
+ }
+
+ if (memcmp(fh.magic, "VFNT0002", 8) != 0) {
+ fprintf(stderr, "Bad magic\n");
+ return (1);
+ }
+
+ for (i = 0; i < VFNT_MAPS; i++)
+ vfnt.map_count[i] = be32toh(fh.map_count[i]);
+ vfnt.glyph_count = be32toh(fh.glyph_count);
+ vfnt.width = fh.width;
+ vfnt.height = fh.height;
+
+ glyphsize = howmany(vfnt.width, 8) * vfnt.height * vfnt.glyph_count;
+ vfnt.glyphs = malloc(glyphsize);
+
+ if (fread(vfnt.glyphs, glyphsize, 1, f) != 1) {
+ perror("glyphs");
+ return (1);
+ }
+
+ for (i = 0; i < VFNT_MAPS; i++)
+ vfnt.map[i] = load_vt4mappingtable(vfnt.map_count[i], f);
+
+ if (ioctl(STDIN_FILENO, PIO_VFONT, &vfnt) == -1) {
+ perror("PIO_VFONT");
+ return (1);
+ }
+ return (0);
+}
/*
* Load a font from file and set it.
@@ -362,6 +463,7 @@ load_font(const char *type, const char *filename)
unsigned long io = 0; /* silence stupid gcc(1) in the Wall mode */
char *name, *fontmap, size_sufx[6];
const char *a[] = {"", FONT_PATH, NULL};
+ const char *vt4a[] = {"", VT_FONT_PATH, NULL};
const char *b[] = {filename, NULL};
const char *c[] = {"", size_sufx, NULL};
const char *d[] = {"", ".fnt", NULL};
@@ -376,21 +478,32 @@ load_font(const char *type, const char *filename)
{8, 8, PIO_FONT8x8},
{0, 0, 0}};
- _info.size = sizeof(_info);
- if (ioctl(0, CONS_GETINFO, &_info) == -1) {
- revert();
- warn("failed to obtain current video mode parameters");
- return;
- }
+ if (vt4_mode) {
+ size_sufx[0] = '\0';
+ } else {
+ _info.size = sizeof(_info);
+ if (ioctl(0, CONS_GETINFO, &_info) == -1) {
+ revert();
+ warn("failed to obtain current video mode parameters");
+ return;
+ }
- snprintf(size_sufx, sizeof(size_sufx), "-8x%d", _info.font_size);
- fd = openguess(a, b, c, d, &name);
+ snprintf(size_sufx, sizeof(size_sufx), "-8x%d", _info.font_size);
+ }
+ fd = openguess((vt4_mode == 0) ? a : vt4a, b, c, d, &name);
if (fd == NULL) {
revert();
errx(1, "%s: can't load font file", filename);
}
+ if (vt4_mode) {
+ if(load_vt4font(fd))
+ warn("failed to load font \"%s\"", filename);
+ fclose(fd);
+ return;
+ }
+
if (type != NULL) {
size = 0;
if (sscanf(type, "%dx%d", &w, &h) == 2) {
@@ -1199,9 +1312,12 @@ int
main(int argc, char **argv)
{
char *font, *type, *termmode;
+ const char *opts;
int dumpmod, dumpopt, opt;
int reterr;
+ vt4_mode = is_vt4();
+
init();
info.size = sizeof(info);
@@ -1211,8 +1327,12 @@ main(int argc, char **argv)
dumpmod = 0;
dumpopt = DUMP_FBF;
termmode = NULL;
- while ((opt = getopt(argc, argv,
- "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:T:t:x")) != -1)
+ if (vt4_mode)
+ opts = "b:Cc:f:g:h:Hi:M:m:pPr:S:s:T:t:x";
+ else
+ opts = "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:T:t:x";
+
+ while ((opt = getopt(argc, argv, opts)) != -1)
switch(opt) {
case 'b':
set_border_color(optarg);
@@ -1224,6 +1344,8 @@ main(int argc, char **argv)
set_cursor_type(optarg);
break;
case 'd':
+ if (vt4_mode)
+ break;
print_scrnmap();
break;
case 'f':
@@ -1255,9 +1377,13 @@ main(int argc, char **argv)
show_info(optarg);
break;
case 'l':
+ if (vt4_mode)
+ break;
load_scrnmap(optarg);
break;
case 'L':
+ if (vt4_mode)
+ break;
load_default_scrnmap();
break;
case 'M':
diff --git a/usr.sbin/wake/wake.8 b/usr.sbin/wake/wake.8
index 53249073b6fa..4abd607f11e2 100644
--- a/usr.sbin/wake/wake.8
+++ b/usr.sbin/wake/wake.8
@@ -65,4 +65,4 @@ Ethernet host name data base.
.Sh AUTHORS
.Nm
was written by
-.Ar Marc Balmer Aq marc@msys.ch .
+.Ar Marc Balmer Aq Mt marc@msys.ch .
diff --git a/usr.sbin/watch/Makefile b/usr.sbin/watch/Makefile
index e8a8ea6ab698..184d33187157 100644
--- a/usr.sbin/watch/Makefile
+++ b/usr.sbin/watch/Makefile
@@ -5,7 +5,7 @@ MAN= watch.8
WARNS?= 2
-DPADD= ${LIBTERMCAP}
-LDADD= -ltermcap
+DPADD= ${LIBTERMCAPW}
+LDADD= -ltermcapw
.include <bsd.prog.mk>
diff --git a/usr.sbin/watch/Makefile.depend b/usr.sbin/watch/Makefile.depend
index 4f4df6520bd4..a25f5f6a2451 100644
--- a/usr.sbin/watch/Makefile.depend
+++ b/usr.sbin/watch/Makefile.depend
@@ -10,7 +10,6 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
- lib/ncurses/ncurses \
lib/ncurses/ncursesw \
diff --git a/usr.sbin/watch/watch.8 b/usr.sbin/watch/watch.8
index 99c6b6feab94..052c95d49b87 100644
--- a/usr.sbin/watch/watch.8
+++ b/usr.sbin/watch/watch.8
@@ -114,7 +114,7 @@ The
utility first appeared in
.Fx 2.1 .
.Sh AUTHORS
-.An Ugen J.S. Antsilevich Aq ugen@NetVision.net.il
+.An Ugen J.S. Antsilevich Aq Mt ugen@NetVision.net.il
.Sh BUGS
No terminal emulation is performed.
All user output is reproduced as-is.
diff --git a/usr.sbin/watchdogd/watchdog.8 b/usr.sbin/watchdogd/watchdog.8
index 9ca9fe0ef27f..a82f6e310c29 100644
--- a/usr.sbin/watchdogd/watchdog.8
+++ b/usr.sbin/watchdogd/watchdog.8
@@ -65,9 +65,9 @@ utility appeared in
The
.Nm
utility and manual page were written by
-.An Sean Kelly Aq smkelly@FreeBSD.org
+.An Sean Kelly Aq Mt smkelly@FreeBSD.org
and
-.An Poul-Henning Kamp Aq phk@FreeBSD.org .
+.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .
.Pp
Some contributions made by
-.An Jeff Roberson Aq jeff@FreeBSD.org .
+.An Jeff Roberson Aq Mt jeff@FreeBSD.org .
diff --git a/usr.sbin/watchdogd/watchdogd.8 b/usr.sbin/watchdogd/watchdogd.8
index d50a964cb994..1d76eeeaf8d4 100644
--- a/usr.sbin/watchdogd/watchdogd.8
+++ b/usr.sbin/watchdogd/watchdogd.8
@@ -302,12 +302,12 @@ utility appeared in
The
.Nm
utility and manual page were written by
-.An Sean Kelly Aq smkelly@FreeBSD.org
+.An Sean Kelly Aq Mt smkelly@FreeBSD.org
and
-.An Poul-Henning Kamp Aq phk@FreeBSD.org .
+.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .
.Pp
Some contributions made by
-.An Jeff Roberson Aq jeff@FreeBSD.org .
+.An Jeff Roberson Aq Mt jeff@FreeBSD.org .
.Pp
The pretimeout and softtimeout action system was added by
-.An Alfred Perlstein Aq alfred@freebsd.org .
+.An Alfred Perlstein Aq Mt alfred@freebsd.org .
diff --git a/usr.sbin/wpa/hostapd/Makefile b/usr.sbin/wpa/hostapd/Makefile
index 7f0304c6af15..7ab542f11386 100644
--- a/usr.sbin/wpa/hostapd/Makefile
+++ b/usr.sbin/wpa/hostapd/Makefile
@@ -46,8 +46,8 @@ CFLAGS+=-DCONFIG_DRIVER_BSD \
CFLAGS+= -DCONFIG_IPV6
.endif
#CFLAGS+= -g
-DPADD+= ${LIBPCAP}
-LDADD+= -lpcap
+DPADD+= ${LIBPCAP} ${LIBUTIL}
+LDADD+= -lpcap -lutil
# User customizations for wpa_supplicant/hostapd build environment
CFLAGS+=${HOSTAPD_CFLAGS}
diff --git a/usr.sbin/wpa/hostapd/Makefile.depend b/usr.sbin/wpa/hostapd/Makefile.depend
index ae45e7b9d550..5acb789f294b 100644
--- a/usr.sbin/wpa/hostapd/Makefile.depend
+++ b/usr.sbin/wpa/hostapd/Makefile.depend
@@ -12,6 +12,7 @@ DIRDEPS = \
lib/libc \
lib/libcompiler_rt \
lib/libpcap \
+ lib/libutil \
secure/lib/libcrypto \
secure/lib/libssl \
diff --git a/usr.sbin/wpa/hostapd/hostapd.8 b/usr.sbin/wpa/hostapd/hostapd.8
index f624cac03e52..9edbd65438c3 100644
--- a/usr.sbin/wpa/hostapd/hostapd.8
+++ b/usr.sbin/wpa/hostapd/hostapd.8
@@ -129,7 +129,7 @@ utility first appeared in
The
.Nm
utility was written by
-.An Jouni Malinen Aq j@w1.fi .
+.An Jouni Malinen Aq Mt j@w1.fi .
This manual page is derived from the
.Pa README
file included in the
diff --git a/usr.sbin/wpa/hostapd/hostapd.conf.5 b/usr.sbin/wpa/hostapd/hostapd.conf.5
index 08a04fe9282c..e166f365745c 100644
--- a/usr.sbin/wpa/hostapd/hostapd.conf.5
+++ b/usr.sbin/wpa/hostapd/hostapd.conf.5
@@ -208,4 +208,4 @@ and
files in the
.Nm hostapd
distribution provided by
-.An Jouni Malinen Aq j@w1.fi .
+.An Jouni Malinen Aq Mt j@w1.fi .
diff --git a/usr.sbin/wpa/hostapd_cli/Makefile b/usr.sbin/wpa/hostapd_cli/Makefile
index 8677fbfb2f86..3542aacfdfdd 100644
--- a/usr.sbin/wpa/hostapd_cli/Makefile
+++ b/usr.sbin/wpa/hostapd_cli/Makefile
@@ -10,6 +10,9 @@ SRCS= common.c edit.c eloop.c hostapd_cli.c os_unix.c wpa_ctrl.c wpa_debug.c
CFLAGS+= -DCONFIG_CTRL_IFACE
CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX
+DPADD+= ${LIBUTIL}
+LDADD+= -lutil
+
MAN= hostapd_cli.8
.include <bsd.prog.mk>
diff --git a/usr.sbin/wpa/hostapd_cli/Makefile.depend b/usr.sbin/wpa/hostapd_cli/Makefile.depend
index b68b4bb5daf9..d9ecce6a52af 100644
--- a/usr.sbin/wpa/hostapd_cli/Makefile.depend
+++ b/usr.sbin/wpa/hostapd_cli/Makefile.depend
@@ -11,6 +11,7 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
+ lib/libutil \
.include <dirdeps.mk>
diff --git a/usr.sbin/wpa/hostapd_cli/hostapd_cli.8 b/usr.sbin/wpa/hostapd_cli/hostapd_cli.8
index eb7f60f028a6..605a7f5d2a94 100644
--- a/usr.sbin/wpa/hostapd_cli/hostapd_cli.8
+++ b/usr.sbin/wpa/hostapd_cli/hostapd_cli.8
@@ -104,7 +104,7 @@ utility first appeared in
The
.Nm
utility was written by
-.An Jouni Malinen Aq j@w1.fi .
+.An Jouni Malinen Aq Mt j@w1.fi .
This manual page is derived from the
.Pa README
file included in the
diff --git a/usr.sbin/wpa/ndis_events/ndis_events.8 b/usr.sbin/wpa/ndis_events/ndis_events.8
index 44ce6b9bca71..bf11c1943fec 100644
--- a/usr.sbin/wpa/ndis_events/ndis_events.8
+++ b/usr.sbin/wpa/ndis_events/ndis_events.8
@@ -132,4 +132,4 @@ utility first appeared in
The
.Nm
utility was written by
-.An Bill Paul Aq wpaul@windriver.com .
+.An Bill Paul Aq Mt wpaul@windriver.com .
diff --git a/usr.sbin/wpa/wpa_cli/Makefile b/usr.sbin/wpa/wpa_cli/Makefile
index da2532505b3b..93a1ba7ca063 100644
--- a/usr.sbin/wpa/wpa_cli/Makefile
+++ b/usr.sbin/wpa/wpa_cli/Makefile
@@ -15,7 +15,7 @@ CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX
CFLAGS+= -D_DIRENT_HAVE_D_TYPE
CFLAGS+= -DCONFIG_READLINE -I${DESTDIR}/${INCLUDEDIR}/edit
-LDADD+= -ledit -ltermcap
-DPADD+= ${LIBEDIT} ${LIBTERMCAP}
+LDADD+= -ledit -ltermcapw -lutil
+DPADD+= ${LIBEDIT} ${LIBTERMCAPW} ${LIBUTIL}
.include <bsd.prog.mk>
diff --git a/usr.sbin/wpa/wpa_cli/Makefile.depend b/usr.sbin/wpa/wpa_cli/Makefile.depend
index a0d576d9b48e..c43a11a5f8fb 100644
--- a/usr.sbin/wpa/wpa_cli/Makefile.depend
+++ b/usr.sbin/wpa/wpa_cli/Makefile.depend
@@ -12,7 +12,8 @@ DIRDEPS = \
lib/libc \
lib/libcompiler_rt \
lib/libedit \
- lib/ncurses/ncurses \
+ lib/libutil \
+ lib/ncurses/ncursesw \
.include <dirdeps.mk>
diff --git a/usr.sbin/wpa/wpa_cli/wpa_cli.8 b/usr.sbin/wpa/wpa_cli/wpa_cli.8
index fdb24fc49f0f..a2bf189a3f8c 100644
--- a/usr.sbin/wpa/wpa_cli/wpa_cli.8
+++ b/usr.sbin/wpa/wpa_cli/wpa_cli.8
@@ -214,7 +214,7 @@ utility first appeared in
The
.Nm
utility was written by
-.An Jouni Malinen Aq j@w1.fi .
+.An Jouni Malinen Aq Mt j@w1.fi .
This manual page is derived from the
.Pa README
file included in the
diff --git a/usr.sbin/wpa/wpa_passphrase/Makefile b/usr.sbin/wpa/wpa_passphrase/Makefile
index 16321c42a210..d0f51985ba79 100644
--- a/usr.sbin/wpa/wpa_passphrase/Makefile
+++ b/usr.sbin/wpa/wpa_passphrase/Makefile
@@ -11,6 +11,9 @@ SRCS= common.c md5-internal.c md5.c os_unix.c sha1-internal.c sha1-pbkdf2.c sha1
CFLAGS+= -DINTERNAL_SHA1
CFLAGS+= -DINTERNAL_MD5
+DPADD+= ${LIBUTIL}
+LDADD+= -lutil
+
MAN= wpa_passphrase.8
.include <bsd.prog.mk>
diff --git a/usr.sbin/wpa/wpa_passphrase/Makefile.depend b/usr.sbin/wpa/wpa_passphrase/Makefile.depend
index b68b4bb5daf9..d9ecce6a52af 100644
--- a/usr.sbin/wpa/wpa_passphrase/Makefile.depend
+++ b/usr.sbin/wpa/wpa_passphrase/Makefile.depend
@@ -11,6 +11,7 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
+ lib/libutil \
.include <dirdeps.mk>
diff --git a/usr.sbin/wpa/wpa_passphrase/wpa_passphrase.8 b/usr.sbin/wpa/wpa_passphrase/wpa_passphrase.8
index c66d658d31ae..b661a792dd73 100644
--- a/usr.sbin/wpa/wpa_passphrase/wpa_passphrase.8
+++ b/usr.sbin/wpa/wpa_passphrase/wpa_passphrase.8
@@ -55,12 +55,11 @@ The
utility first appeared in
.Fx 6.3 .
.Sh AUTHORS
+.An -nosplit
The
.Nm
utility was written by
-.An Jouni Malinen
-.Aq j@w1.fi .
+.An Jouni Malinen Aq Mt j@w1.fi .
.Pp
This manual page was written by
-.An Henrik Brix Andersen
-.Aq henrik@brixandersen.dk .
+.An Henrik Brix Andersen Aq Mt henrik@brixandersen.dk .
diff --git a/usr.sbin/wpa/wpa_supplicant/Makefile b/usr.sbin/wpa/wpa_supplicant/Makefile
index 11cccf3ee492..673a04d27a7c 100644
--- a/usr.sbin/wpa/wpa_supplicant/Makefile
+++ b/usr.sbin/wpa/wpa_supplicant/Makefile
@@ -49,8 +49,8 @@ CFLAGS+=-DCONFIG_BACKEND_FILE \
-DCONFIG_GAS \
-DPKCS12_FUNCS
#CFLAGS+= -g
-DPADD+= ${LIBPCAP}
-LDADD+= -lpcap
+DPADD+= ${LIBPCAP} ${LIBUTIL}
+LDADD+= -lpcap -lutil
# User customizations to the wpa_supplicant build environment
CFLAGS+=${WPA_SUPPLICANT_CFLAGS}
diff --git a/usr.sbin/wpa/wpa_supplicant/Makefile.depend b/usr.sbin/wpa/wpa_supplicant/Makefile.depend
index ae45e7b9d550..5acb789f294b 100644
--- a/usr.sbin/wpa/wpa_supplicant/Makefile.depend
+++ b/usr.sbin/wpa/wpa_supplicant/Makefile.depend
@@ -12,6 +12,7 @@ DIRDEPS = \
lib/libc \
lib/libcompiler_rt \
lib/libpcap \
+ lib/libutil \
secure/lib/libcrypto \
secure/lib/libssl \
diff --git a/usr.sbin/wpa/wpa_supplicant/wpa_supplicant.8 b/usr.sbin/wpa/wpa_supplicant/wpa_supplicant.8
index 466759dd2e61..fe9fdce4f7fa 100644
--- a/usr.sbin/wpa/wpa_supplicant/wpa_supplicant.8
+++ b/usr.sbin/wpa/wpa_supplicant/wpa_supplicant.8
@@ -176,7 +176,7 @@ utility first appeared in
The
.Nm
utility was written by
-.An Jouni Malinen Aq j@w1.fi .
+.An Jouni Malinen Aq Mt j@w1.fi .
This manual page is derived from the
.Pa README
file included in the
diff --git a/usr.sbin/wpa/wpa_supplicant/wpa_supplicant.conf.5 b/usr.sbin/wpa/wpa_supplicant/wpa_supplicant.conf.5
index 5d6914fccb9d..94e3100bcab4 100644
--- a/usr.sbin/wpa/wpa_supplicant/wpa_supplicant.conf.5
+++ b/usr.sbin/wpa/wpa_supplicant/wpa_supplicant.conf.5
@@ -575,4 +575,4 @@ and
files in the
.Nm wpa_supplicant
distribution provided by
-.An Jouni Malinen Aq j@w1.fi .
+.An Jouni Malinen Aq Mt j@w1.fi .
diff --git a/usr.sbin/yp_mkdb/yp_mkdb.8 b/usr.sbin/yp_mkdb/yp_mkdb.8
index 125123519c05..2689f292332c 100644
--- a/usr.sbin/yp_mkdb/yp_mkdb.8
+++ b/usr.sbin/yp_mkdb/yp_mkdb.8
@@ -206,4 +206,4 @@ to build the NIS databases
.Xr db 3 ,
.Xr ypserv 8
.Sh AUTHORS
-.An Bill Paul Aq wpaul@ctr.columbia.edu
+.An Bill Paul Aq Mt wpaul@ctr.columbia.edu
diff --git a/usr.sbin/ypbind/ypbind.8 b/usr.sbin/ypbind/ypbind.8
index 34ce2175a9f1..acd20eb06273 100644
--- a/usr.sbin/ypbind/ypbind.8
+++ b/usr.sbin/ypbind/ypbind.8
@@ -199,4 +199,4 @@ ypbind startup options are specified
.Xr ypserv 8 ,
.Xr ypset 8
.Sh AUTHORS
-.An Theo de Raadt Aq deraadt@fsa.ca
+.An Theo de Raadt Aq Mt deraadt@fsa.ca
diff --git a/usr.sbin/yppush/yppush.8 b/usr.sbin/yppush/yppush.8
index 1acac3f7fc97..b82c8f72a258 100644
--- a/usr.sbin/yppush/yppush.8
+++ b/usr.sbin/yppush/yppush.8
@@ -171,7 +171,7 @@ a particular NIS domain
.Xr ypserv 8 ,
.Xr ypxfr 8
.Sh AUTHORS
-.An Bill Paul Aq wpaul@ctr.columbia.edu
+.An Bill Paul Aq Mt wpaul@ctr.columbia.edu
.Sh BUGS
The mechanism for transferring NIS maps in NIS v1 is different
than that in NIS version 2.
diff --git a/usr.sbin/ypserv/ypinit.8 b/usr.sbin/ypserv/ypinit.8
index 524ec5ee4c12..e161a4a21f41 100644
--- a/usr.sbin/ypserv/ypinit.8
+++ b/usr.sbin/ypserv/ypinit.8
@@ -191,8 +191,8 @@ It first appeared in
.Sh AUTHORS
.An -nosplit
The original script was written by
-.An Mats O Jansson Aq moj@stacken.kth.se .
+.An Mats O Jansson Aq Mt moj@stacken.kth.se .
It was modified for
.Fx
by
-.An Bill Paul Aq wpaul@ctr.columbia.edu .
+.An Bill Paul Aq Mt wpaul@ctr.columbia.edu .
diff --git a/usr.sbin/ypserv/ypserv.8 b/usr.sbin/ypserv/ypserv.8
index b212c49805c0..f255118179e3 100644
--- a/usr.sbin/ypserv/ypserv.8
+++ b/usr.sbin/ypserv/ypserv.8
@@ -460,4 +460,4 @@ This version of
first appeared in
.Fx 2.2 .
.Sh AUTHORS
-.An Bill Paul Aq wpaul@ctr.columbia.edu
+.An Bill Paul Aq Mt wpaul@ctr.columbia.edu
diff --git a/usr.sbin/zzz/zzz.8 b/usr.sbin/zzz/zzz.8
index 583d5fd963ae..365950f64389 100644
--- a/usr.sbin/zzz/zzz.8
+++ b/usr.sbin/zzz/zzz.8
@@ -62,4 +62,4 @@ will be issued.
.Xr apm 8
.Sh AUTHORS
This manual page was written by
-.An Nate Lawson Aq njl@FreeBSD.org .
+.An Nate Lawson Aq Mt njl@FreeBSD.org .