summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2018-02-07 12:58:30 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2018-02-07 12:58:30 +0000
commita8c99d9d4ff15952a420fa9166214d2353a60ad1 (patch)
tree94faf926351da1c88f387830fa30c0baa935f6c0 /usr
parentba8a49144616acf7f807e008c4243939fdf3e98a (diff)
parent3385b4726f1b09aa9511340017fb23c7cde6aadd (diff)
downloadillumos-joyent-a8c99d9d4ff15952a420fa9166214d2353a60ad1.tar.gz
[illumos-gate merge]
commit 3385b4726f1b09aa9511340017fb23c7cde6aadd 8472 Want docs for iports, tgtmaps, and friends commit 1eb7f6f10a2bf852886fac64ce710da077f20c75 8706 libc lint library missing endian.h functions commit e144c4e6c90e7d4dccaad6db660ee42b6e7ba04f 8962 zdb should work on non-idle pools commit 3ee8c80c747c4aa3f83351a6920f30c411236e1b 8961 SPA load/import should tell us why it failed commit 1fd3785ff6601d3e391378c2dcbf4c5f27e1fe32 7638 Refactor spa_load_impl into several functions commit 82693e09cc02331fa1b3b73b54b1060e73507a8d 8966 Source file zfs_acl.c, function zfs_aclset_common contains a use after end of the lifetime of a local variable commit d3c0397fdfe3697d5078fec583494fae9971fd75 9039 tcp(7p): Duplicate paragraph commit af8443c4728e4601db72fb8089035223de906eb9 9022 loader.efi: module placement must check memory map commit bd0ce624be4492bab2f6c53383a40618647aba28 9027 Makefiles need to specify C99 mode consistently Conflicts: usr/src/man/man9f/scsi_hba_iportmap_create.9f usr/src/man/man9f/scsi_address_device.9f usr/src/man/man9/iport.9 usr/src/cmd/cmd-inet/usr.sbin/ping/Makefile
Diffstat (limited to 'usr')
-rw-r--r--usr/src/Makefile.ast2
-rw-r--r--usr/src/Makefile.master20
-rw-r--r--usr/src/boot/sys/boot/common/multiboot2.c48
-rw-r--r--usr/src/boot/sys/boot/efi/loader/copy.c106
-rw-r--r--usr/src/boot/sys/boot/efi/loader/loader_efi.h2
-rw-r--r--usr/src/cmd/boot/bootadm/Makefile2
-rw-r--r--usr/src/cmd/boot/installboot/Makefile.com2
-rw-r--r--usr/src/cmd/boot/installgrub/Makefile2
-rw-r--r--usr/src/cmd/cmd-inet/usr.bin/dns-sd/Makefile2
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile2
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.mpathd/Makefile2
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/mdnsd/Makefile2
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/vrrpd/Makefile2
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/ilbadm/Makefile2
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/ipmpstat/Makefile2
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/ping/Makefile3
-rw-r--r--usr/src/cmd/coreadm/Makefile2
-rw-r--r--usr/src/cmd/diskinfo/Makefile2
-rw-r--r--usr/src/cmd/fm/notify/smtp-notify/Makefile.com2
-rw-r--r--usr/src/cmd/fm/notify/snmp-notify/Makefile.com2
-rw-r--r--usr/src/cmd/fs.d/nfs/lockd/Makefile2
-rw-r--r--usr/src/cmd/fs.d/reparsed/Makefile2
-rw-r--r--usr/src/cmd/fs.d/smbclnt/chacl/Makefile2
-rw-r--r--usr/src/cmd/fs.d/smbclnt/lsacl/Makefile2
-rw-r--r--usr/src/cmd/fs.d/smbclnt/mount/Makefile2
-rw-r--r--usr/src/cmd/fs.d/smbclnt/smbiod-svc/Makefile2
-rw-r--r--usr/src/cmd/fs.d/smbclnt/smbiod/Makefile2
-rw-r--r--usr/src/cmd/fs.d/smbclnt/smbutil/Makefile2
-rw-r--r--usr/src/cmd/fs.d/smbclnt/test/Makefile2
-rw-r--r--usr/src/cmd/getconf/Makefile10
-rw-r--r--usr/src/cmd/hal/addons/acpi/Makefile4
-rw-r--r--usr/src/cmd/hal/addons/cpufreq/Makefile4
-rw-r--r--usr/src/cmd/hal/addons/network-devices/Makefile2
-rw-r--r--usr/src/cmd/hal/addons/storage/Makefile2
-rw-r--r--usr/src/cmd/hal/hald-runner/Makefile4
-rw-r--r--usr/src/cmd/hal/hald/Makefile2
-rw-r--r--usr/src/cmd/hal/hald/solaris/Makefile2
-rw-r--r--usr/src/cmd/hal/probing/acpi/Makefile4
-rw-r--r--usr/src/cmd/hal/probing/network-printer/Makefile2
-rw-r--r--usr/src/cmd/hal/probing/printer/Makefile4
-rw-r--r--usr/src/cmd/hal/probing/storage/Makefile4
-rw-r--r--usr/src/cmd/hal/probing/volume/Makefile4
-rw-r--r--usr/src/cmd/hal/probing/xkb/Makefile2
-rw-r--r--usr/src/cmd/hal/tools/Makefile2
-rw-r--r--usr/src/cmd/hal/tools/sunos/Makefile4
-rw-r--r--usr/src/cmd/iconv/Makefile2
-rw-r--r--usr/src/cmd/idmap/idmapd/Makefile2
-rw-r--r--usr/src/cmd/latencytop/Makefile.com2
-rw-r--r--usr/src/cmd/ldap/Makefile4
-rw-r--r--usr/src/cmd/ldap/Makefile.com12
-rw-r--r--usr/src/cmd/ldmad/Makefile2
-rw-r--r--usr/src/cmd/mandoc/Makefile.common2
-rw-r--r--usr/src/cmd/mdb/Makefile.mdb2
-rw-r--r--usr/src/cmd/mdb/Makefile.module2
-rw-r--r--usr/src/cmd/mdb/intel/amd64/libfksmbsrv/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/amd64/libzpool/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/amd64/nsmb/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/amd64/pmcs/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/amd64/qlc/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/amd64/smbfs/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/amd64/smbsrv/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/amd64/srpt/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/amd64/zfs/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/ia32/libfksmbsrv/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/ia32/libzpool/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/modules/mdb_kb/amd64/Makefile3
-rw-r--r--usr/src/cmd/mdb/sparc/v7/libfksmbsrv/Makefile2
-rw-r--r--usr/src/cmd/mdb/sparc/v7/libzpool/Makefile2
-rw-r--r--usr/src/cmd/mdb/sparc/v9/libfksmbsrv/Makefile2
-rw-r--r--usr/src/cmd/mdb/sparc/v9/libzpool/Makefile2
-rw-r--r--usr/src/cmd/mdb/sparc/v9/nsmb/Makefile2
-rw-r--r--usr/src/cmd/mdb/sparc/v9/pmcs/Makefile2
-rw-r--r--usr/src/cmd/mdb/sparc/v9/qlc/Makefile2
-rw-r--r--usr/src/cmd/mdb/sparc/v9/smbfs/Makefile2
-rw-r--r--usr/src/cmd/mdb/sparc/v9/smbsrv/Makefile2
-rw-r--r--usr/src/cmd/mdb/sparc/v9/srpt/Makefile2
-rw-r--r--usr/src/cmd/mdb/sparc/v9/stmf_sbd/Makefile2
-rw-r--r--usr/src/cmd/mdb/sparc/v9/zfs/Makefile2
-rw-r--r--usr/src/cmd/ndmpd/Makefile2
-rw-r--r--usr/src/cmd/nvmeadm/Makefile2
-rw-r--r--usr/src/cmd/od/Makefile2
-rw-r--r--usr/src/cmd/perl/Makefile.perl2
-rw-r--r--usr/src/cmd/policykit/Makefile2
-rw-r--r--usr/src/cmd/rmmount/Makefile2
-rw-r--r--usr/src/cmd/rmvolmgr/Makefile2
-rw-r--r--usr/src/cmd/savecore/Makefile.com2
-rw-r--r--usr/src/cmd/sgs/Makefile.com4
-rw-r--r--usr/src/cmd/sgs/ar/Makefile.com2
-rw-r--r--usr/src/cmd/sgs/error/i386/Makefile2
-rw-r--r--usr/src/cmd/sgs/error/sparc/Makefile2
-rw-r--r--usr/src/cmd/sgs/gprof/Makefile.com2
-rw-r--r--usr/src/cmd/sgs/lex/Makefile.com2
-rw-r--r--usr/src/cmd/sgs/m4/i386/Makefile2
-rw-r--r--usr/src/cmd/sgs/m4/sparc/Makefile2
-rw-r--r--usr/src/cmd/sgs/prof/Makefile.com2
-rw-r--r--usr/src/cmd/sgs/tsort/i386/Makefile2
-rw-r--r--usr/src/cmd/sgs/tsort/sparc/Makefile2
-rw-r--r--usr/src/cmd/sgs/unifdef/i386/Makefile2
-rw-r--r--usr/src/cmd/sgs/unifdef/sparc/Makefile2
-rw-r--r--usr/src/cmd/sgs/yacc/Makefile.com2
-rw-r--r--usr/src/cmd/smbsrv/Makefile.smbsrv.defs4
-rw-r--r--usr/src/cmd/smbsrv/fksmbd/Makefile2
-rw-r--r--usr/src/cmd/smbsrv/smbd/Makefile2
-rw-r--r--usr/src/cmd/tail/Makefile2
-rw-r--r--usr/src/cmd/th_tools/Makefile2
-rw-r--r--usr/src/cmd/tr/Makefile2
-rw-r--r--usr/src/cmd/truss/Makefile.com2
-rw-r--r--usr/src/cmd/uuidgen/Makefile2
-rw-r--r--usr/src/cmd/volcheck/Makefile2
-rw-r--r--usr/src/cmd/volrmmount/Makefile2
-rwxr-xr-xusr/src/cmd/vscan/vscanadm/Makefile4
-rw-r--r--usr/src/cmd/vscan/vscand/Makefile2
-rw-r--r--usr/src/cmd/vtfontcvt/Makefile.common2
-rw-r--r--usr/src/cmd/zdb/Makefile.com2
-rw-r--r--usr/src/cmd/zdb/zdb.c8
-rw-r--r--usr/src/cmd/zfs/Makefile2
-rw-r--r--usr/src/cmd/zhack/Makefile.com2
-rw-r--r--usr/src/cmd/zinject/Makefile.com2
-rw-r--r--usr/src/cmd/zlook/Makefile.com2
-rw-r--r--usr/src/cmd/zstreamdump/Makefile2
-rw-r--r--usr/src/cmd/ztest/Makefile.com2
-rw-r--r--usr/src/lib/brand/solaris10/s10_brand/Makefile.com2
-rw-r--r--usr/src/lib/fm/libfmd_snmp/Makefile.com2
-rw-r--r--usr/src/lib/fm/libfmevent/Makefile.com2
-rw-r--r--usr/src/lib/fm/libfmnotify/Makefile.com2
-rw-r--r--usr/src/lib/fm/topo/modules/Makefile.plugin2
-rw-r--r--usr/src/lib/libads/Makefile.com2
-rw-r--r--usr/src/lib/libadutils/Makefile.com2
-rw-r--r--usr/src/lib/libbc/Makefile4
-rw-r--r--usr/src/lib/libbc/sparc/Makefile2
-rw-r--r--usr/src/lib/libbe/Makefile.com2
-rw-r--r--usr/src/lib/libc/amd64/Makefile2
-rw-r--r--usr/src/lib/libc/i386/Makefile.com2
-rw-r--r--usr/src/lib/libc/port/llib-lc20
-rw-r--r--usr/src/lib/libc/sparc/Makefile.com2
-rw-r--r--usr/src/lib/libc/sparcv9/Makefile.com2
-rw-r--r--usr/src/lib/libdisasm/Makefile.com2
-rw-r--r--usr/src/lib/libdns_sd/Makefile.com2
-rw-r--r--usr/src/lib/libdns_sd/java/Makefile.com2
-rw-r--r--usr/src/lib/libfakekernel/Makefile.com2
-rw-r--r--usr/src/lib/libfcoe/Makefile.com2
-rw-r--r--usr/src/lib/libfdisk/Makefile.com2
-rw-r--r--usr/src/lib/libficl/Makefile.com2
-rw-r--r--usr/src/lib/libidmap/Makefile.com2
-rw-r--r--usr/src/lib/libilb/Makefile.com2
-rw-r--r--usr/src/lib/libinetsvc/Makefile.com2
-rw-r--r--usr/src/lib/libipmi/Makefile.com2
-rw-r--r--usr/src/lib/libiscsit/Makefile.com2
-rw-r--r--usr/src/lib/libm/Makefile.libm.com8
-rw-r--r--usr/src/lib/libndmp/Makefile.com2
-rw-r--r--usr/src/lib/libnsctl/Makefile.com2
-rw-r--r--usr/src/lib/libnvpair/Makefile.com2
-rw-r--r--usr/src/lib/libproc/Makefile.com2
-rw-r--r--usr/src/lib/libresolv/Makefile2
-rw-r--r--usr/src/lib/librestart/Makefile.com4
-rw-r--r--usr/src/lib/libsaveargs/tests/dump/Makefile2
-rw-r--r--usr/src/lib/libscf/Makefile.com2
-rw-r--r--usr/src/lib/libshare/Makefile.com2
-rw-r--r--usr/src/lib/libsmbfs/Makefile.com2
-rw-r--r--usr/src/lib/libsrpt/Makefile.com2
-rw-r--r--usr/src/lib/libstmf/Makefile.com2
-rw-r--r--usr/src/lib/libstmfproxy/Makefile.com2
-rw-r--r--usr/src/lib/libv12n/sparc/Makefile2
-rw-r--r--usr/src/lib/libv12n/sparcv9/Makefile2
-rw-r--r--usr/src/lib/libvrrpadm/Makefile.com2
-rw-r--r--usr/src/lib/libzfs/Makefile.com2
-rw-r--r--usr/src/lib/libzfs_core/Makefile.com2
-rw-r--r--usr/src/lib/libzpool/Makefile.com2
-rw-r--r--usr/src/lib/nsswitch/mdns/Makefile.com4
-rw-r--r--usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com2
-rw-r--r--usr/src/lib/policykit/Makefile.com2
-rw-r--r--usr/src/lib/pylibbe/Makefile.com2
-rw-r--r--usr/src/lib/pysolaris/Makefile.com2
-rw-r--r--usr/src/lib/pyzfs/Makefile.com2
-rw-r--r--usr/src/lib/scsi/libscsi/Makefile.com2
-rw-r--r--usr/src/lib/scsi/libses/Makefile.defs2
-rw-r--r--usr/src/lib/scsi/libsmp/Makefile.com2
-rw-r--r--usr/src/lib/scsi/plugins/scsi/engines/Makefile.engine3
-rw-r--r--usr/src/lib/scsi/plugins/ses/Makefile.lib3
-rw-r--r--usr/src/lib/scsi/plugins/smp/Makefile.lib2
-rw-r--r--usr/src/lib/smbsrv/Makefile.lib3
-rw-r--r--usr/src/man/man7p/tcp.7p9
-rw-r--r--usr/src/man/man9/iport.94
-rw-r--r--usr/src/man/man9f/scsi_address_device.9f6
-rw-r--r--usr/src/man/man9f/scsi_hba_iportmap_create.9f1
-rw-r--r--usr/src/pkg/manifests/system-kernel.man9.inc4
-rw-r--r--usr/src/pkg/manifests/system-kernel.man9f.inc66
-rw-r--r--usr/src/psm/stand/bootlst/common/Makefile.com4
-rw-r--r--usr/src/psm/stand/cpr/common/Makefile.com4
-rw-r--r--usr/src/test/crypto-tests/tests/modes/aes/Makefile.subdirs2
-rw-r--r--usr/src/test/libc-tests/tests/Makefile.com2
-rw-r--r--usr/src/test/libc-tests/tests/select/Makefile2
-rw-r--r--usr/src/test/os-tests/tests/file-locking/Makefile2
-rw-r--r--usr/src/test/os-tests/tests/poll/Makefile2
-rw-r--r--usr/src/test/os-tests/tests/sigqueue/Makefile2
-rw-r--r--usr/src/test/os-tests/tests/sockfs/Makefile2
-rw-r--r--usr/src/test/os-tests/tests/spoof-ras/Makefile2
-rw-r--r--usr/src/test/zfs-tests/cmd/Makefile.subdirs2
-rw-r--r--usr/src/test/zfs-tests/tests/functional/channel_program/lua_core/Makefile2
-rw-r--r--usr/src/test/zfs-tests/tests/functional/checksum/Makefile.subdirs2
-rw-r--r--usr/src/tools/btxld/Makefile2
-rw-r--r--usr/src/tools/ctf/cvt/Makefile.com2
-rw-r--r--usr/src/uts/Makefile.uts2
-rw-r--r--usr/src/uts/common/fs/zfs/spa.c870
-rw-r--r--usr/src/uts/common/fs/zfs/spa_misc.c28
-rw-r--r--usr/src/uts/common/fs/zfs/sys/spa.h2
-rw-r--r--usr/src/uts/common/fs/zfs/sys/vdev.h3
-rw-r--r--usr/src/uts/common/fs/zfs/vdev.c76
-rw-r--r--usr/src/uts/common/fs/zfs/vdev_disk.c11
-rw-r--r--usr/src/uts/common/fs/zfs/vdev_label.c11
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_acl.c2
-rw-r--r--usr/src/uts/i86pc/Makefile.rules2
-rw-r--r--usr/src/uts/i86xpv/Makefile.rules2
-rw-r--r--usr/src/uts/intel/bfe/Makefile2
-rw-r--r--usr/src/uts/intel/bnxe/Makefile1
-rw-r--r--usr/src/uts/intel/chxge/Makefile2
-rw-r--r--usr/src/uts/intel/cxgbe/cxgbe/Makefile1
-rw-r--r--usr/src/uts/intel/cxgbe/t4nex/Makefile1
-rw-r--r--usr/src/uts/intel/dca/Makefile3
-rw-r--r--usr/src/uts/intel/fct/Makefile1
-rw-r--r--usr/src/uts/intel/iscsit/Makefile1
-rw-r--r--usr/src/uts/intel/nsmb/Makefile1
-rw-r--r--usr/src/uts/intel/pppt/Makefile1
-rw-r--r--usr/src/uts/intel/qlge/Makefile1
-rw-r--r--usr/src/uts/intel/qlt/Makefile1
-rw-r--r--usr/src/uts/intel/sfe/Makefile2
-rw-r--r--usr/src/uts/intel/smbfs/Makefile1
-rw-r--r--usr/src/uts/intel/srpt/Makefile1
-rw-r--r--usr/src/uts/intel/stmf/Makefile1
-rw-r--r--usr/src/uts/intel/stmf_sbd/Makefile1
-rw-r--r--usr/src/uts/intel/xge/Makefile4
-rw-r--r--usr/src/uts/intel/zfs/Makefile1
-rw-r--r--usr/src/uts/intel/zut/Makefile1
-rw-r--r--usr/src/uts/sparc/Makefile.sparc2
-rw-r--r--usr/src/uts/sparc/bnxe/Makefile1
-rw-r--r--usr/src/uts/sparc/chxge/Makefile2
-rw-r--r--usr/src/uts/sparc/dca/Makefile1
-rw-r--r--usr/src/uts/sparc/fct/Makefile1
-rw-r--r--usr/src/uts/sparc/iscsit/Makefile1
-rw-r--r--usr/src/uts/sparc/nsmb/Makefile1
-rw-r--r--usr/src/uts/sparc/pppt/Makefile1
-rw-r--r--usr/src/uts/sparc/qlge/Makefile1
-rw-r--r--usr/src/uts/sparc/qlt/Makefile1
-rw-r--r--usr/src/uts/sparc/sfe/Makefile2
-rw-r--r--usr/src/uts/sparc/smbfs/Makefile1
-rw-r--r--usr/src/uts/sparc/srpt/Makefile1
-rw-r--r--usr/src/uts/sparc/stmf/Makefile1
-rw-r--r--usr/src/uts/sparc/stmf_sbd/Makefile1
-rw-r--r--usr/src/uts/sparc/xge/Makefile4
-rw-r--r--usr/src/uts/sparc/zfs/Makefile1
-rw-r--r--usr/src/uts/sparc/zut/Makefile1
-rw-r--r--usr/src/uts/sun4u/Makefile.sun4u2
-rw-r--r--usr/src/uts/sun4v/Makefile.sun4v2
-rw-r--r--usr/src/uts/sun4v/vsw/Makefile11
254 files changed, 1234 insertions, 579 deletions
diff --git a/usr/src/Makefile.ast b/usr/src/Makefile.ast
index 4dda28afa2..1a85c1c7e7 100644
--- a/usr/src/Makefile.ast
+++ b/usr/src/Makefile.ast
@@ -26,7 +26,7 @@
# Override this top level flag so the compiler builds in its native
# C99 mode. This has been enabled to support the math stuff in the
# AST tools (including ksh93).
-C99MODE= $(C99_ENABLE) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
+CSTD= $(CSTD_GNU99) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
# silence common AST&co. warnings...
# ... about |#pragma prototyped| ...
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master
index 253211f50c..3e5ddf3eeb 100644
--- a/usr/src/Makefile.master
+++ b/usr/src/Makefile.master
@@ -408,11 +408,11 @@ $(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-empty-body
# turn warnings into errors (C++)
CCERRWARN= -xwe
-# C99 mode
-C99_ENABLE= -xc99=%all
-C99_DISABLE= -xc99=%none
-C99MODE= $(C99_DISABLE)
-C99LMODE= $(C99MODE:-xc99%=-Xc99%)
+# C standard. Keep Studio flags until we get rid of lint.
+CSTD_GNU89= -xc99=%none
+CSTD_GNU99= -xc99=%all
+CSTD= $(CSTD_GNU89)
+C99LMODE= $(CSTD:-xc99%=-Xc99%)
# In most places, assignments to these macros should be appended with +=
# (CPPFLAGS.first allows values to be prepended to CPPFLAGS).
@@ -470,8 +470,8 @@ DEBUGFORMAT= -xdebugformat=stabs
# Flags used to build in debug mode for ctf generation. Bugs in the Devpro
# compilers currently prevent us from building with cc-emitted DWARF.
#
-CTF_FLAGS_sparc = -g -Wc,-Qiselect-T1 $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR)
-CTF_FLAGS_i386 = -g $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR)
+CTF_FLAGS_sparc = -g -Wc,-Qiselect-T1 $(CSTD) $(CNOGLOBAL) $(CDWARFSTR)
+CTF_FLAGS_i386 = -g $(CSTD) $(CNOGLOBAL) $(CDWARFSTR)
CTF_FLAGS_sparcv9 = $(CTF_FLAGS_sparc)
CTF_FLAGS_amd64 = $(CTF_FLAGS_i386)
@@ -553,11 +553,11 @@ $(SRCDBGBLD)CSOURCEDEBUGFLAGS = -g -xs
$(SRCDBGBLD)CCSOURCEDEBUGFLAGS = -g -xs
CFLAGS= $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
- $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG) \
+ $(ILDOFF) $(CERRWARN) $(CSTD) $(CCUNBOUND) $(IROPTFLAG) \
$(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
$(CUSERFLAGS)
CFLAGS64= $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
- $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG64) \
+ $(ILDOFF) $(CERRWARN) $(CSTD) $(CCUNBOUND) $(IROPTFLAG64) \
$(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
$(CUSERFLAGS64)
#
@@ -565,7 +565,7 @@ CFLAGS64= $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
# run on the build machine (also known as the NATIVE_BUILD).
#
NATIVE_CFLAGS= $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
- $(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND) \
+ $(ILDOFF) $(CERRWARN) $(CSTD) $($(NATIVE_MACH)_CCUNBOUND) \
$(IROPTFLAG) $(CGLOBALSTATIC) $(CCNOAUTOINLINE) \
$(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
diff --git a/usr/src/boot/sys/boot/common/multiboot2.c b/usr/src/boot/sys/boot/common/multiboot2.c
index 876a5cd6a2..0e3b7bbaa3 100644
--- a/usr/src/boot/sys/boot/common/multiboot2.c
+++ b/usr/src/boot/sys/boot/common/multiboot2.c
@@ -791,8 +791,9 @@ multiboot2_exec(struct preloaded_file *fp)
size_t size;
struct bios_smap *smap;
#if defined (EFI)
- multiboot_tag_module_t *module;
+ multiboot_tag_module_t *module, *mp;
EFI_MEMORY_DESCRIPTOR *map;
+ UINTN map_size, desc_size;
struct relocator *relocator;
struct chunk_head *head;
struct chunk *chunk;
@@ -928,7 +929,7 @@ multiboot2_exec(struct preloaded_file *fp)
* - tmp != mfp->f_addr only in case of EFI.
*/
#if defined (EFI)
- tmp = roundup2(load_addr + fp->f_size, MULTIBOOT_MOD_ALIGN);
+ tmp = roundup2(load_addr + fp->f_size + 1, MULTIBOOT_MOD_ALIGN);
module = (multiboot_tag_module_t *)last_addr;
#endif
@@ -958,9 +959,12 @@ multiboot2_exec(struct preloaded_file *fp)
tag->mb_type = MULTIBOOT_TAG_TYPE_MODULE;
tag->mb_size = sizeof (*tag) + num;
#if defined (EFI)
- tag->mb_mod_start = tmp;
- tag->mb_mod_end = tmp + mfp->f_size;
- tmp = roundup2(tag->mb_mod_end + 1, MULTIBOOT_MOD_ALIGN);
+ /*
+ * We can assign module addresses only after BS have been
+ * switched off.
+ */
+ tag->mb_mod_start = 0;
+ tag->mb_mod_end = mfp->f_size;
#else
tag->mb_mod_start = mfp->f_addr;
tag->mb_mod_end = mfp->f_addr + mfp->f_size;
@@ -1100,21 +1104,21 @@ multiboot2_exec(struct preloaded_file *fp)
/* Leave EFI memmap last as we will also switch off the BS. */
{
multiboot_tag_efi_mmap_t *tag;
- UINTN size, desc_size, key;
+ UINTN key;
EFI_STATUS status;
tag = (multiboot_tag_efi_mmap_t *)
mb_malloc(sizeof (*tag));
- size = 0;
- status = BS->GetMemoryMap(&size,
+ map_size = 0;
+ status = BS->GetMemoryMap(&map_size,
(EFI_MEMORY_DESCRIPTOR *)tag->mb_efi_mmap, &key,
&desc_size, &tag->mb_descr_vers);
if (status != EFI_BUFFER_TOO_SMALL) {
error = EINVAL;
goto error;
}
- status = BS->GetMemoryMap(&size,
+ status = BS->GetMemoryMap(&map_size,
(EFI_MEMORY_DESCRIPTOR *)tag->mb_efi_mmap, &key,
&desc_size, &tag->mb_descr_vers);
if (EFI_ERROR(status)) {
@@ -1122,7 +1126,7 @@ multiboot2_exec(struct preloaded_file *fp)
goto error;
}
tag->mb_type = MULTIBOOT_TAG_TYPE_EFI_MMAP;
- tag->mb_size = sizeof (*tag) + size;
+ tag->mb_size = sizeof (*tag) + map_size;
tag->mb_descr_size = (uint32_t) desc_size;
/*
@@ -1132,7 +1136,7 @@ multiboot2_exec(struct preloaded_file *fp)
* relocator data, trampoline, copy, memmove, stack.
*/
for (i = 0, map = (EFI_MEMORY_DESCRIPTOR *)tag->mb_efi_mmap;
- i < size / desc_size;
+ i < map_size / desc_size;
i++, map = NextMemoryDescriptor(map, desc_size)) {
if (map->PhysicalStart == 0)
continue;
@@ -1154,7 +1158,7 @@ multiboot2_exec(struct preloaded_file *fp)
}
}
- last_addr += size;
+ last_addr += map_size;
last_addr = roundup2(last_addr, MULTIBOOT_TAG_ALIGN);
}
#endif
@@ -1191,20 +1195,32 @@ multiboot2_exec(struct preloaded_file *fp)
STAILQ_INSERT_TAIL(head, chunk, chunk_next);
+ mp = module;
for (mfp = fp->f_next; mfp != NULL; mfp = mfp->f_next) {
chunk = &relocator->rel_chunklist[i++];
chunk->chunk_vaddr = mfp->f_addr;
- chunk->chunk_paddr = module->mb_mod_start;
+
+ /*
+ * fix the mb_mod_start and mb_mod_end.
+ */
+ mp->mb_mod_start = efi_physaddr(module, tmp, map,
+ map_size / desc_size, desc_size, mp->mb_mod_end);
+ if (mp->mb_mod_start == 0)
+ panic("Could not find memory for module\n");
+
+ mp->mb_mod_end += mp->mb_mod_start;
+ chunk->chunk_paddr = mp->mb_mod_start;
chunk->chunk_size = mfp->f_size;
STAILQ_INSERT_TAIL(head, chunk, chunk_next);
- module = (multiboot_tag_module_t *)
- roundup2((uintptr_t)module + module->mb_size,
+ mp = (multiboot_tag_module_t *)
+ roundup2((uintptr_t)mp + mp->mb_size,
MULTIBOOT_TAG_ALIGN);
}
chunk = &relocator->rel_chunklist[i++];
chunk->chunk_vaddr = (EFI_VIRTUAL_ADDRESS)mbi;
- chunk->chunk_paddr = tmp;
+ chunk->chunk_paddr = efi_physaddr(module, tmp, map,
+ map_size / desc_size, desc_size, mbi->mbi_total_size);
chunk->chunk_size = mbi->mbi_total_size;
STAILQ_INSERT_TAIL(head, chunk, chunk_next);
diff --git a/usr/src/boot/sys/boot/efi/loader/copy.c b/usr/src/boot/sys/boot/efi/loader/copy.c
index a4f44bc072..9658a659d4 100644
--- a/usr/src/boot/sys/boot/efi/loader/copy.c
+++ b/usr/src/boot/sys/boot/efi/loader/copy.c
@@ -1,4 +1,4 @@
-/*-
+/*
* Copyright (c) 2013 The FreeBSD Foundation
* All rights reserved.
*
@@ -41,6 +41,110 @@
#include "loader_efi.h"
/*
+ * Verify the address is not in use by existing modules.
+ */
+static vm_offset_t
+addr_verify(multiboot_tag_module_t *module, vm_offset_t addr, size_t size)
+{
+ vm_offset_t start, end;
+
+ for (;module->mb_type == MULTIBOOT_TAG_TYPE_MODULE;
+ module = (multiboot_tag_module_t *)
+ roundup((uintptr_t)module + module->mb_size, MULTIBOOT_TAG_ALIGN)) {
+
+ start = module->mb_mod_start;
+ end = module->mb_mod_end;
+
+ /* Does this module have address assigned? */
+ if (start == 0)
+ continue;
+
+ if ((start <= addr) && (end >= addr)) {
+ return (0);
+ }
+ if ((start >= addr) && (start <= addr + size)) {
+ return (0);
+ }
+ }
+ return (addr);
+}
+
+/*
+ * Find memory map entry above 1MB, able to contain size bytes from addr.
+ */
+static vm_offset_t
+memmap_find(EFI_MEMORY_DESCRIPTOR *map, size_t count, UINTN dsize,
+ vm_offset_t addr, size_t size)
+{
+ int i;
+
+ for (i = 0; i < count; i++, map = NextMemoryDescriptor(map, dsize)) {
+
+ if (map->Type != EfiConventionalMemory)
+ continue;
+
+ /* We do not want address below 1MB. */
+ if (map->PhysicalStart < 0x100000)
+ continue;
+
+ /* Do we fit into current entry? */
+ if ((map->PhysicalStart <= addr) &&
+ (map->PhysicalStart +
+ (map->NumberOfPages << EFI_PAGE_SHIFT) >= addr + size)) {
+ return (addr);
+ }
+
+ /* Do we fit into new entry? */
+ if ((map->PhysicalStart > addr) &&
+ (map->NumberOfPages >= EFI_SIZE_TO_PAGES(size))) {
+ return (map->PhysicalStart);
+ }
+ }
+ return (0);
+}
+
+/*
+ * Find usable address for loading. The address for the kernel is fixed, as
+ * it is determined by kernel linker map (dboot PT_LOAD address).
+ * For modules, we need to consult memory map, the module address has to be
+ * aligned to page boundary and we have to fit into map entry.
+ */
+vm_offset_t
+efi_physaddr(multiboot_tag_module_t *module, vm_offset_t addr,
+ EFI_MEMORY_DESCRIPTOR *map, size_t count, UINTN dsize, size_t size)
+{
+ multiboot_tag_module_t *mp;
+ vm_offset_t off;
+
+ if (addr == 0)
+ return (addr);
+
+ mp = module;
+ do {
+ off = addr;
+ /* Test proposed address */
+ off = memmap_find(map, count, dsize, off, size);
+ if (off != 0)
+ off = addr_verify(module, off, size);
+ if (off != 0)
+ break;
+
+ /* The module list is exhausted */
+ if (mp->mb_type != MULTIBOOT_TAG_TYPE_MODULE)
+ break;
+
+ if (mp->mb_mod_start != 0) {
+ addr = roundup2(mp->mb_mod_end + 1,
+ MULTIBOOT_MOD_ALIGN);
+ }
+ mp = (multiboot_tag_module_t *)
+ roundup((uintptr_t)mp + mp->mb_size, MULTIBOOT_TAG_ALIGN);
+ } while (off == 0);
+
+ return (off);
+}
+
+/*
* Allocate pages for data to be loaded. As we can not expect AllocateAddress
* to succeed, we allocate using AllocateMaxAddress from 4GB limit.
* 4GB limit is because reportedly some 64bit systems are reported to have
diff --git a/usr/src/boot/sys/boot/efi/loader/loader_efi.h b/usr/src/boot/sys/boot/efi/loader/loader_efi.h
index 6378a662d3..59b1ecc5bd 100644
--- a/usr/src/boot/sys/boot/efi/loader/loader_efi.h
+++ b/usr/src/boot/sys/boot/efi/loader/loader_efi.h
@@ -65,6 +65,8 @@ ssize_t efi_readin(const int, vm_offset_t, const size_t);
uint64_t efi_loadaddr(u_int, void *, uint64_t);
void efi_free_loadaddr(uint64_t, uint64_t);
void * efi_translate(vm_offset_t);
+vm_offset_t efi_physaddr(multiboot_tag_module_t *, vm_offset_t,
+ EFI_MEMORY_DESCRIPTOR *, size_t, UINTN, size_t);
multiboot2_info_header_t *efi_copy_finish(struct relocator *);
void multiboot_tramp(uint32_t, struct relocator *, uint64_t);
diff --git a/usr/src/cmd/boot/bootadm/Makefile b/usr/src/cmd/boot/bootadm/Makefile
index ad060b375c..b25c45ce04 100644
--- a/usr/src/cmd/boot/bootadm/Makefile
+++ b/usr/src/cmd/boot/bootadm/Makefile
@@ -51,7 +51,7 @@ CFLAGS += $(XSTRCONST)
CPPFLAGS += -D_FILE_OFFSET_BITS=64
CPPFLAGS += -I$(SRC)/uts/common -I$(SRC)/common -I$(SRC)/common/ficl
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LINTFLAGS += -erroff=E_INCONS_ARG_DECL2
LINTFLAGS += -erroff=E_INCONS_VAL_TYPE_DECL2
diff --git a/usr/src/cmd/boot/installboot/Makefile.com b/usr/src/cmd/boot/installboot/Makefile.com
index 566e48c42a..1cd8454078 100644
--- a/usr/src/cmd/boot/installboot/Makefile.com
+++ b/usr/src/cmd/boot/installboot/Makefile.com
@@ -37,7 +37,7 @@ CPPFLAGS += -I$(SRC)/uts/common
LDLIBS += -lmd5
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LINTFLAGS += -erroff=E_BAD_PTR_CAST_ALIGN
diff --git a/usr/src/cmd/boot/installgrub/Makefile b/usr/src/cmd/boot/installgrub/Makefile
index 56dfeac536..3269e7d7ef 100644
--- a/usr/src/cmd/boot/installgrub/Makefile
+++ b/usr/src/cmd/boot/installgrub/Makefile
@@ -55,7 +55,7 @@ LINTFLAGS += \
-xerroff=E_NAME_DEF_NOT_USED2
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/cmd-inet/usr.bin/dns-sd/Makefile b/usr/src/cmd/cmd-inet/usr.bin/dns-sd/Makefile
index 293a4f5976..24028e7f42 100644
--- a/usr/src/cmd/cmd-inet/usr.bin/dns-sd/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.bin/dns-sd/Makefile
@@ -23,7 +23,7 @@ include ../../Makefile.cmd-inet
OBJS= ClientCommon.o dns-sd.o
SRCS= ClientCommon.c dns-sd.c
-CFLAGS += $(C99_ENABLE)
+CFLAGS += $(CSTD_GNU99)
CPPFLAGS += -DMDNS_VERSIONSTR_NODTS
LDLIBS += -lsocket -ldns_sd
diff --git a/usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile
index d00653d4eb..2648c7cf05 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.lib/ilbd/Makefile
@@ -53,7 +53,7 @@ CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-unused-label
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
# I18n
POFILE = $(ILBD).po
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/Makefile
index 7f08f59b90..f28c630ac3 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/Makefile
@@ -36,7 +36,7 @@ ROOTCMDDIR = $(ROOT)/lib/inet
POFILE = $(PROG).po
POFILES = $(SRCS:%.c=%.po)
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
#
# We need access to the ancillary data features which are only available
diff --git a/usr/src/cmd/cmd-inet/usr.lib/mdnsd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/mdnsd/Makefile
index 128bb637b4..e110c4ef48 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/mdnsd/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.lib/mdnsd/Makefile
@@ -68,7 +68,7 @@ $(PROG): $(OBJS)
include ../Makefile.lib
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CPPFLAGS += -D_REENTRANT $(MDNSFLAGS) -I$(CMN_DIR)
LDLIBS += -lsocket -lnsl
diff --git a/usr/src/cmd/cmd-inet/usr.lib/vrrpd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/vrrpd/Makefile
index 12a621d55f..0039ea5f6a 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/vrrpd/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.lib/vrrpd/Makefile
@@ -37,7 +37,7 @@ $(ROOTETC)/inet/$(CFGFILES):= FILEMODE= 644
$(ROOTETC)/inet/$(CFGFILES):= OWNER= root
$(ROOTETC)/inet/$(CFGFILES):= GROUP= sys
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
#
# We need access to the ancillary data features which are only available
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/ilbadm/Makefile b/usr/src/cmd/cmd-inet/usr.sbin/ilbadm/Makefile
index b9307b48cc..5b2f2eb275 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/ilbadm/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.sbin/ilbadm/Makefile
@@ -39,7 +39,7 @@ CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-uninitialized
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
POFILES = $(OBJS:%.o=%.po)
POFILE = $(PROG)_all.po
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/ipmpstat/Makefile b/usr/src/cmd/cmd-inet/usr.sbin/ipmpstat/Makefile
index a15c3fce80..cb0ca92b43 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/ipmpstat/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.sbin/ipmpstat/Makefile
@@ -28,7 +28,7 @@ ROOTUSRSBINLINKS = $(PROG:%=$(ROOTUSRSBIN)/%)
include $(SRC)/cmd/Makefile.cmd
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-uninitialized
LDLIBS += -lipmp -lsocket -lsysevent -lnvpair -lofmt
XGETFLAGS += -a -x $(PROG).xcl
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/ping/Makefile b/usr/src/cmd/cmd-inet/usr.sbin/ping/Makefile
index 504d64b4ef..905f389570 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/ping/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.sbin/ping/Makefile
@@ -41,8 +41,7 @@ LDLIBS += -lxnet -lsocket -lnsl -lm -linetutil
# These #defines are required to use SUSv3 interfaces
CPPFLAGS += -D_XOPEN_SOURCE=600 -D__EXTENSIONS__
-C99MODE= -xc99=%all
-C99LMODE= -Xc99=%all
+CSTD= $(CSTD_GNU99)
# Setting the above defines to use the UNIX98 ancillary data feature
# causes lint to output warnings about lint library declarations conflicting
diff --git a/usr/src/cmd/coreadm/Makefile b/usr/src/cmd/coreadm/Makefile
index 390212d227..38ac91763a 100644
--- a/usr/src/cmd/coreadm/Makefile
+++ b/usr/src/cmd/coreadm/Makefile
@@ -34,7 +34,7 @@ ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
CFLAGS += $(CCVERBOSE)
LDLIBS += -lproc -lscf
-C99MODE=$(C99_ENABLE)
+CSTD=$(CSTD_GNU99)
all: $(PROG)
diff --git a/usr/src/cmd/diskinfo/Makefile b/usr/src/cmd/diskinfo/Makefile
index daee372303..10cda55ca7 100644
--- a/usr/src/cmd/diskinfo/Makefile
+++ b/usr/src/cmd/diskinfo/Makefile
@@ -20,7 +20,7 @@ SRCS= $(OBJS:%.o=%.c)
include $(SRC)/cmd/Makefile.cmd
include $(SRC)/cmd/Makefile.ctf
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CPPFLAGS += -I$(SRC)/lib/fm/topo
diff --git a/usr/src/cmd/fm/notify/smtp-notify/Makefile.com b/usr/src/cmd/fm/notify/smtp-notify/Makefile.com
index d8861ea62b..2d27ca3387 100644
--- a/usr/src/cmd/fm/notify/smtp-notify/Makefile.com
+++ b/usr/src/cmd/fm/notify/smtp-notify/Makefile.com
@@ -45,7 +45,7 @@ $(ROOTNOTIFYPARAMS) := FILEMODE = 0444
$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
CPPFLAGS += -I. -I../common -I../../../../../lib/fm/libfmnotify/common
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST)
LDLIBS += -L$(ROOT)/usr/lib/fm -lnvpair -lfmevent -lfmd_msg -lfmnotify \
-lumem
diff --git a/usr/src/cmd/fm/notify/snmp-notify/Makefile.com b/usr/src/cmd/fm/notify/snmp-notify/Makefile.com
index 13c78c7ea2..03905b1c76 100644
--- a/usr/src/cmd/fm/notify/snmp-notify/Makefile.com
+++ b/usr/src/cmd/fm/notify/snmp-notify/Makefile.com
@@ -43,7 +43,7 @@ $(ROOTNOTIFYPARAMS) := FILEMODE = 0444
$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
CPPFLAGS += -I. -I../common -I../../../../../lib/fm/libfmnotify/common
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST)
LDLIBS += -L$(ROOT)/usr/lib/fm -lnvpair -lfmevent -lfmd_msg -lfmnotify \
-lumem -lnetsnmp -lnetsnmpagent
diff --git a/usr/src/cmd/fs.d/nfs/lockd/Makefile b/usr/src/cmd/fs.d/nfs/lockd/Makefile
index ce725cd336..19c459d9f5 100644
--- a/usr/src/cmd/fs.d/nfs/lockd/Makefile
+++ b/usr/src/cmd/fs.d/nfs/lockd/Makefile
@@ -38,7 +38,7 @@ SRCS = $(LOCAL:%.o=%.c) ../lib/daemon.c ../lib/nfs_tbind.c \
../lib/smfcfg.c ../lib/thrpool.c
LDLIBS += -lnsl -lscf
CPPFLAGS += -I../lib
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-switch
diff --git a/usr/src/cmd/fs.d/reparsed/Makefile b/usr/src/cmd/fs.d/reparsed/Makefile
index e61d7140f4..ed38b26723 100644
--- a/usr/src/cmd/fs.d/reparsed/Makefile
+++ b/usr/src/cmd/fs.d/reparsed/Makefile
@@ -38,7 +38,7 @@ CLOBBERFILES += $(TYPEPROG)
CFLAGS += $(CCVERBOSE)
CERRWARN += -_gcc=-Wno-unused-variable
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LDLIBS += -lreparse -lnsl
diff --git a/usr/src/cmd/fs.d/smbclnt/chacl/Makefile b/usr/src/cmd/fs.d/smbclnt/chacl/Makefile
index 52a9d04112..f3aabe62a4 100644
--- a/usr/src/cmd/fs.d/smbclnt/chacl/Makefile
+++ b/usr/src/cmd/fs.d/smbclnt/chacl/Makefile
@@ -37,7 +37,7 @@ LDLIBS += -lsmbfs -lsec
CFLAGS += $(CCVERBOSE)
CERRWARN += -_gcc=-Wno-unused-variable
CERRWARN += -_gcc=-Wno-unused-label
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CLOBBERFILES += $(LIBPROG)
diff --git a/usr/src/cmd/fs.d/smbclnt/lsacl/Makefile b/usr/src/cmd/fs.d/smbclnt/lsacl/Makefile
index fad9235ecd..3442d7a786 100644
--- a/usr/src/cmd/fs.d/smbclnt/lsacl/Makefile
+++ b/usr/src/cmd/fs.d/smbclnt/lsacl/Makefile
@@ -36,7 +36,7 @@ LDLIBS += -lsmbfs -lsec
CFLAGS += $(CCVERBOSE)
CERRWARN += -_gcc=-Wno-unused-label
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CLOBBERFILES += $(LIBPROG)
diff --git a/usr/src/cmd/fs.d/smbclnt/mount/Makefile b/usr/src/cmd/fs.d/smbclnt/mount/Makefile
index 0124840e23..8f61e99026 100644
--- a/usr/src/cmd/fs.d/smbclnt/mount/Makefile
+++ b/usr/src/cmd/fs.d/smbclnt/mount/Makefile
@@ -43,7 +43,7 @@ $(ROOTLIBFSTYPE)/mount := FILEMODE= 04555
CFLAGS += $(CCVERBOSE)
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-unused-label
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LDLIBS += -lsmbfs
diff --git a/usr/src/cmd/fs.d/smbclnt/smbiod-svc/Makefile b/usr/src/cmd/fs.d/smbclnt/smbiod-svc/Makefile
index 29155e44f8..a5dbf68bd9 100644
--- a/usr/src/cmd/fs.d/smbclnt/smbiod-svc/Makefile
+++ b/usr/src/cmd/fs.d/smbclnt/smbiod-svc/Makefile
@@ -37,7 +37,7 @@ SRCS= $(TYPEPROG).c
POFILE= $(TYPEPROG).po
CFLAGS += $(CCVERBOSE)
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CPPFLAGS += -I$(SRC)/lib/libsmbfs \
-I$(SRC)/uts/common/smbclnt -I$(SRC)/uts/common
diff --git a/usr/src/cmd/fs.d/smbclnt/smbiod/Makefile b/usr/src/cmd/fs.d/smbclnt/smbiod/Makefile
index f54d107d49..7acbf30f86 100644
--- a/usr/src/cmd/fs.d/smbclnt/smbiod/Makefile
+++ b/usr/src/cmd/fs.d/smbclnt/smbiod/Makefile
@@ -37,7 +37,7 @@ SRCS= $(TYPEPROG).c
POFILE= $(TYPEPROG).po
CFLAGS += $(CCVERBOSE)
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
# This is a multi-thread program but Nevada
# no longer needs -lthread
diff --git a/usr/src/cmd/fs.d/smbclnt/smbutil/Makefile b/usr/src/cmd/fs.d/smbclnt/smbutil/Makefile
index 31d52961fe..5b751cce22 100644
--- a/usr/src/cmd/fs.d/smbclnt/smbutil/Makefile
+++ b/usr/src/cmd/fs.d/smbclnt/smbutil/Makefile
@@ -39,7 +39,7 @@ POFILE= smbutil_all.po
POFILES= $(OBJS:%.o=%.po)
CLOBBERFILES+= $(POFILE) $(POFILES)
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LDLIBS += -lsmbfs -lnsl
diff --git a/usr/src/cmd/fs.d/smbclnt/test/Makefile b/usr/src/cmd/fs.d/smbclnt/test/Makefile
index 62eb716f5f..64b626f5a4 100644
--- a/usr/src/cmd/fs.d/smbclnt/test/Makefile
+++ b/usr/src/cmd/fs.d/smbclnt/test/Makefile
@@ -49,7 +49,7 @@ LINTLIBS= -L$(ROOTLIB) -lsmbfs
CFLAGS += $(CCVERBOSE)
CERRWARN += -_gcc=-Wno-unused-variable
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LINTFLAGS += -erroff=E_FUNC_RET_ALWAYS_IGNOR2
diff --git a/usr/src/cmd/getconf/Makefile b/usr/src/cmd/getconf/Makefile
index 6293596e58..8d5bc7041a 100644
--- a/usr/src/cmd/getconf/Makefile
+++ b/usr/src/cmd/getconf/Makefile
@@ -43,7 +43,7 @@ $(XPG4) := CFLAGS += -D_XOPEN_SOURCE -I$(SRC)/lib/libc/inc
# XPG6MODE: Depending on the version of the compiler, the value of
# __STDC_VERSION__ may differ even in the presence of the same compilation
# options. The default compilation mode for Sun compilers that support the
-# C99 standard is -xc99=all,no_lib. C99MODE= is equivalent to -xc99=all,no_lib.
+# C99 standard is -xc99=all,no_lib. CSTD= is equivalent to -xc99=all,no_lib.
# This translates to C99 semantics without the C99 library specific behaviors
# and dependencies.
#
@@ -53,8 +53,8 @@ $(XPG4) := CFLAGS += -D_XOPEN_SOURCE -I$(SRC)/lib/libc/inc
# maintain source compatibility. Neither of these cases results in the
# importing of /usr/lib/values-xpg6.o, so we need to either manually import
# it via linking with a local version of the object, or set -xc99=%all which
-# by default imports /usr/lib/values-xpg6.o. C99MODE=C99_ENABLE is equivalent
-# to -xc99=all. If C99_ENABLE is defined and we also attempt to link with a
+# by default imports /usr/lib/values-xpg6.o. CSTD=CSTD_GNU99 is equivalent
+# to -xc99=all. If CSTD_GNU99 is defined and we also attempt to link with a
# local version of values-xpg6.o, an error will occur due to multiple
# definitions for __xpg4 and __xpg6. Because /usr/lib/values-xpg6.o was
# delivered in Solaris 10 and is a stable interface, there is no need to
@@ -66,8 +66,8 @@ $(XPG4) := CFLAGS += -D_XOPEN_SOURCE -I$(SRC)/lib/libc/inc
# the compiler only imports this by default (from /usr/lib/values-xpg4.o)
# if we use the c89 utility as opposed to cc.
-XPG6MODE = $(C99_ENABLE)
-$(XPG6) := C99MODE = $(XPG6MODE)
+XPG6MODE = $(CSTD_GNU99)
+$(XPG6) := CSTD = $(XPG6MODE)
$(XPG6) := CFLAGS += -D_XOPEN_SOURCE=600 -I$(SRC)/lib/libc/inc
.KEEP_STATE:
diff --git a/usr/src/cmd/hal/addons/acpi/Makefile b/usr/src/cmd/hal/addons/acpi/Makefile
index daf306a758..e66764495c 100644
--- a/usr/src/cmd/hal/addons/acpi/Makefile
+++ b/usr/src/cmd/hal/addons/acpi/Makefile
@@ -22,8 +22,6 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
PROG = hald-addon-acpi
OBJS = addon-acpi.o logger.o util_helper.o acpi.o util_pm.o
@@ -38,7 +36,7 @@ LDLIBS += -lc -ldbus-1 -lhal -lglib-2.0
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal -I../../hald
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/hal/addons/cpufreq/Makefile b/usr/src/cmd/hal/addons/cpufreq/Makefile
index b631fbf33b..1fdf1ad83c 100644
--- a/usr/src/cmd/hal/addons/cpufreq/Makefile
+++ b/usr/src/cmd/hal/addons/cpufreq/Makefile
@@ -23,8 +23,6 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#pragma ident "%Z%%M% %I% %E% SMI"
-#
PROG = hald-addon-cpufreq
OBJS = addon-cpufreq.o logger.o adt_data.o
@@ -40,7 +38,7 @@ LDLIBS += -lc -ldbus-1 -lhal -lglib-2.0 -ldbus-glib-1 -lpolkit -lbsm
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal -I../../hald
CPPFLAGS += -I$(ROOT)/usr/include/libpolkit -g
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/hal/addons/network-devices/Makefile b/usr/src/cmd/hal/addons/network-devices/Makefile
index 4d29e23981..3ac146e39e 100644
--- a/usr/src/cmd/hal/addons/network-devices/Makefile
+++ b/usr/src/cmd/hal/addons/network-devices/Makefile
@@ -45,7 +45,7 @@ LDLIBS += $(ZIGNORE) -lnetsnmp
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal -I../../hald -I../../utils
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/hal/addons/storage/Makefile b/usr/src/cmd/hal/addons/storage/Makefile
index e7d4797dc9..f5aa0fbbf5 100644
--- a/usr/src/cmd/hal/addons/storage/Makefile
+++ b/usr/src/cmd/hal/addons/storage/Makefile
@@ -36,7 +36,7 @@ LDLIBS += -lc -ldbus-1 -lhal -lnvpair -lsysevent
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal -I../../hald
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/hal/hald-runner/Makefile b/usr/src/cmd/hal/hald-runner/Makefile
index f52bb65346..9f283d9468 100644
--- a/usr/src/cmd/hal/hald-runner/Makefile
+++ b/usr/src/cmd/hal/hald-runner/Makefile
@@ -22,8 +22,6 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
PROG = hald-runner
OBJS = main.o runner.o utils.o
@@ -38,7 +36,7 @@ LDLIBS += -lc -ldbus-1 -ldbus-glib-1 -lglib-2.0
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -UDBUS_API_SUBJECT_TO_CHANGE
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/hal/hald/Makefile b/usr/src/cmd/hal/hald/Makefile
index 9352dd5e56..e61790e3e5 100644
--- a/usr/src/cmd/hal/hald/Makefile
+++ b/usr/src/cmd/hal/hald/Makefile
@@ -46,7 +46,7 @@ LDLIBS += -lc -lm -ldbus-1 -ldbus-glib-1 -lglib-2.0 -lgobject-2.0 \
all install $(PROG) := LDLIBS += -lexpat
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CLOBBERFILES += hald_marshal.c hald_marshal.h
diff --git a/usr/src/cmd/hal/hald/solaris/Makefile b/usr/src/cmd/hal/hald/solaris/Makefile
index f4513b315b..b7e0d59252 100644
--- a/usr/src/cmd/hal/hald/solaris/Makefile
+++ b/usr/src/cmd/hal/hald/solaris/Makefile
@@ -40,7 +40,7 @@ $(ROOTMANIFEST) := FILEMODE = 444
$(ROOTLIBSVCMETHOD)/svc-hal:= FILEMODE = 555
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/hal/probing/acpi/Makefile b/usr/src/cmd/hal/probing/acpi/Makefile
index 2bfd38d014..69190994c3 100644
--- a/usr/src/cmd/hal/probing/acpi/Makefile
+++ b/usr/src/cmd/hal/probing/acpi/Makefile
@@ -22,8 +22,6 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
PROG = hald-probe-acpi
OBJS = probe-acpi.o logger.o acpi.o util_pm.o
@@ -38,7 +36,7 @@ LDLIBS += -lc -ldbus-1 -lhal -lglib-2.0
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS) $(HAL_GLIB_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal -I../../utils -I../../hald
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/hal/probing/network-printer/Makefile b/usr/src/cmd/hal/probing/network-printer/Makefile
index 80c2e6d034..f2227ec9e8 100644
--- a/usr/src/cmd/hal/probing/network-printer/Makefile
+++ b/usr/src/cmd/hal/probing/network-printer/Makefile
@@ -38,7 +38,7 @@ LDLIBS += $(ZIGNORE) -lnetsnmp
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal -I../../utils -I../../hald
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/hal/probing/printer/Makefile b/usr/src/cmd/hal/probing/printer/Makefile
index 26903c5959..9954375a62 100644
--- a/usr/src/cmd/hal/probing/printer/Makefile
+++ b/usr/src/cmd/hal/probing/printer/Makefile
@@ -22,8 +22,6 @@
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
PROG = hald-probe-printer
OBJS = probe-printer.o logger.o printer.o
@@ -38,7 +36,7 @@ LDLIBS += -lc -ldbus-1 -lhal
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal -I../../utils -I../../hald
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/hal/probing/storage/Makefile b/usr/src/cmd/hal/probing/storage/Makefile
index 76450e1743..8b886d4c07 100644
--- a/usr/src/cmd/hal/probing/storage/Makefile
+++ b/usr/src/cmd/hal/probing/storage/Makefile
@@ -22,8 +22,6 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
PROG = hald-probe-storage
OBJS = probe-storage.o cdutils.o fsutils.o logger.o
@@ -39,7 +37,7 @@ LDLIBS += -lc -ldbus-1 -lhal -ladm -lefi
CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal -I../../utils -I../../hald
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/hal/probing/volume/Makefile b/usr/src/cmd/hal/probing/volume/Makefile
index a9cd36186b..25ee9ea016 100644
--- a/usr/src/cmd/hal/probing/volume/Makefile
+++ b/usr/src/cmd/hal/probing/volume/Makefile
@@ -22,8 +22,6 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
PROG = hald-probe-volume
OBJS = probe-volume.o cdutils.o fsutils.o logger.o
@@ -39,7 +37,7 @@ LDLIBS += -lc -ldbus-1 -lhal -lfstyp -lnvpair -ladm -lefi
CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal -I../../utils -I../../hald
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/hal/probing/xkb/Makefile b/usr/src/cmd/hal/probing/xkb/Makefile
index 1db618779c..8d6b1fc13c 100644
--- a/usr/src/cmd/hal/probing/xkb/Makefile
+++ b/usr/src/cmd/hal/probing/xkb/Makefile
@@ -37,7 +37,7 @@ LDLIBS += -lc -ldbus-1 -lhal
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal -I../../hald
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/hal/tools/Makefile b/usr/src/cmd/hal/tools/Makefile
index 1c4fceb34b..6cca522969 100644
--- a/usr/src/cmd/hal/tools/Makefile
+++ b/usr/src/cmd/hal/tools/Makefile
@@ -72,7 +72,7 @@ $(STORAGE_METHOD_PROG) := LDLIBS += -lpolkit
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal
CPPFLAGS += -I$(ROOT)/usr/include/libpolkit
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
ROOTUSRSBINPROG = $(HAL_PROG:%=$(ROOTUSRSBIN)/%) \
$(SCRIPT_BIN:%=$(ROOTUSRSBIN)/%)
diff --git a/usr/src/cmd/hal/tools/sunos/Makefile b/usr/src/cmd/hal/tools/sunos/Makefile
index b1b3a6dc19..51b48b865b 100644
--- a/usr/src/cmd/hal/tools/sunos/Makefile
+++ b/usr/src/cmd/hal/tools/sunos/Makefile
@@ -22,8 +22,6 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
HAL_PROGS = hal-system-lcd-set-brightness-sunos \
hal-system-lcd-get-brightness-sunos
@@ -43,7 +41,7 @@ $(HAL_PROGS) := LDLIBS += -lc $(ZIGNORE) -lglib-2.0
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal
CPPFLAGS += -I$(ROOT)/usr/include/libpolkit
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
ROOTCMDDIR = $(ROOTLIB_HAL)/sunos
ROOTCMD = $(HAL_PROGS:%=$(ROOTCMDDIR)/%) \
diff --git a/usr/src/cmd/iconv/Makefile b/usr/src/cmd/iconv/Makefile
index 02edd5238d..f4fd3c3010 100644
--- a/usr/src/cmd/iconv/Makefile
+++ b/usr/src/cmd/iconv/Makefile
@@ -23,7 +23,7 @@ OBJS = iconv_main.o iconv_list.o charmap.o parser.tab.o scanner.o
SRCS = $(OBJS:%.o=%.c)
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LDLIBS += -lcmdutils -lavl
YFLAGS = -d -b parser
CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
diff --git a/usr/src/cmd/idmap/idmapd/Makefile b/usr/src/cmd/idmap/idmapd/Makefile
index a4ab35da95..b0d03278ca 100644
--- a/usr/src/cmd/idmap/idmapd/Makefile
+++ b/usr/src/cmd/idmap/idmapd/Makefile
@@ -69,7 +69,7 @@ XGETFLAGS = --foreign-user --strict -n -E --width=72 \
--omit-header --keyword=directoryError:2 \
--language=C --force-po
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
POFILE = $(PROG)_all.po
RPC_MSGOUT_OPT = -DRPC_MSGOUT=idmap_rpc_msgout
diff --git a/usr/src/cmd/latencytop/Makefile.com b/usr/src/cmd/latencytop/Makefile.com
index a804857533..8bfc1e13a6 100644
--- a/usr/src/cmd/latencytop/Makefile.com
+++ b/usr/src/cmd/latencytop/Makefile.com
@@ -36,7 +36,7 @@ CERRWARN += -_gcc=-Wno-uninitialized
CPPFLAGS += -DEMBED_CONFIGS -I$(ADJUNCT_PROTO)/usr/include/glib-2.0 \
-I$(ADJUNCT_PROTO)/usr/lib/glib-2.0/include
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
LDLIBS += -lcurses -ldtrace
all install := LDLIBS += -lglib-2.0
diff --git a/usr/src/cmd/ldap/Makefile b/usr/src/cmd/ldap/Makefile
index 6f8a440264..3815e4fdc7 100644
--- a/usr/src/cmd/ldap/Makefile
+++ b/usr/src/cmd/ldap/Makefile
@@ -2,8 +2,6 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#pragma ident "%Z%%M% %I% %E% SMI"
-#
# cmd/ldap/Makefile
include ../Makefile.cmd
@@ -32,7 +30,7 @@ $(POFILES) := CFLAGS += -I ../../lib/libldap5/include/ldap \
-DNO_LIBLCACHE -DLDAP_REFERRALS -DNET_SSL \
-DLDAPSSLIO -DHAVE_SASL_OPTIONS \
-DSOLARIS_LDAP_CMD
-$(NS_POFILES) := C99MODE = $(C99_ENABLE)
+$(NS_POFILES) := CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/ldap/Makefile.com b/usr/src/cmd/ldap/Makefile.com
index a50e846b61..33dd225325 100644
--- a/usr/src/cmd/ldap/Makefile.com
+++ b/usr/src/cmd/ldap/Makefile.com
@@ -112,9 +112,9 @@ ldaplist := LDLIBS += -lsldap
ldapaddent := LDLIBS += -lsldap -lnsl -lsecdb
ldapclient := LDLIBS += -lsldap -lscf
-ldaplist := C99MODE = $(C99_ENABLE)
-ldapaddent := C99MODE = $(C99_ENABLE)
-ldapclient := C99MODE = $(C99_ENABLE)
+ldaplist := CSTD = $(CSTD_GNU99)
+ldapaddent := CSTD = $(CSTD_GNU99)
+ldapclient := CSTD = $(CSTD_GNU99)
lint := LDLIBS += -lldap
@@ -177,18 +177,18 @@ clean:
# Not linted Mozilla upstream commands
lint: lintns_ldaplist lintns_ldapaddent lintns_ldapclient
-lintns_ldaplist := C99MODE = $(C99_ENABLE)
+lintns_ldaplist := CSTD = $(CSTD_GNU99)
lintns_ldaplist:
$(LINT.c) $(LDAPLISTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap
-lintns_ldapaddent := C99MODE = $(C99_ENABLE)
+lintns_ldapaddent := CSTD = $(CSTD_GNU99)
lintns_ldapaddent:
$(LINT.c) $(LDAPADDENTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap -lnsl \
-lsecdb
-lintns_ldapclient := C99MODE = $(C99_ENABLE)
+lintns_ldapclient := CSTD = $(CSTD_GNU99)
lintns_ldapclient:
$(LINT.c) $(LDAPCLIENTSRCS:%=../ns_ldap/%) $(LDLIBS) -lsldap -lscf
diff --git a/usr/src/cmd/ldmad/Makefile b/usr/src/cmd/ldmad/Makefile
index 9e9e30fc19..0e38ddbb00 100644
--- a/usr/src/cmd/ldmad/Makefile
+++ b/usr/src/cmd/ldmad/Makefile
@@ -64,7 +64,7 @@ LDLIBS += -lds -ldladm -ldevinfo -lpri
INCS += -I$(ROOT)/usr/platform/sun4v/include/sys
INCS += -I$(SRC)/uts/sun4v
CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(INCS)
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-uninitialized
LINTFLAGS += -erroff=E_BAD_PTR_CAST_ALIGN
diff --git a/usr/src/cmd/mandoc/Makefile.common b/usr/src/cmd/mandoc/Makefile.common
index 6c0187e3e0..ac5b6fe2ac 100644
--- a/usr/src/cmd/mandoc/Makefile.common
+++ b/usr/src/cmd/mandoc/Makefile.common
@@ -76,7 +76,7 @@ OBJS= att.o \
OBJS += compat_ohash.o
CFLAGS += $(CC_VERBOSE)
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CPPFLAGS += -DOSNAME="\"illumos\""
diff --git a/usr/src/cmd/mdb/Makefile.mdb b/usr/src/cmd/mdb/Makefile.mdb
index 9d1d7b4d6c..852ce281ac 100644
--- a/usr/src/cmd/mdb/Makefile.mdb
+++ b/usr/src/cmd/mdb/Makefile.mdb
@@ -95,7 +95,7 @@ SRCS += \
$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
CPPFLAGS += -D_MDB -I. -I../.. -I../../../common
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
LDLIBS += -lcurses -lkvm -lproc -lrtld_db -lctf -lumem -ldisasm -lscf
diff --git a/usr/src/cmd/mdb/Makefile.module b/usr/src/cmd/mdb/Makefile.module
index 5b8ae39405..b93681d85e 100644
--- a/usr/src/cmd/mdb/Makefile.module
+++ b/usr/src/cmd/mdb/Makefile.module
@@ -119,7 +119,7 @@ PYTHON_VERSION = 2.6
kvm_TGTFLAGS = -D_KERNEL
proc_TGTFLAGS = -D_USER
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CFLAGS += $(CCVERBOSE)
CFLAGS64 += $(CCVERBOSE)
diff --git a/usr/src/cmd/mdb/intel/amd64/libfksmbsrv/Makefile b/usr/src/cmd/mdb/intel/amd64/libfksmbsrv/Makefile
index d9bcbaf453..672b40b332 100644
--- a/usr/src/cmd/mdb/intel/amd64/libfksmbsrv/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/libfksmbsrv/Makefile
@@ -45,7 +45,7 @@ CPPFLAGS.first += -I../../../../../lib/libfakekernel/common
CPPFLAGS += -I../../../../../uts/common
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
dmod/%.o: $(GENUNIX_DIR)/%.c
diff --git a/usr/src/cmd/mdb/intel/amd64/libzpool/Makefile b/usr/src/cmd/mdb/intel/amd64/libzpool/Makefile
index f4d128dff7..b0ebe4c7c8 100644
--- a/usr/src/cmd/mdb/intel/amd64/libzpool/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/libzpool/Makefile
@@ -44,7 +44,7 @@ CPPFLAGS.first = -I$(SRC)/lib/libfakekernel/common -D_FAKE_KERNEL
CPPFLAGS += -I../../../../../lib/libzpool/common \
-I../../../../../uts/common/fs/zfs
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-type-limits
diff --git a/usr/src/cmd/mdb/intel/amd64/nsmb/Makefile b/usr/src/cmd/mdb/intel/amd64/nsmb/Makefile
index ac91224f66..ec561246ca 100644
--- a/usr/src/cmd/mdb/intel/amd64/nsmb/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/nsmb/Makefile
@@ -40,7 +40,7 @@ include ../../../Makefile.module
CPPFLAGS += -I$(SRC)/uts/common/fs/smbclnt
CPPFLAGS += -I$(SRC)/uts/common
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
# maybe not the best place for this, but
# we need to create this directory.
diff --git a/usr/src/cmd/mdb/intel/amd64/pmcs/Makefile b/usr/src/cmd/mdb/intel/amd64/pmcs/Makefile
index a8e6e2cfcc..02f4962b86 100644
--- a/usr/src/cmd/mdb/intel/amd64/pmcs/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/pmcs/Makefile
@@ -33,7 +33,7 @@ include $(SRC)/cmd/Makefile.cmd.64
include $(SRC)/cmd/mdb/intel/Makefile.amd64
include $(SRC)/cmd/mdb/Makefile.module
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
CPPFLAGS += -I$(SRC)/uts/common
diff --git a/usr/src/cmd/mdb/intel/amd64/qlc/Makefile b/usr/src/cmd/mdb/intel/amd64/qlc/Makefile
index 5c60dfe50b..d83124d648 100644
--- a/usr/src/cmd/mdb/intel/amd64/qlc/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/qlc/Makefile
@@ -41,7 +41,7 @@ CPPFLAGS += -I$(SRC)/uts/common/sys/fibre-channel/impl
LINTFLAGS64 += -erroff=E_STATIC_UNUSED -erroff=E_FUNC_SET_NOT_USED
LINTFLAGS64 += -erroff=E_STATIC_UNUSED -erroff=E_FUNC_ARG_UNUSED
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-address
diff --git a/usr/src/cmd/mdb/intel/amd64/smbfs/Makefile b/usr/src/cmd/mdb/intel/amd64/smbfs/Makefile
index b53fa726a1..c929d80524 100644
--- a/usr/src/cmd/mdb/intel/amd64/smbfs/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/smbfs/Makefile
@@ -40,7 +40,7 @@ include ../../../Makefile.module
CPPFLAGS += -I$(SRC)/uts/common/fs/smbclnt
CPPFLAGS += -I$(SRC)/uts/common
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
# maybe not the best place for this, but
# we need to create this directory.
diff --git a/usr/src/cmd/mdb/intel/amd64/smbsrv/Makefile b/usr/src/cmd/mdb/intel/amd64/smbsrv/Makefile
index 3d5dcdacb8..90a7c02643 100644
--- a/usr/src/cmd/mdb/intel/amd64/smbsrv/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/smbsrv/Makefile
@@ -38,7 +38,7 @@ ROOTKMOD = $(ROOT)/usr/kernel/kmdb$(MACHMODDIR)
include ../../../Makefile.module
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
$(ROOTKMOD):
$(INS.dir)
diff --git a/usr/src/cmd/mdb/intel/amd64/srpt/Makefile b/usr/src/cmd/mdb/intel/amd64/srpt/Makefile
index 1c15d3abfc..94ea5e7130 100644
--- a/usr/src/cmd/mdb/intel/amd64/srpt/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/srpt/Makefile
@@ -39,5 +39,5 @@ include ../../../Makefile.module
CPPFLAGS += -I$(UTSBASE)/common -I$(UTSBASE)/common/sys -I$(SRPTBASE)
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
diff --git a/usr/src/cmd/mdb/intel/amd64/zfs/Makefile b/usr/src/cmd/mdb/intel/amd64/zfs/Makefile
index 870f91ad99..8224d7593d 100644
--- a/usr/src/cmd/mdb/intel/amd64/zfs/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/zfs/Makefile
@@ -40,7 +40,7 @@ include ../../../common/modules/zfs/Makefile.zfs
CPPFLAGS += -I../../../../../uts/common/fs/zfs
CPPFLAGS += -I../../../../../uts/common/fs/zfs/lua
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-type-limits
diff --git a/usr/src/cmd/mdb/intel/ia32/libfksmbsrv/Makefile b/usr/src/cmd/mdb/intel/ia32/libfksmbsrv/Makefile
index eb63922371..df59f2c513 100644
--- a/usr/src/cmd/mdb/intel/ia32/libfksmbsrv/Makefile
+++ b/usr/src/cmd/mdb/intel/ia32/libfksmbsrv/Makefile
@@ -44,7 +44,7 @@ CPPFLAGS.first += -I../../../../../lib/libfakekernel/common
CPPFLAGS += -I../../../../../uts/common
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
dmod/%.o: $(GENUNIX_DIR)/%.c
diff --git a/usr/src/cmd/mdb/intel/ia32/libzpool/Makefile b/usr/src/cmd/mdb/intel/ia32/libzpool/Makefile
index 658c466248..0ed9a6d470 100644
--- a/usr/src/cmd/mdb/intel/ia32/libzpool/Makefile
+++ b/usr/src/cmd/mdb/intel/ia32/libzpool/Makefile
@@ -45,7 +45,7 @@ CPPFLAGS += -I../../../../../lib/libzpool/common \
-I../../../../../uts/common/fs/zfs \
-I../../../../../uts/common/fs/zfs/lua
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-type-limits
diff --git a/usr/src/cmd/mdb/intel/modules/mdb_kb/amd64/Makefile b/usr/src/cmd/mdb/intel/modules/mdb_kb/amd64/Makefile
index b12a97b8e5..bae116d95e 100644
--- a/usr/src/cmd/mdb/intel/modules/mdb_kb/amd64/Makefile
+++ b/usr/src/cmd/mdb/intel/modules/mdb_kb/amd64/Makefile
@@ -22,7 +22,6 @@
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#ident "%Z%%M% %I% %E% SMI"
MODULE = mdb_kb.so
MDBTGT = kvm
@@ -35,7 +34,7 @@ include ../../../../../Makefile.cmd.64
include ../../../../intel/Makefile.amd64
include ../../../../Makefile.module
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CPPFLAGS += -DMP -D_MACHDEP -D_MDB -D__xpv
diff --git a/usr/src/cmd/mdb/sparc/v7/libfksmbsrv/Makefile b/usr/src/cmd/mdb/sparc/v7/libfksmbsrv/Makefile
index 640aecfa3a..4136306433 100644
--- a/usr/src/cmd/mdb/sparc/v7/libfksmbsrv/Makefile
+++ b/usr/src/cmd/mdb/sparc/v7/libfksmbsrv/Makefile
@@ -45,7 +45,7 @@ CPPFLAGS.first += -I../../../../../lib/libfakekernel/common
CPPFLAGS += -I../../../../../uts/common
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
dmod/%.o: $(GENUNIX_DIR)/%.c
diff --git a/usr/src/cmd/mdb/sparc/v7/libzpool/Makefile b/usr/src/cmd/mdb/sparc/v7/libzpool/Makefile
index b00ff3c0bc..f8f2b3fae3 100644
--- a/usr/src/cmd/mdb/sparc/v7/libzpool/Makefile
+++ b/usr/src/cmd/mdb/sparc/v7/libzpool/Makefile
@@ -43,7 +43,7 @@ CPPFLAGS += -I../../../../../lib/libzpool/common \
-I../../../../../uts/common/fs/zfs \
-I../../../../../uts/common/fs/zfs/lua
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-type-limits
diff --git a/usr/src/cmd/mdb/sparc/v9/libfksmbsrv/Makefile b/usr/src/cmd/mdb/sparc/v9/libfksmbsrv/Makefile
index 480f9a8126..3d7f2e9dd4 100644
--- a/usr/src/cmd/mdb/sparc/v9/libfksmbsrv/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/libfksmbsrv/Makefile
@@ -46,7 +46,7 @@ CPPFLAGS.first += -I../../../../../lib/libfakekernel/common
CPPFLAGS += -I../../../../../uts/common
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
dmod/%.o: $(GENUNIX_DIR)/%.c
diff --git a/usr/src/cmd/mdb/sparc/v9/libzpool/Makefile b/usr/src/cmd/mdb/sparc/v9/libzpool/Makefile
index 5c3b38b760..6b50bacc96 100644
--- a/usr/src/cmd/mdb/sparc/v9/libzpool/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/libzpool/Makefile
@@ -44,7 +44,7 @@ CPPFLAGS += -I../../../../../lib/libzpool/common \
-I../../../../../uts/common/fs/zfs \
-I../../../../../uts/common/fs/zfs/lua
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-type-limits
diff --git a/usr/src/cmd/mdb/sparc/v9/nsmb/Makefile b/usr/src/cmd/mdb/sparc/v9/nsmb/Makefile
index 03b663a327..42560d80aa 100644
--- a/usr/src/cmd/mdb/sparc/v9/nsmb/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/nsmb/Makefile
@@ -40,7 +40,7 @@ include ../../../Makefile.module
CPPFLAGS += -I$(SRC)/uts/common/fs/smbclnt
CPPFLAGS += -I$(SRC)/uts/common
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
# maybe not the best place for this, but
# we need to create this directory.
diff --git a/usr/src/cmd/mdb/sparc/v9/pmcs/Makefile b/usr/src/cmd/mdb/sparc/v9/pmcs/Makefile
index d282a060e5..2d28be38f9 100644
--- a/usr/src/cmd/mdb/sparc/v9/pmcs/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/pmcs/Makefile
@@ -33,7 +33,7 @@ include $(SRC)/cmd/Makefile.cmd.64
include $(SRC)/cmd/mdb/sparc/Makefile.sparcv9
include $(SRC)/cmd/mdb/Makefile.module
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
CPPFLAGS += -I$(SRC)/uts/common
diff --git a/usr/src/cmd/mdb/sparc/v9/qlc/Makefile b/usr/src/cmd/mdb/sparc/v9/qlc/Makefile
index 1b5dff0286..926d1a809a 100644
--- a/usr/src/cmd/mdb/sparc/v9/qlc/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/qlc/Makefile
@@ -41,7 +41,7 @@ CPPFLAGS += -I$(SRC)/uts/common/sys/fibre-channel/impl
LINTFLAGS64 += -erroff=E_STATIC_UNUSED -erroff=E_FUNC_SET_NOT_USED
LINTFLAGS64 += -erroff=E_STATIC_UNUSED -erroff=E_FUNC_ARG_UNUSED
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-address
diff --git a/usr/src/cmd/mdb/sparc/v9/smbfs/Makefile b/usr/src/cmd/mdb/sparc/v9/smbfs/Makefile
index 4aca90cff9..b89fc0cc1d 100644
--- a/usr/src/cmd/mdb/sparc/v9/smbfs/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/smbfs/Makefile
@@ -40,7 +40,7 @@ include ../../../Makefile.module
CPPFLAGS += -I$(SRC)/uts/common/fs/smbclnt
CPPFLAGS += -I$(SRC)/uts/common
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
# maybe not the best place for this, but
# we need to create this directory.
diff --git a/usr/src/cmd/mdb/sparc/v9/smbsrv/Makefile b/usr/src/cmd/mdb/sparc/v9/smbsrv/Makefile
index 643b3c8ec7..5333130137 100644
--- a/usr/src/cmd/mdb/sparc/v9/smbsrv/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/smbsrv/Makefile
@@ -38,7 +38,7 @@ ROOTKMOD = $(ROOT)/usr/kernel/kmdb$(MACHMODDIR)
include ../../../Makefile.module
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
$(ROOTKMOD):
$(INS.dir)
diff --git a/usr/src/cmd/mdb/sparc/v9/srpt/Makefile b/usr/src/cmd/mdb/sparc/v9/srpt/Makefile
index 7379a27cde..75448c947d 100644
--- a/usr/src/cmd/mdb/sparc/v9/srpt/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/srpt/Makefile
@@ -39,5 +39,5 @@ include ../../../Makefile.module
CPPFLAGS += -I$(UTSBASE)/common -I$(UTSBASE)/common/sys -I$(SRPTBASE)
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
diff --git a/usr/src/cmd/mdb/sparc/v9/stmf_sbd/Makefile b/usr/src/cmd/mdb/sparc/v9/stmf_sbd/Makefile
index 0c9a088945..7a15e833f6 100644
--- a/usr/src/cmd/mdb/sparc/v9/stmf_sbd/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/stmf_sbd/Makefile
@@ -38,5 +38,5 @@ include ../../../Makefile.module
CPPFLAGS += -I$(UTSBASE)/common -I$(UTSBASE)/common/sys -I$(STMFSBDBASE)
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
diff --git a/usr/src/cmd/mdb/sparc/v9/zfs/Makefile b/usr/src/cmd/mdb/sparc/v9/zfs/Makefile
index 751c3c3571..116cc938d8 100644
--- a/usr/src/cmd/mdb/sparc/v9/zfs/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/zfs/Makefile
@@ -40,7 +40,7 @@ include ../../../common/modules/zfs/Makefile.zfs
CPPFLAGS += -I../../../../../uts/common/fs/zfs
CPPFLAGS += -I../../../../../uts/common/fs/zfs/lua
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-type-limits
diff --git a/usr/src/cmd/ndmpd/Makefile b/usr/src/cmd/ndmpd/Makefile
index 3cb74257ce..4d5ed69075 100644
--- a/usr/src/cmd/ndmpd/Makefile
+++ b/usr/src/cmd/ndmpd/Makefile
@@ -51,7 +51,7 @@ CPPFLAGS += $(LFLAGS64)
CPPFLAGS += -D_FILE_OFFSET_BITS=64 -DDEBUG
CPPFLAGS += -I. -Iinclude
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
# lint does not like unused _umem_*_init
LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
diff --git a/usr/src/cmd/nvmeadm/Makefile b/usr/src/cmd/nvmeadm/Makefile
index c042d4075f..c919c51fce 100644
--- a/usr/src/cmd/nvmeadm/Makefile
+++ b/usr/src/cmd/nvmeadm/Makefile
@@ -25,7 +25,7 @@ include ../Makefile.cmd
CFLAGS += $(CCVERBOSE)
LDLIBS += -ldevinfo
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
all: $(PROG)
diff --git a/usr/src/cmd/od/Makefile b/usr/src/cmd/od/Makefile
index ce45b2db8c..6f449c96d1 100644
--- a/usr/src/cmd/od/Makefile
+++ b/usr/src/cmd/od/Makefile
@@ -23,7 +23,7 @@ include ../Makefile.cmd
CLOBBERFILES= $(PROG)
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CPPFLAGS += -D__EXTENSIONS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
LINTFLAGS += -D__EXTENSIONS__
diff --git a/usr/src/cmd/perl/Makefile.perl b/usr/src/cmd/perl/Makefile.perl
index 25fdc53f50..441f3de665 100644
--- a/usr/src/cmd/perl/Makefile.perl
+++ b/usr/src/cmd/perl/Makefile.perl
@@ -34,4 +34,4 @@ ROOTPERLEXTDIR = $(ROOTPERLLIBDIR)/auto/Sun/Solaris/$(MODULE)
ROOTPERLMOD = $(ROOTPERLMODDIR)/$(MODULE).pm
ROOTPERLEXT = $(ROOTPERLEXTDIR)/$(MODULE).so
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
diff --git a/usr/src/cmd/policykit/Makefile b/usr/src/cmd/policykit/Makefile
index 0c91f51fe8..db571b927f 100644
--- a/usr/src/cmd/policykit/Makefile
+++ b/usr/src/cmd/policykit/Makefile
@@ -35,7 +35,7 @@ LDLIBS += -lpolkit $(POLICYKIT_GLIB_LDLIBS)
CPPFLAGS += -I$(ROOT)/usr/include/libpolkit
CPPFLAGS += $(POLICYKIT_DBUS_CPPFLAGS) $(POLICYKIT_GLIB_CPPFLAGS)
CPPFLAGS += -DPACKAGE_VERSION=\"$(POLICYKIT_VERSION)\"
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-unused-variable
diff --git a/usr/src/cmd/rmmount/Makefile b/usr/src/cmd/rmmount/Makefile
index a859d240e7..4a075da5ef 100644
--- a/usr/src/cmd/rmmount/Makefile
+++ b/usr/src/cmd/rmmount/Makefile
@@ -39,7 +39,7 @@ LDLIBS += -ldbus-1 -ldbus-glib-1 -lglib-2.0 -lhal -lhal-storage -lcontract
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal
CPPFLAGS += -I$(SRC)/cmd/rmvolmgr
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-unused-variable
diff --git a/usr/src/cmd/rmvolmgr/Makefile b/usr/src/cmd/rmvolmgr/Makefile
index 32833c1f55..979a41cc5c 100644
--- a/usr/src/cmd/rmvolmgr/Makefile
+++ b/usr/src/cmd/rmvolmgr/Makefile
@@ -40,7 +40,7 @@ LDLIBS += -ldbus-1 -ldbus-glib-1 -lglib-2.0 -lhal -lhal-storage -lcontract -lscf
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-uninitialized
diff --git a/usr/src/cmd/savecore/Makefile.com b/usr/src/cmd/savecore/Makefile.com
index 591f33395b..ef8185d6d8 100644
--- a/usr/src/cmd/savecore/Makefile.com
+++ b/usr/src/cmd/savecore/Makefile.com
@@ -28,7 +28,7 @@ OBJS= savecore.o compress.o
include ../../Makefile.cmd
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CFLAGS += $(CCVERBOSE)
CFLAGS64 += $(CCVERBOSE)
diff --git a/usr/src/cmd/sgs/Makefile.com b/usr/src/cmd/sgs/Makefile.com
index 650a93e967..6964761a4e 100644
--- a/usr/src/cmd/sgs/Makefile.com
+++ b/usr/src/cmd/sgs/Makefile.com
@@ -41,12 +41,12 @@ ARCH = $($(MACH)_ARCH)
# Setting DEBUG = -DDEBUG (or "make DEBUG=-DDEBUG ...") enables ASSERT()
# checking. This is automatically enabled for DEBUG builds, not for non-debug
-# builds. Unset the global C99_DISABLE flag to insure we uncover all compiler
+# builds. Unset the global CSTD_GNU89 flag to insure we uncover all compiler
# warnings/errors.
DEBUG =
$(NOT_RELEASE_BUILD)DEBUG = -DDEBUG
-C99_DISABLE = $(C99_ENABLE)
+CSTD_GNU89 = $(CSTD_GNU99)
CFLAGS += $(CCVERBOSE) $(DEBUG) $(XFFLAG)
CFLAGS64 += $(CCVERBOSE) $(DEBUG) $(XFFLAG)
diff --git a/usr/src/cmd/sgs/ar/Makefile.com b/usr/src/cmd/sgs/ar/Makefile.com
index 4d00f744a4..dcd81c9f7c 100644
--- a/usr/src/cmd/sgs/ar/Makefile.com
+++ b/usr/src/cmd/sgs/ar/Makefile.com
@@ -39,7 +39,7 @@ LLDFLAGS = '-R$$ORIGIN/../../lib'
LLDFLAGS64 = '-R$$ORIGIN/../../../lib/$(MACH64)'
CPPFLAGS= -I. -I../../include $(CPPFLAGS.master) -I$(ELFCAP)
CFLAGS += $(CCVERBOSE)
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-uninitialized
LDLIBS += -lelf $(CONVLIBDIR) $(CONV_LIB) -lsendfile
diff --git a/usr/src/cmd/sgs/error/i386/Makefile b/usr/src/cmd/sgs/error/i386/Makefile
index bafd104413..91b26e49bc 100644
--- a/usr/src/cmd/sgs/error/i386/Makefile
+++ b/usr/src/cmd/sgs/error/i386/Makefile
@@ -38,7 +38,7 @@ INCLIST= -I../common
DEFLIST= -DELF
CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master)
CFLAGS += $(CCVERBOSE)
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-parentheses
diff --git a/usr/src/cmd/sgs/error/sparc/Makefile b/usr/src/cmd/sgs/error/sparc/Makefile
index cd3bf66bda..2023ad1a42 100644
--- a/usr/src/cmd/sgs/error/sparc/Makefile
+++ b/usr/src/cmd/sgs/error/sparc/Makefile
@@ -41,7 +41,7 @@ CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master)
CFLAGS += $(CCVERBOSE)
CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-parentheses
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CLEANFILES += $(LINTOUT)
diff --git a/usr/src/cmd/sgs/gprof/Makefile.com b/usr/src/cmd/sgs/gprof/Makefile.com
index 71f1ac66c4..cb08915388 100644
--- a/usr/src/cmd/sgs/gprof/Makefile.com
+++ b/usr/src/cmd/sgs/gprof/Makefile.com
@@ -41,7 +41,7 @@ INCLIST= -I../common -I../../include -I../../include/$(MACH)
DEFLIST= -DELF_OBJ -DELF
CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -I$(ELFCAP)
CFLAGS += $(CCVERBOSE)
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LDLIBS += $(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf
LINTSRCS = $(SRCS)
LINTFLAGS += -x
diff --git a/usr/src/cmd/sgs/lex/Makefile.com b/usr/src/cmd/sgs/lex/Makefile.com
index 15169ec277..e13b98168f 100644
--- a/usr/src/cmd/sgs/lex/Makefile.com
+++ b/usr/src/cmd/sgs/lex/Makefile.com
@@ -44,7 +44,7 @@ include ../../../../lib/Makefile.lib
SRCDIR = ../common
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-unused-label
CERRWARN += -_gcc=-Wno-uninitialized
diff --git a/usr/src/cmd/sgs/m4/i386/Makefile b/usr/src/cmd/sgs/m4/i386/Makefile
index 0a13a85c48..a3e69b92bb 100644
--- a/usr/src/cmd/sgs/m4/i386/Makefile
+++ b/usr/src/cmd/sgs/m4/i386/Makefile
@@ -50,7 +50,7 @@ INCLIST= -I../common
DEFLIST= -DELF
CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master)
CFLAGS += $(CCVERBOSE)
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-unused-label
diff --git a/usr/src/cmd/sgs/m4/sparc/Makefile b/usr/src/cmd/sgs/m4/sparc/Makefile
index ecda17a550..dea00a256f 100644
--- a/usr/src/cmd/sgs/m4/sparc/Makefile
+++ b/usr/src/cmd/sgs/m4/sparc/Makefile
@@ -55,7 +55,7 @@ CFLAGS += $(CCVERBOSE)
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-unused-label
CERRWARN += -_gcc=-Wno-uninitialized
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LINTFLAGS += $(LDLIBS)
CLEANFILES += $(LINTOUT) $(BLTSRCS)
diff --git a/usr/src/cmd/sgs/prof/Makefile.com b/usr/src/cmd/sgs/prof/Makefile.com
index edaaa695f8..f35c626e36 100644
--- a/usr/src/cmd/sgs/prof/Makefile.com
+++ b/usr/src/cmd/sgs/prof/Makefile.com
@@ -41,7 +41,7 @@ INCLIST= -I../common -I../../include -I../../include/$(MACH)
CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -I$(ELFCAP)
CFLAGS += $(CCVERBOSE)
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-uninitialized
LDLIBS += $(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf
LINTSRCS = $(SRCS)
diff --git a/usr/src/cmd/sgs/tsort/i386/Makefile b/usr/src/cmd/sgs/tsort/i386/Makefile
index c565d58a91..0df033fb0e 100644
--- a/usr/src/cmd/sgs/tsort/i386/Makefile
+++ b/usr/src/cmd/sgs/tsort/i386/Makefile
@@ -36,7 +36,7 @@ SRCS= $(OBJS:%.o=../common/%.c)
DEFLIST= -DELF
CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master)
CFLAGS += $(CCVERBOSE)
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-parentheses
diff --git a/usr/src/cmd/sgs/tsort/sparc/Makefile b/usr/src/cmd/sgs/tsort/sparc/Makefile
index 508983d078..6a5e794bda 100644
--- a/usr/src/cmd/sgs/tsort/sparc/Makefile
+++ b/usr/src/cmd/sgs/tsort/sparc/Makefile
@@ -39,7 +39,7 @@ DEFLIST= -DELF
CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master)
CFLAGS += $(CCVERBOSE)
CERRWARN += -_gcc=-Wno-parentheses
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CLEANFILES += $(LINTOUT)
diff --git a/usr/src/cmd/sgs/unifdef/i386/Makefile b/usr/src/cmd/sgs/unifdef/i386/Makefile
index 33f7b96b30..45fd3c3bea 100644
--- a/usr/src/cmd/sgs/unifdef/i386/Makefile
+++ b/usr/src/cmd/sgs/unifdef/i386/Makefile
@@ -34,7 +34,7 @@ SRCS= $(OBJS:%.o=../common/%.c)
DEFLIST= -DELF_OBJ -DELF
CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master)
CFLAGS += $(CCVERBOSE)
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LINTFLAGS += $(LDLIBS)
CLEANFILES += $(LINTOUT)
diff --git a/usr/src/cmd/sgs/unifdef/sparc/Makefile b/usr/src/cmd/sgs/unifdef/sparc/Makefile
index 0a16f4c5f0..297bfe27a5 100644
--- a/usr/src/cmd/sgs/unifdef/sparc/Makefile
+++ b/usr/src/cmd/sgs/unifdef/sparc/Makefile
@@ -36,7 +36,7 @@ CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master)
CFLAGS += $(CCVERBOSE)
CERRWARN += -_gcc=-Wno-char-subscripts
CERRWARN += -_gcc=-Wno-parentheses
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LINTFLAGS += $(LDLIBS)
CLEANFILES += $(LINTOUT)
diff --git a/usr/src/cmd/sgs/yacc/Makefile.com b/usr/src/cmd/sgs/yacc/Makefile.com
index 9744f284ea..07782396a5 100644
--- a/usr/src/cmd/sgs/yacc/Makefile.com
+++ b/usr/src/cmd/sgs/yacc/Makefile.com
@@ -68,7 +68,7 @@ BUILD.AR= $(AR) $(ARFLAGS) $@ `$(LORDER) $(OBJS) | $(TSORT)`
LINTPOUT= lint.out
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CFLAGS += $(CCVERBOSE)
CFLAGS64 += $(CCVERBOSE)
CERRWARN += -_gcc=-Wno-parentheses
diff --git a/usr/src/cmd/smbsrv/Makefile.smbsrv.defs b/usr/src/cmd/smbsrv/Makefile.smbsrv.defs
index 3de8e3efff..050a8e6255 100644
--- a/usr/src/cmd/smbsrv/Makefile.smbsrv.defs
+++ b/usr/src/cmd/smbsrv/Makefile.smbsrv.defs
@@ -22,8 +22,6 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
#
# Common definitions for all smbsrv commands
@@ -36,5 +34,5 @@ LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
CFLAGS += $(CCVERBOSE)
$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
C99LMODE = -Xc99=%all
diff --git a/usr/src/cmd/smbsrv/fksmbd/Makefile b/usr/src/cmd/smbsrv/fksmbd/Makefile
index ca3a8b5fb9..9a28a3c8eb 100644
--- a/usr/src/cmd/smbsrv/fksmbd/Makefile
+++ b/usr/src/cmd/smbsrv/fksmbd/Makefile
@@ -66,7 +66,7 @@ INCS += -I../../../common/smbsrv
# Should not have to do this, but the Kerberos includes are a mess.
INCS += -I $(ROOT)/usr/include/kerberosv5
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CFLAGS += $(CCVERBOSE)
diff --git a/usr/src/cmd/smbsrv/smbd/Makefile b/usr/src/cmd/smbsrv/smbd/Makefile
index 7af39ef1a7..c744f73ec6 100644
--- a/usr/src/cmd/smbsrv/smbd/Makefile
+++ b/usr/src/cmd/smbsrv/smbd/Makefile
@@ -69,7 +69,7 @@ $(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
# Should not have to do this, but the Kerberos includes are a mess.
CPPFLAGS += -I $(ROOT)/usr/include/kerberosv5
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
C99LMODE = -Xc99=%all
LDFLAGS += -R/usr/lib/smbsrv
diff --git a/usr/src/cmd/tail/Makefile b/usr/src/cmd/tail/Makefile
index e660cedf2d..25a5e735db 100644
--- a/usr/src/cmd/tail/Makefile
+++ b/usr/src/cmd/tail/Makefile
@@ -26,7 +26,7 @@ include ../Makefile.ctf
CLOBBERFILES= $(PROG)
CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
LINTFLAGS += -I. -erroff=E_CONSTANT_CONDITION
diff --git a/usr/src/cmd/th_tools/Makefile b/usr/src/cmd/th_tools/Makefile
index 28dd878fdb..ed9d5ae75a 100644
--- a/usr/src/cmd/th_tools/Makefile
+++ b/usr/src/cmd/th_tools/Makefile
@@ -30,7 +30,7 @@ include ../Makefile.cmd
CFLAGS += -I$(SRC)/uts/common
LINTFLAGS += -I$(SRC)/uts/common
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CFLAGS += $(CCVERBOSE)
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-uninitialized
diff --git a/usr/src/cmd/tr/Makefile b/usr/src/cmd/tr/Makefile
index 8b556040a5..0da9ab2094 100644
--- a/usr/src/cmd/tr/Makefile
+++ b/usr/src/cmd/tr/Makefile
@@ -26,7 +26,7 @@ include ../Makefile.cmd
CLOBBERFILES= $(PROG)
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CPPFLAGS += -D_ILLUMOS_PRIVATE -I.
LINTFLAGS += -D_ILLUMOS_PRIVATE -I.
diff --git a/usr/src/cmd/truss/Makefile.com b/usr/src/cmd/truss/Makefile.com
index 0ed14909e4..e2951b1f35 100644
--- a/usr/src/cmd/truss/Makefile.com
+++ b/usr/src/cmd/truss/Makefile.com
@@ -42,7 +42,7 @@ CFLAGS64 += $(CCVERBOSE)
CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-switch
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LDLIBS += -lproc -lrtld_db -lc_db -lnsl -lsocket -ltsol -lnvpair
CPPFLAGS += -D_REENTRANT -D_LARGEFILE64_SOURCE=1
diff --git a/usr/src/cmd/uuidgen/Makefile b/usr/src/cmd/uuidgen/Makefile
index 663e2dbd43..bc15966cae 100644
--- a/usr/src/cmd/uuidgen/Makefile
+++ b/usr/src/cmd/uuidgen/Makefile
@@ -20,7 +20,7 @@ include ../Makefile.cmd
CFLAGS += $(CCVERBOSE)
LDLIBS += -luuid
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/cmd/volcheck/Makefile b/usr/src/cmd/volcheck/Makefile
index 762dd50c9b..8f95cb5b10 100644
--- a/usr/src/cmd/volcheck/Makefile
+++ b/usr/src/cmd/volcheck/Makefile
@@ -39,7 +39,7 @@ LDLIBS += -ldbus-1 -ldbus-glib-1 -lglib-2.0 -lhal -lhal-storage -lcontract
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal
CPPFLAGS += -I$(SRC)/cmd/rmvolmgr
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-unused-variable
diff --git a/usr/src/cmd/volrmmount/Makefile b/usr/src/cmd/volrmmount/Makefile
index 5166036a04..f503dc768a 100644
--- a/usr/src/cmd/volrmmount/Makefile
+++ b/usr/src/cmd/volrmmount/Makefile
@@ -39,7 +39,7 @@ LDLIBS += -ldbus-1 -ldbus-glib-1 -lglib-2.0 -lhal -lhal-storage -lcontract
CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal
CPPFLAGS += -I$(SRC)/cmd/rmvolmgr
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-unused-variable
diff --git a/usr/src/cmd/vscan/vscanadm/Makefile b/usr/src/cmd/vscan/vscanadm/Makefile
index e5765bcbb2..f27f4a22e4 100755
--- a/usr/src/cmd/vscan/vscanadm/Makefile
+++ b/usr/src/cmd/vscan/vscanadm/Makefile
@@ -22,8 +22,6 @@
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#
-#ident "%Z%%M% %I% %E% SMI"
PROG = vscanadm
SRCS = vscanadm.c
@@ -35,7 +33,7 @@ LDLIBS += -L$(ROOT)/usr/lib/vscan -lvscan
LDFLAGS += -R/usr/lib/vscan
CFLAGS += $(CCVERBOSE)
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
C99LMODE = -Xc99=%all
.KEEP_STATE:
diff --git a/usr/src/cmd/vscan/vscand/Makefile b/usr/src/cmd/vscan/vscand/Makefile
index 15ff0086c2..dfc363c83d 100644
--- a/usr/src/cmd/vscan/vscand/Makefile
+++ b/usr/src/cmd/vscan/vscand/Makefile
@@ -47,7 +47,7 @@ $(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
CERRWARN += -_gcc=-Wno-switch
LINTFLAGS += -mu
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
C99LMODE = -Xc99=%all
MANIFEST = vscan.xml
diff --git a/usr/src/cmd/vtfontcvt/Makefile.common b/usr/src/cmd/vtfontcvt/Makefile.common
index 4ce385418e..f951eef71b 100644
--- a/usr/src/cmd/vtfontcvt/Makefile.common
+++ b/usr/src/cmd/vtfontcvt/Makefile.common
@@ -26,4 +26,4 @@ LDLIBS += -lumem
$(COMPILE.c) $<
$(POST_PROCESS_O)
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
diff --git a/usr/src/cmd/zdb/Makefile.com b/usr/src/cmd/zdb/Makefile.com
index 78d1bb1738..1870ccd0c5 100644
--- a/usr/src/cmd/zdb/Makefile.com
+++ b/usr/src/cmd/zdb/Makefile.com
@@ -40,7 +40,7 @@ INCS += -I../../../common/zfs
LDLIBS += -lzpool -lumem -lnvpair -lzfs -lavl -lcmdutils -lfakekernel
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CFLAGS += $(CCVERBOSE)
diff --git a/usr/src/cmd/zdb/zdb.c b/usr/src/cmd/zdb/zdb.c
index 657b783fdc..ba5e1a08b6 100644
--- a/usr/src/cmd/zdb/zdb.c
+++ b/usr/src/cmd/zdb/zdb.c
@@ -89,12 +89,14 @@ extern boolean_t zfs_recover;
extern uint64_t zfs_arc_max, zfs_arc_meta_limit;
extern int zfs_vdev_async_read_max_active;
extern int aok;
+extern boolean_t spa_load_verify_dryrun;
#else
int reference_tracking_enable;
boolean_t zfs_recover;
uint64_t zfs_arc_max, zfs_arc_meta_limit;
int zfs_vdev_async_read_max_active;
int aok;
+boolean_t spa_load_verify_dryrun;
#endif
static const char cmdname[] = "zdb";
@@ -4546,6 +4548,12 @@ main(int argc, char **argv)
*/
reference_tracking_enable = B_FALSE;
+ /*
+ * Do not fail spa_load when spa_load_verify fails. This is needed
+ * to load non-idle pools.
+ */
+ spa_load_verify_dryrun = B_TRUE;
+
kernel_init(FREAD);
g_zfs = libzfs_init();
ASSERT(g_zfs != NULL);
diff --git a/usr/src/cmd/zfs/Makefile b/usr/src/cmd/zfs/Makefile
index f84bcbb108..a3d61c7ee4 100644
--- a/usr/src/cmd/zfs/Makefile
+++ b/usr/src/cmd/zfs/Makefile
@@ -44,7 +44,7 @@ LDLIBS += -lzfs_core -lzfs -luutil -lumem -lnvpair -lsec -lidmap
INCS += -I../../common/zfs
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS)
diff --git a/usr/src/cmd/zhack/Makefile.com b/usr/src/cmd/zhack/Makefile.com
index 3e7890d5d7..8a87de4ec9 100644
--- a/usr/src/cmd/zhack/Makefile.com
+++ b/usr/src/cmd/zhack/Makefile.com
@@ -43,7 +43,7 @@ INCS += -I../../../common/zfs
LDLIBS += -lzpool -lumem -lnvpair -lzfs
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CFLAGS += $(CCVERBOSE)
diff --git a/usr/src/cmd/zinject/Makefile.com b/usr/src/cmd/zinject/Makefile.com
index 5bfe8bad79..a1a3baf712 100644
--- a/usr/src/cmd/zinject/Makefile.com
+++ b/usr/src/cmd/zinject/Makefile.com
@@ -38,7 +38,7 @@ INCS += -I../../../uts/common/fs/zfs/lua
LDLIBS += -lzpool -lzfs -lnvpair
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CPPFLAGS.first = -I$(SRC)/lib/libfakekernel/common -D_FAKE_KERNEL
diff --git a/usr/src/cmd/zlook/Makefile.com b/usr/src/cmd/zlook/Makefile.com
index 937842724d..06627ad814 100644
--- a/usr/src/cmd/zlook/Makefile.com
+++ b/usr/src/cmd/zlook/Makefile.com
@@ -28,7 +28,7 @@ SRCS= ../$(PROG).c
include ../../Makefile.cmd
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CFLAGS += -g $(CCVERBOSE)
CFLAGS64 += -g $(CCVERBOSE)
diff --git a/usr/src/cmd/zstreamdump/Makefile b/usr/src/cmd/zstreamdump/Makefile
index 5b7e6b79c1..ba249bafab 100644
--- a/usr/src/cmd/zstreamdump/Makefile
+++ b/usr/src/cmd/zstreamdump/Makefile
@@ -35,7 +35,7 @@ INCS += -I../../common/zfs
LDLIBS += -lzfs -lnvpair
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS)
diff --git a/usr/src/cmd/ztest/Makefile.com b/usr/src/cmd/ztest/Makefile.com
index 172ff02b5a..8f6c9d5ccf 100644
--- a/usr/src/cmd/ztest/Makefile.com
+++ b/usr/src/cmd/ztest/Makefile.com
@@ -38,7 +38,7 @@ INCS += -I../../../common/zfs
LDLIBS += -lumem -lzpool -lcmdutils -lm -lnvpair -lfakekernel
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CFLAGS += -g $(CCVERBOSE)
CFLAGS64 += -g $(CCVERBOSE)
diff --git a/usr/src/lib/brand/solaris10/s10_brand/Makefile.com b/usr/src/lib/brand/solaris10/s10_brand/Makefile.com
index 9b721953e8..242ef383b7 100644
--- a/usr/src/lib/brand/solaris10/s10_brand/Makefile.com
+++ b/usr/src/lib/brand/solaris10/s10_brand/Makefile.com
@@ -78,7 +78,7 @@ CPPFLAGS += -D_REENTRANT -U_ASM \
-I$(SRC)/uts/common/fs/zfs
CFLAGS += $(CCVERBOSE)
# Needed to handle zfs include files
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
DYNFLAGS += $(DYNFLAGS_$(CLASS))
DYNFLAGS += $(BLOCAL) $(ZNOVERSION) -Wl,-e_start
diff --git a/usr/src/lib/fm/libfmd_snmp/Makefile.com b/usr/src/lib/fm/libfmd_snmp/Makefile.com
index cba1d90240..e43b2a4152 100644
--- a/usr/src/lib/fm/libfmd_snmp/Makefile.com
+++ b/usr/src/lib/fm/libfmd_snmp/Makefile.com
@@ -44,7 +44,7 @@ LIBS = $(DYNLIB) $(LINTLIB)
SRCDIR = ../common
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CPPFLAGS += -I../common -I.
$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
diff --git a/usr/src/lib/fm/libfmevent/Makefile.com b/usr/src/lib/fm/libfmevent/Makefile.com
index ce3f9b4dae..4243705988 100644
--- a/usr/src/lib/fm/libfmevent/Makefile.com
+++ b/usr/src/lib/fm/libfmevent/Makefile.com
@@ -51,7 +51,7 @@ LIBS = $(DYNLIB) $(LINTLIB)
SRCDIR = ../common
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CPPFLAGS += -I../common -I.
$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
diff --git a/usr/src/lib/fm/libfmnotify/Makefile.com b/usr/src/lib/fm/libfmnotify/Makefile.com
index e1ff0e027a..d6a60e6fb1 100644
--- a/usr/src/lib/fm/libfmnotify/Makefile.com
+++ b/usr/src/lib/fm/libfmnotify/Makefile.com
@@ -37,7 +37,7 @@ LIBS = $(DYNLIB) $(LINTLIB)
SRCDIR = ../common
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CPPFLAGS += -I../common -I.
CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
diff --git a/usr/src/lib/fm/topo/modules/Makefile.plugin b/usr/src/lib/fm/topo/modules/Makefile.plugin
index 13d90b8a27..1ec87f6970 100644
--- a/usr/src/lib/fm/topo/modules/Makefile.plugin
+++ b/usr/src/lib/fm/topo/modules/Makefile.plugin
@@ -64,7 +64,7 @@ CERRWARN += -_gcc=-Wno-parentheses
APIMAP = ../../../libtopo/common/topo_mod.map
MAPFILES = # use APIMAP instead
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
CFLAGS += -G $(XREGSFLAG)
diff --git a/usr/src/lib/libads/Makefile.com b/usr/src/lib/libads/Makefile.com
index 1e1d7d968d..9fd803cac9 100644
--- a/usr/src/lib/libads/Makefile.com
+++ b/usr/src/lib/libads/Makefile.com
@@ -32,7 +32,7 @@ OBJECTS = $(LINT_OBJECTS) adspriv_xdr.o
include ../../Makefile.lib
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
LIBS = $(DYNLIB) $(LINTLIB)
diff --git a/usr/src/lib/libadutils/Makefile.com b/usr/src/lib/libadutils/Makefile.com
index 67014cb75e..7d7e142481 100644
--- a/usr/src/lib/libadutils/Makefile.com
+++ b/usr/src/lib/libadutils/Makefile.com
@@ -32,7 +32,7 @@ OBJECTS = adutils.o addisc.o adutils_threadfuncs.o \
include ../../Makefile.lib
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
LIBS = $(DYNLIB) $(LINTLIB)
diff --git a/usr/src/lib/libbc/Makefile b/usr/src/lib/libbc/Makefile
index 403ae316a7..1118f0bb7c 100644
--- a/usr/src/lib/libbc/Makefile
+++ b/usr/src/lib/libbc/Makefile
@@ -22,8 +22,6 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
LIBRARY= libc.a
VERS= .1.9
@@ -34,7 +32,7 @@ include ../Makefile.lib
# There should be a mapfile here
MAPFILES =
-C99MODE= $(C99_DISABLE)
+CSTD= $(CSTD_GNU89)
# the bcp libraries go in /usr/4lib. override ROOTLIBDIR from ../Makefile.lib
ROOTLIBDIR= $(ROOT)/usr/4lib
diff --git a/usr/src/lib/libbc/sparc/Makefile b/usr/src/lib/libbc/sparc/Makefile
index 7503bae833..c624b62c2f 100644
--- a/usr/src/lib/libbc/sparc/Makefile
+++ b/usr/src/lib/libbc/sparc/Makefile
@@ -310,7 +310,7 @@ include ../../Makefile.lib
# There should be a mapfile here
MAPFILES =
-C99MODE= $(C99_DISABLE)
+CSTD= $(CSTD_GNU89)
#
# The BCP include files depend on old preprocessor semantics.
diff --git a/usr/src/lib/libbe/Makefile.com b/usr/src/lib/libbe/Makefile.com
index 8c939917a3..765f8e981a 100644
--- a/usr/src/lib/libbe/Makefile.com
+++ b/usr/src/lib/libbe/Makefile.com
@@ -49,7 +49,7 @@ SRCDIR= ../common
INCS += -I$(SRCDIR) -I$(SRC)/cmd/boot/common -I$(SRC)/common/ficl
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LDLIBS += -lficl-sys -lzfs -linstzones -luuid -lnvpair -lc -lgen
LDLIBS += -ldevinfo -lefi
diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile
index 37c52e45c2..1c99dea417 100644
--- a/usr/src/lib/libc/amd64/Makefile
+++ b/usr/src/lib/libc/amd64/Makefile
@@ -1067,7 +1067,7 @@ BUILD.s= $(AS) $(ASFLAGS) $< -o $@
# Override this top level flag so the compiler builds in its native
# C99 mode. This has been enabled to support the complex arithmetic
# added to libc.
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
# libc method of building an archive
# The "$(GREP) -v ' L '" part is necessary only until
diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com
index 18854746e1..5b73bccc82 100644
--- a/usr/src/lib/libc/i386/Makefile.com
+++ b/usr/src/lib/libc/i386/Makefile.com
@@ -1127,7 +1127,7 @@ BUILD.s= $(AS) $(ASFLAGS) $< -o $@
# Override this top level flag so the compiler builds in its native
# C99 mode. This has been enabled to support the complex arithmetic
# added to libc.
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
# libc method of building an archive
# The "$(GREP) -v ' L '" part is necessary only until
diff --git a/usr/src/lib/libc/port/llib-lc b/usr/src/lib/libc/port/llib-lc
index 350dfc71dd..f90788e427 100644
--- a/usr/src/lib/libc/port/llib-lc
+++ b/usr/src/lib/libc/port/llib-lc
@@ -400,6 +400,26 @@ char *ecvt(double value, int ndigit, int *_RESTRICT_KYWD decpt,
char *fcvt(double value, int ndigit, int *_RESTRICT_KYWD decpt,
int *_RESTRICT_KYWD sign);
+/* endian.c */
+uint16_t htole16(uint16_t);
+uint32_t htole32(uint32_t);
+uint64_t htole64(uint64_t);
+uint16_t letoh16(uint16_t);
+uint32_t letoh32(uint32_t);
+uint64_t letoh64(uint64_t);
+uint16_t le16toh(uint16_t);
+uint32_t le32toh(uint32_t);
+uint64_t le64toh(uint64_t);
+uint16_t htobe16(uint16_t);
+uint32_t htobe32(uint32_t);
+uint64_t htobe64(uint64_t);
+uint16_t betoh16(uint16_t);
+uint32_t betoh32(uint32_t);
+uint64_t betoh64(uint64_t);
+uint16_t be16toh(uint16_t);
+uint32_t be32toh(uint32_t);
+uint64_t be64toh(uint64_t);
+
/* err.c */
void _errfp(FILE *, int, const char *, ...);
void _verrfp(FILE *, int, const char *, va_list);
diff --git a/usr/src/lib/libc/sparc/Makefile.com b/usr/src/lib/libc/sparc/Makefile.com
index b367364df9..8b0932d08f 100644
--- a/usr/src/lib/libc/sparc/Makefile.com
+++ b/usr/src/lib/libc/sparc/Makefile.com
@@ -1151,7 +1151,7 @@ BUILD.s= $(AS) $(ASFLAGS) $< -o $@
# Override this top level flag so the compiler builds in its native
# C99 mode. This has been enabled to support the complex arithmetic
# added to libc.
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
# libc method of building an archive
# The "$(GREP) -v ' L '" part is necessary only until
diff --git a/usr/src/lib/libc/sparcv9/Makefile.com b/usr/src/lib/libc/sparcv9/Makefile.com
index 6b3900c135..50f5bfde65 100644
--- a/usr/src/lib/libc/sparcv9/Makefile.com
+++ b/usr/src/lib/libc/sparcv9/Makefile.com
@@ -1085,7 +1085,7 @@ BUILD.s= $(AS) $(ASFLAGS) $< -o $@
# Override this top level flag so the compiler builds in its native
# C99 mode. This has been enabled to support the complex arithmetic
# added to libc.
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
# libc method of building an archive
# The "$(GREP) -v ' L '" part is necessary only until
diff --git a/usr/src/lib/libdisasm/Makefile.com b/usr/src/lib/libdisasm/Makefile.com
index adc0816474..b465f56752 100644
--- a/usr/src/lib/libdisasm/Makefile.com
+++ b/usr/src/lib/libdisasm/Makefile.com
@@ -139,7 +139,7 @@ CFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common)
CFLAGS64_standalone = $(STAND_FLAGS_64)
CFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common)
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
DYNFLAGS += $(ZINTERPOSE)
diff --git a/usr/src/lib/libdns_sd/Makefile.com b/usr/src/lib/libdns_sd/Makefile.com
index 944a538b25..5363d2dead 100644
--- a/usr/src/lib/libdns_sd/Makefile.com
+++ b/usr/src/lib/libdns_sd/Makefile.com
@@ -36,7 +36,7 @@ SRCDIR = ../common
LDLIBS += -lsocket -lnsl -lc
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CPPFLAGS += -I$(SRCDIR) -DNOT_HAVE_SA_LEN -D_XPG4_2 -D__EXTENSIONS__
CPPFLAGS += -DMDNS_VERSIONSTR_NODTS
diff --git a/usr/src/lib/libdns_sd/java/Makefile.com b/usr/src/lib/libdns_sd/java/Makefile.com
index 8a8133ba95..acfcc13dbd 100644
--- a/usr/src/lib/libdns_sd/java/Makefile.com
+++ b/usr/src/lib/libdns_sd/java/Makefile.com
@@ -34,7 +34,7 @@ LIBS = $(DYNLIB)
SRCDIR = ../common
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CPPFLAGS += -I$(JAVA_ROOT)/include -I$(JAVA_ROOT)/include/solaris
CPPFLAGS += -I../com/apple/dnssd
CPPFLAGS += -D_REENTRANT
diff --git a/usr/src/lib/libfakekernel/Makefile.com b/usr/src/lib/libfakekernel/Makefile.com
index dd448d45db..ef1abe4072 100644
--- a/usr/src/lib/libfakekernel/Makefile.com
+++ b/usr/src/lib/libfakekernel/Makefile.com
@@ -53,7 +53,7 @@ SRCS= $(COBJS:%.o=$(SRCDIR)/%.c)
$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
C99LMODE = -Xc99=%all
# Note: need our sys includes _before_ ENVCPPFLAGS, proto etc.
diff --git a/usr/src/lib/libfcoe/Makefile.com b/usr/src/lib/libfcoe/Makefile.com
index ed9f3d773d..e3daeefd56 100644
--- a/usr/src/lib/libfcoe/Makefile.com
+++ b/usr/src/lib/libfcoe/Makefile.com
@@ -38,7 +38,7 @@ INCS += -I$(SRCDIR)
INCS += -I$(SRC)/uts/common/sys/fcoe
LDLIBS += -lc -ldladm -lscf
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CPPFLAGS += $(INCS) -D_REENTRANT
diff --git a/usr/src/lib/libfdisk/Makefile.com b/usr/src/lib/libfdisk/Makefile.com
index 7e05c8f947..46572b0b2b 100644
--- a/usr/src/lib/libfdisk/Makefile.com
+++ b/usr/src/lib/libfdisk/Makefile.com
@@ -39,7 +39,7 @@ SRCDIR= ../common
LIBS= $(DYNLIB) $(LINTLIB)
-C99MODE= $(C99_DISABLE)
+CSTD= $(CSTD_GNU89)
CPPFLAGS += -I.
LDLIBS += -lc
diff --git a/usr/src/lib/libficl/Makefile.com b/usr/src/lib/libficl/Makefile.com
index cdf4419df0..a7f4a3f63f 100644
--- a/usr/src/lib/libficl/Makefile.com
+++ b/usr/src/lib/libficl/Makefile.com
@@ -28,7 +28,7 @@ include $(SRC)/lib/Makefile.lib
LIBS= $(DYNLIB) $(LINTLIB)
FICLDIR= $(SRC)/common/ficl
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CPPFLAGS += -I.. -I$(FICLDIR) -D_LARGEFILE64_SOURCE=1
# As variable "count" is marked volatile, gcc 4.4.4 will complain about
diff --git a/usr/src/lib/libidmap/Makefile.com b/usr/src/lib/libidmap/Makefile.com
index 2a5e5484de..aff1f976e9 100644
--- a/usr/src/lib/libidmap/Makefile.com
+++ b/usr/src/lib/libidmap/Makefile.com
@@ -41,7 +41,7 @@ OBJECTS = $(LINT_OBJECTS) \
idmap_xdr.o
include ../../Makefile.lib
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
LIBS = $(DYNLIB) $(LINTLIB)
LDLIBS += -lc -lavl -lnsl -lnvpair -luutil
diff --git a/usr/src/lib/libilb/Makefile.com b/usr/src/lib/libilb/Makefile.com
index abc7c7f1fa..dd8e50d040 100644
--- a/usr/src/lib/libilb/Makefile.com
+++ b/usr/src/lib/libilb/Makefile.com
@@ -40,7 +40,7 @@ LDLIBS += -lc
SRCDIR = ../common
$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CFLAGS += -mt $(CCVERBOSE)
CPPFLAGS += $(INCS)
diff --git a/usr/src/lib/libinetsvc/Makefile.com b/usr/src/lib/libinetsvc/Makefile.com
index be13b64f96..4d12fdc942 100644
--- a/usr/src/lib/libinetsvc/Makefile.com
+++ b/usr/src/lib/libinetsvc/Makefile.com
@@ -35,7 +35,7 @@ LDLIBS += -lscf -lc -lsocket -lnsl -lmd -luutil
SRCDIR = ../common
$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
-CFLAGS += $(CCVERBOSE) -Wp,-xc99=%all
+CFLAGS += $(CCVERBOSE) -Wp,$(CSTD_GNU99)
CPPFLAGS += -I../common -D_REENTRANT
$(RELEASE_BUILD)CPPFLAGS += -DNDEBUG
diff --git a/usr/src/lib/libipmi/Makefile.com b/usr/src/lib/libipmi/Makefile.com
index eef10e59af..0942455097 100644
--- a/usr/src/lib/libipmi/Makefile.com
+++ b/usr/src/lib/libipmi/Makefile.com
@@ -56,7 +56,7 @@ CLEANFILES += $(SRCDIR)/ipmi_tables.c
INCS += -I$(SRCDIR)
LDLIBS += -lc -lm -lnvpair -lsocket -lnsl
CPPFLAGS += $(INCS)
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-uninitialized
diff --git a/usr/src/lib/libiscsit/Makefile.com b/usr/src/lib/libiscsit/Makefile.com
index f733019450..3388c07123 100644
--- a/usr/src/lib/libiscsit/Makefile.com
+++ b/usr/src/lib/libiscsit/Makefile.com
@@ -39,7 +39,7 @@ SRCDIR = ../common
INCS += -I$(SRCDIR)
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
LDLIBS += -lc -lnvpair -lstmf -luuid -lnsl -lscf
CPPFLAGS += $(INCS) -D_REENTRANT
diff --git a/usr/src/lib/libm/Makefile.libm.com b/usr/src/lib/libm/Makefile.libm.com
index ffa6c888d4..93d071c377 100644
--- a/usr/src/lib/libm/Makefile.libm.com
+++ b/usr/src/lib/libm/Makefile.libm.com
@@ -23,9 +23,9 @@ ASSUFFIX_sparc = S
ASSUFFIX_i386 = s
ASSUFFIX = $(ASSUFFIX_$(MACH))
-# With studio C99MODE of neither enabled nor disabled is "no_lib", whereby we
+# With studio CSTD of neither enabled nor disabled is "no_lib", whereby we
# expect C99-the-language, but don't modify the behaviour of library routines.
-# This is VERY IMPORTANT, as -xc99=%all, for instance, would link us with
+# This is VERY IMPORTANT, as $(CSTD_GNU99), for instance, would link us with
# values-xpg6, which would introduce an __xpg6 to our object with the C99
# flags set, causing us to default C99 libm behaviour on, breaking
# compatibility.
@@ -33,7 +33,7 @@ ASSUFFIX = $(ASSUFFIX_$(MACH))
# We must then, unfortunately, defeat the GNU compiler _defaulting_ to C99, by
# in that case setting it back to gnu89, which _also_ accepts C99 syntax as
# far as is important.
-C99MODE =
+CSTD =
CFLAGS += -_gcc=-std=gnu89
CFLAGS64 += -_gcc=-std=gnu89
@@ -55,7 +55,7 @@ CPPFLAGS += -I$(LIBMSRC)/C \
# GCC needs __C99FEATURES__ such that the implementations of isunordered,
# isgreaterequal, islessequal, etc, exist. This is basically equivalent to
# providing no -xc99 to Studio, in that it gets us the C99 language features,
-# but not values-xpg6, the reason for which is outlined with C99MODE.
+# but not values-xpg6, the reason for which is outlined with CSTD.
CFLAGS += -_gcc=-D__C99FEATURES__
CFLAGS64 += -_gcc=-D__C99FEATURES__
diff --git a/usr/src/lib/libndmp/Makefile.com b/usr/src/lib/libndmp/Makefile.com
index 0100610434..e96223b3ec 100644
--- a/usr/src/lib/libndmp/Makefile.com
+++ b/usr/src/lib/libndmp/Makefile.com
@@ -46,7 +46,7 @@ SRCDIR = ../common
INCS += -I$(SRCDIR)
INCS += -I$(SRC)/cmd/ndmpd/include
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
LIBS= $(DYNLIB) $(LINTLIB)
LDLIBS += -lc -lscf
diff --git a/usr/src/lib/libnsctl/Makefile.com b/usr/src/lib/libnsctl/Makefile.com
index fb0431310f..36042e4c6f 100644
--- a/usr/src/lib/libnsctl/Makefile.com
+++ b/usr/src/lib/libnsctl/Makefile.com
@@ -37,7 +37,7 @@ SRCDIR= ../common
INCS += -I$(SRCDIR)
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
LDLIBS += -lc
diff --git a/usr/src/lib/libnvpair/Makefile.com b/usr/src/lib/libnvpair/Makefile.com
index c1c5e3210e..029dff2b7f 100644
--- a/usr/src/lib/libnvpair/Makefile.com
+++ b/usr/src/lib/libnvpair/Makefile.com
@@ -74,7 +74,7 @@ CERRWARN += -_gcc=-Wno-uninitialized
CFLAGS += $(CCVERBOSE)
CPPFLAGS += -D_REENTRANT
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
diff --git a/usr/src/lib/libproc/Makefile.com b/usr/src/lib/libproc/Makefile.com
index 30790b7a6f..bf20ef40d5 100644
--- a/usr/src/lib/libproc/Makefile.com
+++ b/usr/src/lib/libproc/Makefile.com
@@ -85,7 +85,7 @@ SRCS = $(CMNOBJS:%.o=../common/%.c) $(ISAOBJS:%.o=%.c)
LIBS = $(DYNLIB) $(LINTLIB)
LDLIBS += -lrtld_db -lelf -lctf -lc
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CPPFLAGS += $($(MACH64)_CPPFLAGS)
SRCDIR = ../common
diff --git a/usr/src/lib/libresolv/Makefile b/usr/src/lib/libresolv/Makefile
index b53ce5c037..4b905e0c8f 100644
--- a/usr/src/lib/libresolv/Makefile
+++ b/usr/src/lib/libresolv/Makefile
@@ -47,7 +47,7 @@ include ../Makefile.rootfs
SRCDIR = .
-C99MODE= $(C99_DISABLE)
+CSTD= $(CSTD_GNU89)
# We really want to say this:
# CPPFLAGS += -DDEBUG -DSYSV -D_REENTRANT -I. -I../common/inc
diff --git a/usr/src/lib/librestart/Makefile.com b/usr/src/lib/librestart/Makefile.com
index feb2b242ef..7f2ef884aa 100644
--- a/usr/src/lib/librestart/Makefile.com
+++ b/usr/src/lib/librestart/Makefile.com
@@ -22,8 +22,6 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
LIBRARY = librestart.a
VERS = .1
@@ -40,7 +38,7 @@ LDLIBS += -lpool -lproject -lsecdb -lnvpair -lsysevent -lscf -luutil -lc
SRCDIR = ../common
$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
-CFLAGS += $(CCVERBOSE) -Wp,-xc99=%all
+CFLAGS += $(CCVERBOSE) -Wp,$(CSTD_GNU99)
CPPFLAGS +=
diff --git a/usr/src/lib/libsaveargs/tests/dump/Makefile b/usr/src/lib/libsaveargs/tests/dump/Makefile
index 41c2f51cd9..8732f9c64e 100644
--- a/usr/src/lib/libsaveargs/tests/dump/Makefile
+++ b/usr/src/lib/libsaveargs/tests/dump/Makefile
@@ -25,7 +25,7 @@ CFLAGS += -m64
LDLIBS64 += -lctf -lelf -lsaveargs
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
$(PROG): $(OBJECTS)
$(LINK.c) -o $@ $(OBJECTS) $(LDLIBS64)
diff --git a/usr/src/lib/libscf/Makefile.com b/usr/src/lib/libscf/Makefile.com
index 66b02c4fa7..9388f9cfb1 100644
--- a/usr/src/lib/libscf/Makefile.com
+++ b/usr/src/lib/libscf/Makefile.com
@@ -52,7 +52,7 @@ $(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
COMDIR = ../../../common/svc
-CFLAGS += $(CCVERBOSE) -Wp,-xc99=%all
+CFLAGS += $(CCVERBOSE) -Wp,$(CSTD_GNU99)
CPPFLAGS += -I../inc -I../../common/inc -I$(COMDIR) -I$(ROOTHDRDIR)
$(NOT_RELEASE_BUILD) CPPFLAGS += -DFASTREBOOT_DEBUG
diff --git a/usr/src/lib/libshare/Makefile.com b/usr/src/lib/libshare/Makefile.com
index 2f8aad345f..509ba0c662 100644
--- a/usr/src/lib/libshare/Makefile.com
+++ b/usr/src/lib/libshare/Makefile.com
@@ -43,7 +43,7 @@ $(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
#add nfs/lib directory as part of the include path
CFLAGS += $(CCVERBOSE)
-C99MODE += $(C99_ENABLE)
+CSTD += $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-switch
diff --git a/usr/src/lib/libsmbfs/Makefile.com b/usr/src/lib/libsmbfs/Makefile.com
index 0721dfc302..0521eba951 100644
--- a/usr/src/lib/libsmbfs/Makefile.com
+++ b/usr/src/lib/libsmbfs/Makefile.com
@@ -93,7 +93,7 @@ SRCS= $(OBJ_LIB:%.o=$(SRCDIR)/%.c) \
$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LDLIBS += -lsocket -lnsl -lc -lmd -lpkcs11 -lkrb5 -lsec -lidmap
diff --git a/usr/src/lib/libsrpt/Makefile.com b/usr/src/lib/libsrpt/Makefile.com
index 4cc7d1d599..db3ff8edc6 100644
--- a/usr/src/lib/libsrpt/Makefile.com
+++ b/usr/src/lib/libsrpt/Makefile.com
@@ -37,7 +37,7 @@ SRPTMODDIR = ../../../uts/common/io/comstar/port/srpt
INCS += -I$(SRCDIR) -I$(SRPTMODDIR)
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
C99LMODE = -Xc99=%all
LDLIBS += -lc -lnvpair -lstmf
CPPFLAGS += $(INCS) -D_REENTRANT
diff --git a/usr/src/lib/libstmf/Makefile.com b/usr/src/lib/libstmf/Makefile.com
index 99ca037802..76ffd111de 100644
--- a/usr/src/lib/libstmf/Makefile.com
+++ b/usr/src/lib/libstmf/Makefile.com
@@ -36,7 +36,7 @@ SRCDIR = ../common
INCS += -I$(SRCDIR)
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
LDLIBS += -lc -lnvpair -lscf -lm
CPPFLAGS += $(INCS) -D_REENTRANT
diff --git a/usr/src/lib/libstmfproxy/Makefile.com b/usr/src/lib/libstmfproxy/Makefile.com
index b408eb4c4d..e54ba642f3 100644
--- a/usr/src/lib/libstmfproxy/Makefile.com
+++ b/usr/src/lib/libstmfproxy/Makefile.com
@@ -36,7 +36,7 @@ SRCDIR = ../common
INCS += -I$(SRCDIR)
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
LDLIBS += -lc -lsocket -lnsl
CPPFLAGS += $(INCS) -D_REENTRANT
diff --git a/usr/src/lib/libv12n/sparc/Makefile b/usr/src/lib/libv12n/sparc/Makefile
index 2d76647e9f..a4fcbfad35 100644
--- a/usr/src/lib/libv12n/sparc/Makefile
+++ b/usr/src/lib/libv12n/sparc/Makefile
@@ -40,7 +40,7 @@ OBJS += $(CMNOBJS)
include ../Makefile.com
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
LDLIBS += -luuid -lc
diff --git a/usr/src/lib/libv12n/sparcv9/Makefile b/usr/src/lib/libv12n/sparcv9/Makefile
index a03fd47ade..7edfc67227 100644
--- a/usr/src/lib/libv12n/sparcv9/Makefile
+++ b/usr/src/lib/libv12n/sparcv9/Makefile
@@ -41,7 +41,7 @@ OBJS += $(CMNOBJS)
include ../Makefile.com
include ../../Makefile.lib.64
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
LDLIBS += -luuid -lc
diff --git a/usr/src/lib/libvrrpadm/Makefile.com b/usr/src/lib/libvrrpadm/Makefile.com
index 004227bca4..9c26030c8b 100644
--- a/usr/src/lib/libvrrpadm/Makefile.com
+++ b/usr/src/lib/libvrrpadm/Makefile.com
@@ -41,7 +41,7 @@ $(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
CFLAGS += $(CCVERBOSE)
CPPFLAGS += -I$(SRCDIR) -D_REENTRANT
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
.KEEP_STATE:
diff --git a/usr/src/lib/libzfs/Makefile.com b/usr/src/lib/libzfs/Makefile.com
index 6eaf4332f2..c4a8af38b8 100644
--- a/usr/src/lib/libzfs/Makefile.com
+++ b/usr/src/lib/libzfs/Makefile.com
@@ -67,7 +67,7 @@ INCS += -I../../../uts/common/fs/zfs
INCS += -I../../../common/zfs
INCS += -I../../libc/inc
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
LDLIBS += -lc -lm -ldevid -lgen -lnvpair -luutil -lavl -lefi \
-ladm -lidmap -ltsol -lmd -lumem -lzfs_core -lcmdutils
diff --git a/usr/src/lib/libzfs_core/Makefile.com b/usr/src/lib/libzfs_core/Makefile.com
index cd756d5be3..5f23a27a1a 100644
--- a/usr/src/lib/libzfs_core/Makefile.com
+++ b/usr/src/lib/libzfs_core/Makefile.com
@@ -47,7 +47,7 @@ INCS += -I../../../uts/common/fs/zfs
INCS += -I../../../common/zfs
INCS += -I../../libc/inc
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
LDLIBS += -lc -lnvpair
CPPFLAGS += $(INCS) -D_LARGEFILE64_SOURCE=1 -D_REENTRANT
diff --git a/usr/src/lib/libzpool/Makefile.com b/usr/src/lib/libzpool/Makefile.com
index b5a25f2b62..e6b5a43695 100644
--- a/usr/src/lib/libzpool/Makefile.com
+++ b/usr/src/lib/libzpool/Makefile.com
@@ -62,7 +62,7 @@ CLEANFILES += $(EXTPICS)
$(LINTLIB) := SRCS= $(SRCDIR)/$(LINTSRC)
$(LINTLIB): ../common/zfs.h
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
CFLAGS += -g $(CCVERBOSE) $(CNOGLOBAL)
diff --git a/usr/src/lib/nsswitch/mdns/Makefile.com b/usr/src/lib/nsswitch/mdns/Makefile.com
index 00e335d732..dcd10ade20 100644
--- a/usr/src/lib/nsswitch/mdns/Makefile.com
+++ b/usr/src/lib/nsswitch/mdns/Makefile.com
@@ -21,8 +21,6 @@
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#ident "%Z%%M% %I% %E% SMI"
-#
# lib/nsswitch/mdns/Makefile.com
LIBRARY = libnss_mdns.a
@@ -35,7 +33,7 @@ OBJECTS = gethostent.o \
# include common nsswitch library definitions.
include ../../Makefile.com
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
LDLIBS += -lnsl -ldns_sd -lscf
DYNLIB1 = nss_mdns.so$(VERS)
diff --git a/usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com b/usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com
index 7345ddc892..3599abeb1c 100644
--- a/usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com
+++ b/usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com
@@ -76,7 +76,7 @@ TSSINC=-I$(TSPIINCDIR)
LDLIBS += $(TSSLIB) -L$(ADJUNCT_PROTO)/lib -lc -luuid -lmd -ltspi -lsunw_crypto
CPPFLAGS += -xCC -D_POSIX_PTHREAD_SEMANTICS $(TSSINC)
CPPFLAGS64 += $(CPPFLAGS)
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-unused-label
diff --git a/usr/src/lib/policykit/Makefile.com b/usr/src/lib/policykit/Makefile.com
index 77f2328313..89fd9296b7 100644
--- a/usr/src/lib/policykit/Makefile.com
+++ b/usr/src/lib/policykit/Makefile.com
@@ -30,7 +30,7 @@ CPPFLAGS = $(POLICYKIT_DBUS_CPPFLAGS) $(POLICYKIT_GLIB_CPPFLAGS) $(CPPFLAGS.mast
CERRWARN += -_gcc=-Wno-unused-variable
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
ROOTLIBPCDIR = $(ROOT)/usr/lib/pkgconfig
ROOTLIBPC = $(LIBPCSRC:%=$(ROOTLIBPCDIR)/%)
diff --git a/usr/src/lib/pylibbe/Makefile.com b/usr/src/lib/pylibbe/Makefile.com
index 19240f56a5..3a2d866213 100644
--- a/usr/src/lib/pylibbe/Makefile.com
+++ b/usr/src/lib/pylibbe/Makefile.com
@@ -38,7 +38,7 @@ PYOBJS= $(PYSRCS:%.py=$(SRCDIR)/%.pyc)
PYFILES= $(PYSRCS) $(PYSRCS:%.py=%.pyc)
ROOTPYBEFILES= $(PYFILES:%=$(ROOTLIBDIR)/%)
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
LIBS = $(DYNLIB)
LDLIBS += -lbe -lnvpair -lc
diff --git a/usr/src/lib/pysolaris/Makefile.com b/usr/src/lib/pysolaris/Makefile.com
index 05eb7981d3..4a70113ab4 100644
--- a/usr/src/lib/pysolaris/Makefile.com
+++ b/usr/src/lib/pysolaris/Makefile.com
@@ -37,7 +37,7 @@ PYOBJS= $(PYSRCS:%.py=$(SRCDIR)/%.pyc)
PYFILES= $(PYSRCS) $(PYSRCS:%.py=%.pyc)
ROOTPYSOLFILES= $(PYFILES:%=$(ROOTLIBDIR)/%)
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
LIBS = $(DYNLIB)
diff --git a/usr/src/lib/pyzfs/Makefile.com b/usr/src/lib/pyzfs/Makefile.com
index 668151416d..59720a8334 100644
--- a/usr/src/lib/pyzfs/Makefile.com
+++ b/usr/src/lib/pyzfs/Makefile.com
@@ -40,7 +40,7 @@ PYOBJS= $(PYSRCS:%.py=$(SRCDIR)/%.pyc)
PYFILES= $(PYSRCS) $(PYSRCS:%.py=%.pyc)
ROOTPYZFSFILES= $(PYFILES:%=$(ROOTLIBDIR)/%)
-C99MODE= -xc99=%all
+CSTD= $(CSTD_GNU99)
C99LMODE= -Xc99=%all
LIBS = $(DYNLIB)
diff --git a/usr/src/lib/scsi/libscsi/Makefile.com b/usr/src/lib/scsi/libscsi/Makefile.com
index c9dafcb29b..d8e18b1fb3 100644
--- a/usr/src/lib/scsi/libscsi/Makefile.com
+++ b/usr/src/lib/scsi/libscsi/Makefile.com
@@ -37,7 +37,7 @@ include ../../../Makefile.lib
include ../../Makefile.defs
SRCS = $(OBJECTS:%.o=../common/%.c)
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CPPFLAGS += -I../common -I. -D_REENTRANT
$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
CFLAGS += $(CCVERBOSE)
diff --git a/usr/src/lib/scsi/libses/Makefile.defs b/usr/src/lib/scsi/libses/Makefile.defs
index e3615d0665..91c04eeeec 100644
--- a/usr/src/lib/scsi/libses/Makefile.defs
+++ b/usr/src/lib/scsi/libses/Makefile.defs
@@ -24,7 +24,7 @@
#
SRCS = $(OBJECTS:%.o=../common/%.c)
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CPPFLAGS += -I../common -I. -D_REENTRANT
$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
CFLAGS += $(CCVERBOSE)
diff --git a/usr/src/lib/scsi/libsmp/Makefile.com b/usr/src/lib/scsi/libsmp/Makefile.com
index 95b666e4fb..428e4e795c 100644
--- a/usr/src/lib/scsi/libsmp/Makefile.com
+++ b/usr/src/lib/scsi/libsmp/Makefile.com
@@ -36,7 +36,7 @@ include ../../../Makefile.lib
include ../../Makefile.defs
SRCS = $(OBJECTS:%.o=../common/%.c)
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CPPFLAGS += -I../common -I. -D_REENTRANT
$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
CFLAGS += $(CCVERBOSE)
diff --git a/usr/src/lib/scsi/plugins/scsi/engines/Makefile.engine b/usr/src/lib/scsi/plugins/scsi/engines/Makefile.engine
index 8a8941813d..12b742ef1a 100644
--- a/usr/src/lib/scsi/plugins/scsi/engines/Makefile.engine
+++ b/usr/src/lib/scsi/plugins/scsi/engines/Makefile.engine
@@ -23,7 +23,6 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
.KEEP_STATE:
.SUFFIXES:
@@ -60,7 +59,7 @@ DMODLINTFILES = $(DMOD_SRCS:%.c=%.ln)
APIMAP = ../../../../../libscsi/libscsi_api.map
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
CFLAGS += -G $(XREGSFLAG)
CFLAGS64 += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
diff --git a/usr/src/lib/scsi/plugins/ses/Makefile.lib b/usr/src/lib/scsi/plugins/ses/Makefile.lib
index 719463197a..c8bbd52561 100644
--- a/usr/src/lib/scsi/plugins/ses/Makefile.lib
+++ b/usr/src/lib/scsi/plugins/ses/Makefile.lib
@@ -23,7 +23,6 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#ident "%Z%%M% %I% %E% SMI"
.KEEP_STATE:
.SUFFIXES:
@@ -70,7 +69,7 @@ DMODLINTFILES = $(DMOD_SRCS:%.c=%.ln)
APIMAP = ../../../../libses/libses_api.map
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
CFLAGS += -G $(XREGSFLAG)
CFLAGS64 += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
diff --git a/usr/src/lib/scsi/plugins/smp/Makefile.lib b/usr/src/lib/scsi/plugins/smp/Makefile.lib
index 1b44f8e4a6..3ef898705c 100644
--- a/usr/src/lib/scsi/plugins/smp/Makefile.lib
+++ b/usr/src/lib/scsi/plugins/smp/Makefile.lib
@@ -68,7 +68,7 @@ DMODLINTFILES = $(DMOD_SRCS:%.c=%.ln)
APIMAP = ../../../../libsmp/libsmp_api.map
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
CFLAGS += -G $(XREGSFLAG)
CFLAGS64 += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST) $(CC_PICFLAGS)
diff --git a/usr/src/lib/smbsrv/Makefile.lib b/usr/src/lib/smbsrv/Makefile.lib
index 625bde45c4..a6c75a4ab4 100644
--- a/usr/src/lib/smbsrv/Makefile.lib
+++ b/usr/src/lib/smbsrv/Makefile.lib
@@ -22,7 +22,6 @@
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#ident "%Z%%M% %I% %E% SMI"
#
# Common Makefile definitions for smbsrv.
@@ -40,7 +39,7 @@ ROOTLIBDIR64 = $(ROOT)/usr/lib/smbsrv/$(MACH64)
SRCDIR= ../common
NDLDIR= $(ROOT)/usr/include/smbsrv/ndl
LIBS= $(DYNLIB) $(LINTLIB)
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
C99LMODE = -Xc99=%all
CPPFLAGS += -I$(SRCDIR) -I.
LDLIBS32 += -L$(ROOT)/usr/lib/smbsrv
diff --git a/usr/src/man/man7p/tcp.7p b/usr/src/man/man7p/tcp.7p
index db739fc754..1e555956a0 100644
--- a/usr/src/man/man7p/tcp.7p
+++ b/usr/src/man/man7p/tcp.7p
@@ -5,7 +5,7 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH TCP 7P "Apr 27, 2015"
+.TH TCP 7P "Feb 5, 2018"
.SH NAME
tcp, TCP \- Internet Transmission Control Protocol
.SH SYNOPSIS
@@ -133,12 +133,7 @@ and tested with \fBgetsockopt\fR(3SOCKET). The option level for the
\fBgetprotobyname\fR(3SOCKET).
.sp
.LP
-The SO_RCVBUF socket level option can be used to control the window that TCP
-advertises to the peer. IP level options may also be used with TCP. See
-\fBip\fR(7P) and \fBip6\fR(7P).
-.sp
-.LP
-Another socket level option, \fBSO_RCVBUF,\fR can be used to control the window
+The \fBSO_RCVBUF\fR socket level option can be used to control the window
that \fBTCP\fR advertises to the peer. \fBIP\fR level options may also be used
with \fBTCP.\fR See \fBip\fR(7P) and \fBip6\fR(7P).
.sp
diff --git a/usr/src/man/man9/iport.9 b/usr/src/man/man9/iport.9
index c51a8bc41a..1bf8fcaef1 100644
--- a/usr/src/man/man9/iport.9
+++ b/usr/src/man/man9/iport.9
@@ -34,7 +34,7 @@ These interfaces simplify device drivers by taking care of the creation
and destruction of device nodes in the devices tree for enumerated
devices as well as performing some amount of hysteresis.
.Pp
-These abstractions are used in tandem with SCSI complex addressing.
+These abstractions are used in tandem with SCSI complex addressing.
A device driver that uses these interfaces generally passes both the
.Dv SCSI_HBA_HBA
flag and the
@@ -304,7 +304,6 @@ This is performed by the
function.
.Sh SEE ALSO
.Xr attach 9E ,
-.Xr attach 9E ,
.Xr detach 9E ,
.Xr sas_phymap_create 9F ,
.Xr sas_phymap_destroy 9F ,
@@ -329,6 +328,5 @@ function.
.Xr scsi_hba_tgtmap_tgt_add 9F ,
.Xr scsi_hba_tgtmap_tgt_remove 9F ,
.Xr scsi_address 9S ,
-.Xr scsi_address 9S ,
.Xr scsi_device 9S ,
.Xr scsi_hba_tran 9S
diff --git a/usr/src/man/man9f/scsi_address_device.9f b/usr/src/man/man9f/scsi_address_device.9f
index f550d5d324..233a0bf782 100644
--- a/usr/src/man/man9f/scsi_address_device.9f
+++ b/usr/src/man/man9f/scsi_address_device.9f
@@ -135,12 +135,12 @@ Otherwise, if an error occurred
is returned.
.Pp
The
-.Fn scsi_device_hba_private_set
-function returns a data value registered via the
.Fn scsi_device_hba_private_get
+function returns a data value registered via the
+.Fn scsi_device_hba_private_set
function.
If the
-.Fn scsi_device_hba_private_get
+.Fn scsi_device_hba_private_set
was never called,
.Dv NULL
is returned.
diff --git a/usr/src/man/man9f/scsi_hba_iportmap_create.9f b/usr/src/man/man9f/scsi_hba_iportmap_create.9f
index 8c7e127160..8570013ca6 100644
--- a/usr/src/man/man9f/scsi_hba_iportmap_create.9f
+++ b/usr/src/man/man9f/scsi_hba_iportmap_create.9f
@@ -175,5 +175,4 @@ is returned.
.Xr iport 9 ,
.Xr iportmap 9 ,
.Xr attach 9E ,
-.Xr detach 9E ,
.Xr detach 9E
diff --git a/usr/src/pkg/manifests/system-kernel.man9.inc b/usr/src/pkg/manifests/system-kernel.man9.inc
index 9fa1b9eb3d..cd1d8b6bdb 100644
--- a/usr/src/pkg/manifests/system-kernel.man9.inc
+++ b/usr/src/pkg/manifests/system-kernel.man9.inc
@@ -14,5 +14,9 @@
# Copyright 2012 Nexenta Systems, Inc. All rights reserved.
#
file path=usr/share/man/man9/Intro.9
+file path=usr/share/man/man9/iport.9
file path=usr/share/man/man9/vmem.9
link path=usr/share/man/man9/intro.9 target=Intro.9
+link path=usr/share/man/man9/iportmap.9 target=iport.9
+link path=usr/share/man/man9/phymap.9 target=iport.9
+link path=usr/share/man/man9/tgtmap.9 target=iport.9
diff --git a/usr/src/pkg/manifests/system-kernel.man9f.inc b/usr/src/pkg/manifests/system-kernel.man9f.inc
index d12a1900d5..15e2395d6f 100644
--- a/usr/src/pkg/manifests/system-kernel.man9f.inc
+++ b/usr/src/pkg/manifests/system-kernel.man9f.inc
@@ -437,7 +437,10 @@ file path=usr/share/man/man9f/rmfree.9f
file path=usr/share/man/man9f/rmvb.9f
file path=usr/share/man/man9f/rmvq.9f
file path=usr/share/man/man9f/rwlock.9f
+file path=usr/share/man/man9f/sas_phymap_create.9f
+file path=usr/share/man/man9f/sas_phymap_lookup_ua.9f
file path=usr/share/man/man9f/scsi_abort.9f
+file path=usr/share/man/man9f/scsi_address_device.9f
file path=usr/share/man/man9f/scsi_alloc_consistent_buf.9f
file path=usr/share/man/man9f/scsi_cname.9f
file path=usr/share/man/man9f/scsi_destroy_pkt.9f
@@ -450,10 +453,15 @@ file path=usr/share/man/man9f/scsi_get_device_type_scsi_options.9f
file path=usr/share/man/man9f/scsi_get_device_type_string.9f
file path=usr/share/man/man9f/scsi_hba_attach_setup.9f
file path=usr/share/man/man9f/scsi_hba_init.9f
+file path=usr/share/man/man9f/scsi_hba_iport_exist.9f
+file path=usr/share/man/man9f/scsi_hba_iport_register.9f
+file path=usr/share/man/man9f/scsi_hba_iport_unit_address.9f
+file path=usr/share/man/man9f/scsi_hba_iportmap_create.9f
file path=usr/share/man/man9f/scsi_hba_lookup_capstr.9f
file path=usr/share/man/man9f/scsi_hba_pkt_alloc.9f
file path=usr/share/man/man9f/scsi_hba_pkt_comp.9f
file path=usr/share/man/man9f/scsi_hba_probe.9f
+file path=usr/share/man/man9f/scsi_hba_tgtmap_create.9f
file path=usr/share/man/man9f/scsi_hba_tran_alloc.9f
file path=usr/share/man/man9f/scsi_ifgetcap.9f
file path=usr/share/man/man9f/scsi_init_pkt.9f
@@ -471,6 +479,7 @@ file path=usr/share/man/man9f/scsi_transport.9f
file path=usr/share/man/man9f/scsi_unprobe.9f
file path=usr/share/man/man9f/scsi_validate_sense.9f
file path=usr/share/man/man9f/scsi_vu_errmsg.9f
+file path=usr/share/man/man9f/scsi_wwnstr_to_wwn.9f
file path=usr/share/man/man9f/semaphore.9f
file path=usr/share/man/man9f/sprintf.9f
file path=usr/share/man/man9f/stoi.9f
@@ -1257,13 +1266,60 @@ link path=usr/share/man/man9f/rw_read_locked.9f target=rwlock.9f
link path=usr/share/man/man9f/rw_tryenter.9f target=rwlock.9f
link path=usr/share/man/man9f/rw_tryupgrade.9f target=rwlock.9f
link path=usr/share/man/man9f/samestr.9f target=SAMESTR.9f
+link path=usr/share/man/man9f/sas_phymap_destroy.9f \
+ target=sas_phymap_create.9f
+link path=usr/share/man/man9f/sas_phymap_lookup_uapriv.9f \
+ target=sas_phymap_lookup_ua.9f
+link path=usr/share/man/man9f/sas_phymap_phy2ua.9f \
+ target=sas_phymap_lookup_ua.9f
+link path=usr/share/man/man9f/sas_phymap_phy_add.9f \
+ target=sas_phymap_create.9f
+link path=usr/share/man/man9f/sas_phymap_phy_rem.9f \
+ target=sas_phymap_create.9f
+link path=usr/share/man/man9f/sas_phymap_phys_free.9f \
+ target=sas_phymap_lookup_ua.9f
+link path=usr/share/man/man9f/sas_phymap_phys_next.9f \
+ target=sas_phymap_lookup_ua.9f
+link path=usr/share/man/man9f/sas_phymap_ua2phys.9f \
+ target=sas_phymap_lookup_ua.9f
+link path=usr/share/man/man9f/sas_phymap_ua_free.9f \
+ target=sas_phymap_lookup_ua.9f
+link path=usr/share/man/man9f/sas_phymap_uahasphys.9f \
+ target=sas_phymap_lookup_ua.9f
+link path=usr/share/man/man9f/scsi_device_hba_private_get.9f \
+ target=scsi_address_device.9f
+link path=usr/share/man/man9f/scsi_device_hba_private_set.9f \
+ target=scsi_address_device.9f
+link path=usr/share/man/man9f/scsi_device_unit_address.9f \
+ target=scsi_address_device.9f
link path=usr/share/man/man9f/scsi_dmafree.9f target=scsi_dmaget.9f
link path=usr/share/man/man9f/scsi_dname.9f target=scsi_cname.9f
+link path=usr/share/man/man9f/scsi_free_wwnstr.9f target=scsi_wwnstr_to_wwn.9f
link path=usr/share/man/man9f/scsi_hba_detach.9f \
target=scsi_hba_attach_setup.9f
link path=usr/share/man/man9f/scsi_hba_fini.9f target=scsi_hba_init.9f
+link path=usr/share/man/man9f/scsi_hba_iport_find.9f \
+ target=scsi_hba_iport_exist.9f
+link path=usr/share/man/man9f/scsi_hba_iportmap_destroy.9f \
+ target=scsi_hba_iportmap_create.9f
+link path=usr/share/man/man9f/scsi_hba_iportmap_iport_add.9f \
+ target=scsi_hba_iportmap_create.9f
+link path=usr/share/man/man9f/scsi_hba_iportmap_iport_remove.9f \
+ target=scsi_hba_iportmap_create.9f
link path=usr/share/man/man9f/scsi_hba_pkt_free.9f \
target=scsi_hba_pkt_alloc.9f
+link path=usr/share/man/man9f/scsi_hba_tgtmap_set_add.9f \
+ target=scsi_hba_tgtmap_create.9f
+link path=usr/share/man/man9f/scsi_hba_tgtmap_set_begin.9f \
+ target=scsi_hba_tgtmap_create.9f
+link path=usr/share/man/man9f/scsi_hba_tgtmap_set_end.9f \
+ target=scsi_hba_tgtmap_create.9f
+link path=usr/share/man/man9f/scsi_hba_tgtmap_set_flush.9f \
+ target=scsi_hba_tgtmap_create.9f
+link path=usr/share/man/man9f/scsi_hba_tgtmap_tgt_add.9f \
+ target=scsi_hba_tgtmap_create.9f
+link path=usr/share/man/man9f/scsi_hba_tgtmap_tgt_remove.9f \
+ target=scsi_hba_tgtmap_create.9f
link path=usr/share/man/man9f/scsi_hba_tran_free.9f \
target=scsi_hba_tran_alloc.9f
link path=usr/share/man/man9f/scsi_ifsetcap.9f target=scsi_ifgetcap.9f
@@ -1280,6 +1336,8 @@ link path=usr/share/man/man9f/scsi_sense_info_uint64.9f \
target=scsi_ext_sense_fields.9f
link path=usr/share/man/man9f/scsi_sname.9f target=scsi_cname.9f
link path=usr/share/man/man9f/scsi_unslave.9f target=scsi_unprobe.9f
+link path=usr/share/man/man9f/scsi_wwn_to_wwnstr.9f \
+ target=scsi_wwnstr_to_wwn.9f
link path=usr/share/man/man9f/sema_destroy.9f target=semaphore.9f
link path=usr/share/man/man9f/sema_init.9f target=semaphore.9f
link path=usr/share/man/man9f/sema_p.9f target=semaphore.9f
@@ -1315,12 +1373,12 @@ link path=usr/share/man/man9f/va_copy.9f target=va_arg.9f
link path=usr/share/man/man9f/va_end.9f target=va_arg.9f
link path=usr/share/man/man9f/va_start.9f target=va_arg.9f
link path=usr/share/man/man9f/vcmn_err.9f target=cmn_err.9f
-link path=usr/share/man/man9f/vmem_xalloc.9f target=vmem_alloc.9f
-link path=usr/share/man/man9f/vmem_free.9f target=vmem_alloc.9f
-link path=usr/share/man/man9f/vmem_xfree.9f target=vmem_alloc.9f
-link path=usr/share/man/man9f/vmem_xcreate.9f target=vmem_create.9f
link path=usr/share/man/man9f/vmem_destroy.9f target=vmem_create.9f
+link path=usr/share/man/man9f/vmem_free.9f target=vmem_alloc.9f
link path=usr/share/man/man9f/vmem_size.9f target=vmem_walk.9f
+link path=usr/share/man/man9f/vmem_xalloc.9f target=vmem_alloc.9f
+link path=usr/share/man/man9f/vmem_xcreate.9f target=vmem_create.9f
+link path=usr/share/man/man9f/vmem_xfree.9f target=vmem_alloc.9f
link path=usr/share/man/man9f/vsnprintf.9f target=sprintf.9f
link path=usr/share/man/man9f/vsprintf.9f target=sprintf.9f
link path=usr/share/man/man9f/vzcmn_err.9f target=cmn_err.9f
diff --git a/usr/src/psm/stand/bootlst/common/Makefile.com b/usr/src/psm/stand/bootlst/common/Makefile.com
index 25043b1c22..87eea5acd7 100644
--- a/usr/src/psm/stand/bootlst/common/Makefile.com
+++ b/usr/src/psm/stand/bootlst/common/Makefile.com
@@ -59,8 +59,8 @@ CPPINCS += -I$(STANDDIR)/lib/sa
CPPFLAGS = $(CPPDEFS) $(CPPINCS)
CPPFLAGS += $(CCYFLAG)$(STANDDIR)
-C99MODE = $(C99_ENABLE)
-CFLAGS = $(CCVERBOSE) -O $(C99MODE)
+CSTD = $(CSTD_GNU99)
+CFLAGS = $(CCVERBOSE) -O $(CSTD)
ASFLAGS = -P -D_ASM $(CPPDEFS) -DLOCORE -D_LOCORE -D__STDC__
AS_CPPFLAGS = $(CPPINCS) $(CPPFLAGS.master)
diff --git a/usr/src/psm/stand/cpr/common/Makefile.com b/usr/src/psm/stand/cpr/common/Makefile.com
index d5c43bba43..ff5a9504af 100644
--- a/usr/src/psm/stand/cpr/common/Makefile.com
+++ b/usr/src/psm/stand/cpr/common/Makefile.com
@@ -63,8 +63,8 @@ CPPINCS += -I$(SYSDIR)/sun4 -I$(SYSDIR)/common -I$(TOPDIR)/head
CPPFLAGS = $(CPPDEFS) $(CPPINCS) $(CPPFLAGS.master)
CPPFLAGS += $(CCYFLAG)$(SYSDIR)/common
-C99MODE = $(C99_ENABLE)
-CFLAGS = $(CCVERBOSE) -O $(C99MODE)
+CSTD = $(CSTD_GNU99)
+CFLAGS = $(CCVERBOSE) -O $(CSTD)
ASFLAGS = -P -D_ASM $(CPPDEFS) -DLOCORE -D_LOCORE -D__STDC__
AS_CPPFLAGS = $(CPPINCS) $(CPPFLAGS.master)
diff --git a/usr/src/test/crypto-tests/tests/modes/aes/Makefile.subdirs b/usr/src/test/crypto-tests/tests/modes/aes/Makefile.subdirs
index d0dc303420..28484e9a27 100644
--- a/usr/src/test/crypto-tests/tests/modes/aes/Makefile.subdirs
+++ b/usr/src/test/crypto-tests/tests/modes/aes/Makefile.subdirs
@@ -32,7 +32,7 @@ OBJS_KCF = $(OBJS_LOCAL) $(OBJS_COMDIR) $(COMMONDIR)/cryptotest_kcf.o
SRCS = $(OBJS:%.o=%.c)
PKCSLIBS = -lpkcs11 -lcryptoutil
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
CMDS = $(TESTDIR:%=%/$(PROG))
$(CMDS) := FILEMODE = 0555
diff --git a/usr/src/test/libc-tests/tests/Makefile.com b/usr/src/test/libc-tests/tests/Makefile.com
index cdcd639620..919e2ac28f 100644
--- a/usr/src/test/libc-tests/tests/Makefile.com
+++ b/usr/src/test/libc-tests/tests/Makefile.com
@@ -27,7 +27,7 @@ $(BUILD64) PROG64= $(PROG).$(MACH64)
$(OBJS_OVERRIDE)SRCS = $(PROG).c ../common/test_common.c
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
LINTFLAGS += -I../common -DARCH=\"ARCH\" -DLINT
CPPFLAGS += -I$(ROOT)/usr/include -I../common
diff --git a/usr/src/test/libc-tests/tests/select/Makefile b/usr/src/test/libc-tests/tests/select/Makefile
index d7d6fa7641..c5b70a03af 100644
--- a/usr/src/test/libc-tests/tests/select/Makefile
+++ b/usr/src/test/libc-tests/tests/select/Makefile
@@ -22,7 +22,7 @@ ROOTBINDIR = $(ROOTOPTPKG)/bin
PROGS= select_test
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
select_test: select_test.c
$(LINK64.c) -o $@ select_test.c $(LDLIBS64)
diff --git a/usr/src/test/os-tests/tests/file-locking/Makefile b/usr/src/test/os-tests/tests/file-locking/Makefile
index 1773f652a5..79f44472ee 100644
--- a/usr/src/test/os-tests/tests/file-locking/Makefile
+++ b/usr/src/test/os-tests/tests/file-locking/Makefile
@@ -22,7 +22,7 @@ PROGS = \
runtests \
acquire-lock
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
SRCS = $(PROGS:%=%.c) $(UTILS)
PROGS32 = $(PROGS:%=%.32)
diff --git a/usr/src/test/os-tests/tests/poll/Makefile b/usr/src/test/os-tests/tests/poll/Makefile
index 378b7e7490..feffc744fb 100644
--- a/usr/src/test/os-tests/tests/poll/Makefile
+++ b/usr/src/test/os-tests/tests/poll/Makefile
@@ -23,7 +23,7 @@ SRCS = $(OBJS:%.o=%.c)
poll_test := LDLIBS += -lsocket
poll_test.ln := LDLIBS += -lsocket
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
ROOTOPTPKG = $(ROOT)/opt/os-tests
TESTDIR = $(ROOTOPTPKG)/tests/poll
diff --git a/usr/src/test/os-tests/tests/sigqueue/Makefile b/usr/src/test/os-tests/tests/sigqueue/Makefile
index a35908a136..a9166a5823 100644
--- a/usr/src/test/os-tests/tests/sigqueue/Makefile
+++ b/usr/src/test/os-tests/tests/sigqueue/Makefile
@@ -21,7 +21,7 @@ PROG = sigqueue_queue_size
OBJS = $(PROG:%=%.o)
SRCS = $(OBJS:%.o=%.c)
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
ROOTOPTPKG = $(ROOT)/opt/os-tests
TESTDIR = $(ROOTOPTPKG)/tests/sigqueue
diff --git a/usr/src/test/os-tests/tests/sockfs/Makefile b/usr/src/test/os-tests/tests/sockfs/Makefile
index 08a4b4044b..08aecce191 100644
--- a/usr/src/test/os-tests/tests/sockfs/Makefile
+++ b/usr/src/test/os-tests/tests/sockfs/Makefile
@@ -22,7 +22,7 @@ PROG = conn dgram drop_priv nosignal sockpair
LINTS = $(PROGS:%=%.ln)
LDLIBS += -lsocket
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
CPPFLAGS += -D_XOPEN_SOURCE=600 -D__EXTENSIONS__
nosignal := LDLIBS += -lnsl
diff --git a/usr/src/test/os-tests/tests/spoof-ras/Makefile b/usr/src/test/os-tests/tests/spoof-ras/Makefile
index c629a03594..395505da8c 100644
--- a/usr/src/test/os-tests/tests/spoof-ras/Makefile
+++ b/usr/src/test/os-tests/tests/spoof-ras/Makefile
@@ -21,7 +21,7 @@ OBJS = $(PROG:%=%.o)
SRCS = $(OBJS:%.o=%.c)
LDLIBS += -lsocket -lnsl
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
ROOTOPTPKG = $(ROOT)/opt/os-tests
TESTDIR = $(ROOTOPTPKG)/tests
diff --git a/usr/src/test/zfs-tests/cmd/Makefile.subdirs b/usr/src/test/zfs-tests/cmd/Makefile.subdirs
index 0b1a353848..b6cd0d404c 100644
--- a/usr/src/test/zfs-tests/cmd/Makefile.subdirs
+++ b/usr/src/test/zfs-tests/cmd/Makefile.subdirs
@@ -24,7 +24,7 @@ SRCS = $(OBJS:%.o=%.c)
CMDS = $(PROG:%=$(ROOTBIN)/%)
$(CMDS) := FILEMODE = 0555
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
all: $(PROG)
diff --git a/usr/src/test/zfs-tests/tests/functional/channel_program/lua_core/Makefile b/usr/src/test/zfs-tests/tests/functional/channel_program/lua_core/Makefile
index 21f3ff6c39..b31b9aa135 100644
--- a/usr/src/test/zfs-tests/tests/functional/channel_program/lua_core/Makefile
+++ b/usr/src/test/zfs-tests/tests/functional/channel_program/lua_core/Makefile
@@ -26,7 +26,7 @@ PROGS = $(KSHPROGS) $(CPROGS)
FILES :sh= ls *.zcp *.out *.err
LDLIBS = $(LDLIBS.cmd)
LDLIBS += -lzfs_core -lnvpair
-C99MODE = -xc99=%all
+CSTD = $(CSTD_GNU99)
INSTPROGS = $(PROGS:%=$(TESTDIR)/%)
INSTFILES = $(FILES:%=$(TESTDIR)/%)
diff --git a/usr/src/test/zfs-tests/tests/functional/checksum/Makefile.subdirs b/usr/src/test/zfs-tests/tests/functional/checksum/Makefile.subdirs
index 45b39ef904..91a070369e 100644
--- a/usr/src/test/zfs-tests/tests/functional/checksum/Makefile.subdirs
+++ b/usr/src/test/zfs-tests/tests/functional/checksum/Makefile.subdirs
@@ -26,7 +26,7 @@ CMD64 = $(PROG:%=$(TESTDIR)/%.$(MACH64))
CMDS = $(CMD32) $(CMD64)
$(CMDS) := FILEMODE = 0555
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CFLAGS += -I $(SRC)/uts/common -D_KERNEL
LDLIBS += -lmd
LINTFLAGS += -u
diff --git a/usr/src/tools/btxld/Makefile b/usr/src/tools/btxld/Makefile
index 9428eb1620..6165fb6017 100644
--- a/usr/src/tools/btxld/Makefile
+++ b/usr/src/tools/btxld/Makefile
@@ -27,7 +27,7 @@ MAN1ONBLDFILES= btxld.1onbld
SRCS= btxld.c elfh.c version.c $(UTILS_SRC) $(EINFO_SRC) $(EXTRA_SRC)
OBJS= btxld.o elfh.o version.o bblk_einfo.o mboot_extra.o boot_utils.o
LDLIBS += -lmd5
-C99MODE= $(C99_ENABLE)
+CSTD= $(CSTD_GNU99)
CPPFLAGS += -I$(SRC)/uts/common -I$(COMMON_SRC)
$(ROOTONBLDMAN1ONBLDFILES) := FILEMODE= 644
diff --git a/usr/src/tools/ctf/cvt/Makefile.com b/usr/src/tools/ctf/cvt/Makefile.com
index 0eab68b9bd..052cf02cc4 100644
--- a/usr/src/tools/ctf/cvt/Makefile.com
+++ b/usr/src/tools/ctf/cvt/Makefile.com
@@ -84,7 +84,7 @@ CERRWARN += -_gcc=-Wno-unused
CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-switch
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
ctfconvert := LDFLAGS += $(DWARFLDFLAGS)
diff --git a/usr/src/uts/Makefile.uts b/usr/src/uts/Makefile.uts
index bc3e4d467e..0620f63d45 100644
--- a/usr/src/uts/Makefile.uts
+++ b/usr/src/uts/Makefile.uts
@@ -220,7 +220,7 @@ CERRWARN += -_gcc=-Wno-missing-field-initializers
$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused
$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-empty-body
-C99MODE = $(C99_ENABLE)
+CSTD = $(CSTD_GNU99)
CFLAGS_uts =
CFLAGS_uts += $(STAND_FLAGS_$(CLASS))
diff --git a/usr/src/uts/common/fs/zfs/spa.c b/usr/src/uts/common/fs/zfs/spa.c
index f273a7c299..56d316a16d 100644
--- a/usr/src/uts/common/fs/zfs/spa.c
+++ b/usr/src/uts/common/fs/zfs/spa.c
@@ -165,6 +165,12 @@ boolean_t spa_create_process = B_TRUE; /* no process ==> no sysdc */
extern int zfs_sync_pass_deferred_free;
/*
+ * Report any spa_load_verify errors found, but do not fail spa_load.
+ * This is used by zdb to analyze non-idle pools.
+ */
+boolean_t spa_load_verify_dryrun = B_FALSE;
+
+/*
* This (illegal) pool name is used when temporarily importing a spa_t in order
* to get the vdev stats associated with the imported devices.
*/
@@ -1242,6 +1248,8 @@ spa_unload(spa_t *spa)
ASSERT(MUTEX_HELD(&spa_namespace_lock));
+ spa_load_note(spa, "UNLOADING");
+
/*
* Stop async tasks.
*/
@@ -1995,6 +2003,13 @@ spa_load_verify(spa_t *spa)
ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE);
if (spa_load_verify_metadata) {
+ if (spa->spa_extreme_rewind) {
+ spa_load_note(spa, "performing a complete scan of the "
+ "pool since extreme rewind is on. This may take "
+ "a very long time.\n (spa_load_verify_data=%u, "
+ "spa_load_verify_metadata=%u)",
+ spa_load_verify_data, spa_load_verify_metadata);
+ }
error = traverse_pool(spa, spa->spa_verify_min_txg,
TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA,
spa_load_verify_cb, rio);
@@ -2005,8 +2020,15 @@ spa_load_verify(spa_t *spa)
spa->spa_load_meta_errors = sle.sle_meta_count;
spa->spa_load_data_errors = sle.sle_data_count;
- if (!error && sle.sle_meta_count <= policy.zrp_maxmeta &&
- sle.sle_data_count <= policy.zrp_maxdata) {
+ if (sle.sle_meta_count != 0 || sle.sle_data_count != 0) {
+ spa_load_note(spa, "spa_load_verify found %llu metadata errors "
+ "and %llu data errors", (u_longlong_t)sle.sle_meta_count,
+ (u_longlong_t)sle.sle_data_count);
+ }
+
+ if (spa_load_verify_dryrun ||
+ (!error && sle.sle_meta_count <= policy.zrp_maxmeta &&
+ sle.sle_data_count <= policy.zrp_maxdata)) {
int64_t loss = 0;
verify_ok = B_TRUE;
@@ -2024,6 +2046,9 @@ spa_load_verify(spa_t *spa)
spa->spa_load_max_txg = spa->spa_uberblock.ub_txg;
}
+ if (spa_load_verify_dryrun)
+ return (0);
+
if (error) {
if (error != ENXIO && error != EIO)
error = SET_ERROR(EIO);
@@ -2047,10 +2072,17 @@ spa_prop_find(spa_t *spa, zpool_prop_t prop, uint64_t *val)
* Find a value in the pool directory object.
*/
static int
-spa_dir_prop(spa_t *spa, const char *name, uint64_t *val)
+spa_dir_prop(spa_t *spa, const char *name, uint64_t *val, boolean_t log_enoent)
{
- return (zap_lookup(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
- name, sizeof (uint64_t), 1, val));
+ int error = zap_lookup(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
+ name, sizeof (uint64_t), 1, val);
+
+ if (error != 0 && (error != ENOENT || log_enoent)) {
+ spa_load_failed(spa, "couldn't get '%s' value in MOS directory "
+ "[error=%d]", name, error);
+ }
+
+ return (error);
}
static int
@@ -2144,7 +2176,7 @@ spa_try_repair(spa_t *spa, nvlist_t *config)
static int
spa_load(spa_t *spa, spa_load_state_t state, spa_import_type_t type,
- boolean_t mosconfig)
+ boolean_t trust_config)
{
nvlist_t *config = spa->spa_config;
char *ereport = FM_EREPORT_ZFS_POOL;
@@ -2188,7 +2220,7 @@ spa_load(spa_t *spa, spa_load_state_t state, spa_import_type_t type,
gethrestime(&spa->spa_loaded_ts);
error = spa_load_impl(spa, pool_guid, config, state, type,
- mosconfig, &ereport);
+ trust_config, &ereport);
}
/*
@@ -2240,39 +2272,20 @@ vdev_count_verify_zaps(vdev_t *vd)
return (total);
}
-/*
- * Load an existing storage pool, using the pool's builtin spa_config as a
- * source of configuration information.
- */
static int
-spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
- spa_load_state_t state, spa_import_type_t type, boolean_t trust_config,
- char **ereport)
+spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
+ spa_import_type_t type)
{
int error = 0;
- nvlist_t *nvroot = NULL;
- nvlist_t *label;
- vdev_t *rvd;
- uberblock_t *ub = &spa->spa_uberblock;
- uint64_t children, config_cache_txg = spa->spa_config_txg;
- int orig_mode = spa->spa_mode;
+ nvlist_t *nvtree = NULL;
int parse;
- uint64_t obj;
- boolean_t missing_feat_write = B_FALSE;
-
- /*
- * If this is an untrusted config, access the pool in read-only mode.
- * This prevents things like resilvering recently removed devices.
- */
- if (!trust_config)
- spa->spa_mode = FREAD;
-
- ASSERT(MUTEX_HELD(&spa_namespace_lock));
-
- spa->spa_load_state = state;
+ vdev_t *rvd;
- if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvroot))
+ if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvtree)) {
+ spa_load_failed(spa, "invalid config provided: '%s' missing",
+ ZPOOL_CONFIG_VDEV_TREE);
return (SET_ERROR(EINVAL));
+ }
parse = (type == SPA_IMPORT_EXISTING ?
VDEV_ALLOC_LOAD : VDEV_ALLOC_SPLIT);
@@ -2294,11 +2307,14 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
* configuration requires knowing the version number.
*/
spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
- error = spa_config_parse(spa, &rvd, nvroot, NULL, 0, parse);
+ error = spa_config_parse(spa, &rvd, nvtree, NULL, 0, parse);
spa_config_exit(spa, SCL_ALL, FTAG);
- if (error != 0)
+ if (error != 0) {
+ spa_load_failed(spa, "unable to parse config [error=%d]",
+ error);
return (error);
+ }
ASSERT(spa->spa_root_vdev == rvd);
ASSERT3U(spa->spa_min_ashift, >=, SPA_MINBLOCKSHIFT);
@@ -2308,22 +2324,39 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
ASSERT(spa_guid(spa) == pool_guid);
}
- /*
- * Try to open all vdevs, loading each label in the process.
- */
+ return (0);
+}
+
+static int
+spa_ld_open_vdevs(spa_t *spa)
+{
+ int error = 0;
+
spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
- error = vdev_open(rvd);
+ error = vdev_open(spa->spa_root_vdev);
spa_config_exit(spa, SCL_ALL, FTAG);
- if (error != 0)
- return (error);
+ if (error != 0) {
+ spa_load_failed(spa, "unable to open vdev tree [error=%d]",
+ error);
+ }
+
+ return (error);
+}
+
+static int
+spa_ld_validate_vdevs(spa_t *spa, spa_import_type_t type,
+ boolean_t trust_config)
+{
+ int error = 0;
+ vdev_t *rvd = spa->spa_root_vdev;
/*
* We need to validate the vdev labels against the configuration that
- * we have in hand, which is dependent on the setting of mosconfig. If
- * mosconfig is true then we're validating the vdev labels based on
- * that config. Otherwise, we're validating against the cached config
- * (zpool.cache) that was read when we loaded the zfs module, and then
- * later we will recursively call spa_load() and validate against
+ * we have in hand, which is dependent on the setting of trust_config.
+ * If trust_config is true then we're validating the vdev labels based
+ * on that config. Otherwise, we're validating against the cached
+ * config (zpool.cache) that was read when we loaded the zfs module, and
+ * then later we will recursively call spa_load() and validate against
* the vdev config.
*
* If we're assembling a new pool that's been split off from an
@@ -2335,13 +2368,31 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
error = vdev_validate(rvd, trust_config);
spa_config_exit(spa, SCL_ALL, FTAG);
- if (error != 0)
+ if (error != 0) {
+ spa_load_failed(spa, "vdev_validate failed [error=%d]",
+ error);
return (error);
+ }
- if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN)
+ if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) {
+ spa_load_failed(spa, "cannot open vdev tree after "
+ "invalidating some vdevs");
return (SET_ERROR(ENXIO));
+ }
}
+ return (0);
+}
+
+static int
+spa_ld_select_uberblock(spa_t *spa, nvlist_t *config, spa_import_type_t type,
+ boolean_t trust_config)
+{
+ vdev_t *rvd = spa->spa_root_vdev;
+ nvlist_t *label;
+ uberblock_t *ub = &spa->spa_uberblock;
+ uint64_t children;
+
/*
* Find the best uberblock.
*/
@@ -2352,14 +2403,20 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
*/
if (ub->ub_txg == 0) {
nvlist_free(label);
+ spa_load_failed(spa, "no valid uberblock found");
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, ENXIO));
}
+ spa_load_note(spa, "using uberblock with txg=%llu",
+ (u_longlong_t)ub->ub_txg);
+
/*
* If the pool has an unsupported version we can't open it.
*/
if (!SPA_VERSION_IS_SUPPORTED(ub->ub_version)) {
nvlist_free(label);
+ spa_load_failed(spa, "version %llu is not supported",
+ (u_longlong_t)ub->ub_version);
return (spa_vdev_err(rvd, VDEV_AUX_VERSION_NEWER, ENOTSUP));
}
@@ -2370,9 +2427,17 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
* If we weren't able to find what's necessary for reading the
* MOS in the label, return failure.
*/
- if (label == NULL || nvlist_lookup_nvlist(label,
- ZPOOL_CONFIG_FEATURES_FOR_READ, &features) != 0) {
+ if (label == NULL) {
+ spa_load_failed(spa, "label config unavailable");
+ return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA,
+ ENXIO));
+ }
+
+ if (nvlist_lookup_nvlist(label, ZPOOL_CONFIG_FEATURES_FOR_READ,
+ &features) != 0) {
nvlist_free(label);
+ spa_load_failed(spa, "invalid label: '%s' missing",
+ ZPOOL_CONFIG_FEATURES_FOR_READ);
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA,
ENXIO));
}
@@ -2411,6 +2476,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
VERIFY(nvlist_add_nvlist(spa->spa_load_info,
ZPOOL_CONFIG_UNSUP_FEAT, unsup_feat) == 0);
nvlist_free(unsup_feat);
+ spa_load_failed(spa, "some features are unsupported");
return (spa_vdev_err(rvd, VDEV_AUX_UNSUP_FEAT,
ENOTSUP));
}
@@ -2427,8 +2493,13 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
*/
if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_VDEV_CHILDREN,
&children) != 0 && trust_config && type != SPA_IMPORT_ASSEMBLE &&
- rvd->vdev_guid_sum != ub->ub_guid_sum)
+ rvd->vdev_guid_sum != ub->ub_guid_sum) {
+ spa_load_failed(spa, "guid sum in config doesn't match guid "
+ "sum in uberblock (%llu != %llu)",
+ (u_longlong_t)rvd->vdev_guid_sum,
+ (u_longlong_t)ub->ub_guid_sum);
return (spa_vdev_err(rvd, VDEV_AUX_BAD_GUID_SUM, ENXIO));
+ }
if (type != SPA_IMPORT_ASSEMBLE && spa->spa_config_splitting) {
spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
@@ -2450,19 +2521,33 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
spa->spa_claim_max_txg = spa->spa_first_txg;
spa->spa_prev_software_version = ub->ub_software_version;
- /*
- * Everything that we read before we do spa_remove_init() must
- * have been rewritten after the last device removal was initiated.
- * Otherwise we could be reading from indirect vdevs before
- * we have loaded their mappings.
- */
+ return (0);
+}
+
+static int
+spa_ld_open_rootbp(spa_t *spa)
+{
+ int error = 0;
+ vdev_t *rvd = spa->spa_root_vdev;
error = dsl_pool_init(spa, spa->spa_first_txg, &spa->spa_dsl_pool);
- if (error)
+ if (error != 0) {
+ spa_load_failed(spa, "unable to open rootbp in dsl_pool_init "
+ "[error=%d]", error);
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
+ }
spa->spa_meta_objset = spa->spa_dsl_pool->dp_meta_objset;
- if (spa_dir_prop(spa, DMU_POOL_CONFIG, &spa->spa_config_object) != 0)
+ return (0);
+}
+
+static int
+spa_ld_validate_config(spa_t *spa, spa_import_type_t type)
+{
+ vdev_t *rvd = spa->spa_root_vdev;
+
+ if (spa_dir_prop(spa, DMU_POOL_CONFIG, &spa->spa_config_object, B_TRUE)
+ != 0)
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
/*
@@ -2474,11 +2559,16 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
*/
if (type != SPA_IMPORT_ASSEMBLE) {
nvlist_t *mos_config;
- if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0)
+ if (load_nvlist(spa, spa->spa_config_object, &mos_config)
+ != 0) {
+ spa_load_failed(spa, "unable to retrieve MOS config");
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
+ }
if (!spa_config_valid(spa, mos_config)) {
nvlist_free(mos_config);
+ spa_load_failed(spa, "mismatch between config provided "
+ "and config stored in MOS");
return (spa_vdev_err(rvd, VDEV_AUX_BAD_GUID_SUM,
ENXIO));
}
@@ -2489,33 +2579,67 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
* root vdev. If it can't be opened, it indicates one or
* more toplevel vdevs are faulted.
*/
- if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN)
+ if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) {
+ spa_load_failed(spa, "some top vdevs are unavailable");
return (SET_ERROR(ENXIO));
+ }
}
+ return (0);
+}
+
+static int
+spa_ld_open_indirect_vdev_metadata(spa_t *spa)
+{
+ int error = 0;
+ vdev_t *rvd = spa->spa_root_vdev;
+
/*
* Everything that we read before spa_remove_init() must be stored
* on concreted vdevs. Therefore we do this as early as possible.
*/
- if (spa_remove_init(spa) != 0)
+ error = spa_remove_init(spa);
+ if (error != 0) {
+ spa_load_failed(spa, "spa_remove_init failed [error=%d]",
+ error);
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
+ }
+
+ /*
+ * Retrieve information needed to condense indirect vdev mappings.
+ */
+ error = spa_condense_init(spa);
+ if (error != 0) {
+ spa_load_failed(spa, "spa_condense_init failed [error=%d]",
+ error);
+ return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error));
+ }
+
+ return (0);
+}
+
+static int
+spa_ld_check_features(spa_t *spa, boolean_t *missing_feat_writep)
+{
+ int error = 0;
+ vdev_t *rvd = spa->spa_root_vdev;
if (spa_version(spa) >= SPA_VERSION_FEATURES) {
boolean_t missing_feat_read = B_FALSE;
nvlist_t *unsup_feat, *enabled_feat;
if (spa_dir_prop(spa, DMU_POOL_FEATURES_FOR_READ,
- &spa->spa_feat_for_read_obj) != 0) {
+ &spa->spa_feat_for_read_obj, B_TRUE) != 0) {
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
}
if (spa_dir_prop(spa, DMU_POOL_FEATURES_FOR_WRITE,
- &spa->spa_feat_for_write_obj) != 0) {
+ &spa->spa_feat_for_write_obj, B_TRUE) != 0) {
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
}
if (spa_dir_prop(spa, DMU_POOL_FEATURE_DESCRIPTIONS,
- &spa->spa_feat_desc_obj) != 0) {
+ &spa->spa_feat_desc_obj, B_TRUE) != 0) {
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
}
@@ -2526,10 +2650,11 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
unsup_feat, enabled_feat))
missing_feat_read = B_TRUE;
- if (spa_writeable(spa) || state == SPA_LOAD_TRYIMPORT) {
+ if (spa_writeable(spa) ||
+ spa->spa_load_state == SPA_LOAD_TRYIMPORT) {
if (!spa_features_check(spa, B_TRUE,
unsup_feat, enabled_feat)) {
- missing_feat_write = B_TRUE;
+ *missing_feat_writep = B_TRUE;
}
}
@@ -2568,8 +2693,9 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
* userland in order to know whether to display the
* abovementioned note.
*/
- if (missing_feat_read || (missing_feat_write &&
+ if (missing_feat_read || (*missing_feat_writep &&
spa_writeable(spa))) {
+ spa_load_failed(spa, "pool uses unsupported features");
return (spa_vdev_err(rvd, VDEV_AUX_UNSUP_FEAT,
ENOTSUP));
}
@@ -2589,6 +2715,9 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
spa->spa_feat_refcount_cache[i] =
SPA_FEATURE_DISABLED;
} else {
+ spa_load_failed(spa, "error getting refcount "
+ "for feature %s [error=%d]",
+ spa_feature_table[i].fi_guid, error);
return (spa_vdev_err(rvd,
VDEV_AUX_CORRUPT_DATA, EIO));
}
@@ -2597,65 +2726,92 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
if (spa_feature_is_active(spa, SPA_FEATURE_ENABLED_TXG)) {
if (spa_dir_prop(spa, DMU_POOL_FEATURE_ENABLED_TXG,
- &spa->spa_feat_enabled_txg_obj) != 0)
+ &spa->spa_feat_enabled_txg_obj, B_TRUE) != 0)
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
}
+ return (0);
+}
+
+static int
+spa_ld_load_special_directories(spa_t *spa)
+{
+ int error = 0;
+ vdev_t *rvd = spa->spa_root_vdev;
+
spa->spa_is_initializing = B_TRUE;
error = dsl_pool_open(spa->spa_dsl_pool);
spa->spa_is_initializing = B_FALSE;
- if (error != 0)
+ if (error != 0) {
+ spa_load_failed(spa, "dsl_pool_open failed [error=%d]", error);
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
+ }
- if (!trust_config) {
- uint64_t hostid;
- nvlist_t *policy = NULL;
- nvlist_t *mos_config;
+ return (0);
+}
- if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0)
- return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
+static int
+spa_ld_prepare_for_reload(spa_t *spa, int orig_mode)
+{
+ vdev_t *rvd = spa->spa_root_vdev;
+
+ uint64_t hostid;
+ nvlist_t *policy = NULL;
+ nvlist_t *mos_config;
+
+ if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) {
+ spa_load_failed(spa, "unable to retrieve MOS config");
+ return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
+ }
- if (!spa_is_root(spa) && nvlist_lookup_uint64(mos_config,
- ZPOOL_CONFIG_HOSTID, &hostid) == 0) {
- char *hostname;
- unsigned long myhostid = 0;
+ if (!spa_is_root(spa) && nvlist_lookup_uint64(mos_config,
+ ZPOOL_CONFIG_HOSTID, &hostid) == 0) {
+ char *hostname;
+ unsigned long myhostid = 0;
- VERIFY(nvlist_lookup_string(mos_config,
- ZPOOL_CONFIG_HOSTNAME, &hostname) == 0);
+ VERIFY(nvlist_lookup_string(mos_config,
+ ZPOOL_CONFIG_HOSTNAME, &hostname) == 0);
#ifdef _KERNEL
- myhostid = zone_get_hostid(NULL);
+ myhostid = zone_get_hostid(NULL);
#else /* _KERNEL */
- /*
- * We're emulating the system's hostid in userland, so
- * we can't use zone_get_hostid().
- */
- (void) ddi_strtoul(hw_serial, NULL, 10, &myhostid);
+ /*
+ * We're emulating the system's hostid in userland, so
+ * we can't use zone_get_hostid().
+ */
+ (void) ddi_strtoul(hw_serial, NULL, 10, &myhostid);
#endif /* _KERNEL */
- if (hostid != 0 && myhostid != 0 &&
- hostid != myhostid) {
- nvlist_free(mos_config);
- cmn_err(CE_WARN, "pool '%s' could not be "
- "loaded as it was last accessed by "
- "another system (host: %s hostid: 0x%lx). "
- "See: http://illumos.org/msg/ZFS-8000-EY",
- spa_name(spa), hostname,
- (unsigned long)hostid);
- return (SET_ERROR(EBADF));
- }
+ if (hostid != 0 && myhostid != 0 &&
+ hostid != myhostid) {
+ nvlist_free(mos_config);
+ cmn_err(CE_WARN, "pool '%s' could not be "
+ "loaded as it was last accessed by "
+ "another system (host: %s hostid: 0x%lx). "
+ "See: http://illumos.org/msg/ZFS-8000-EY",
+ spa_name(spa), hostname,
+ (unsigned long)hostid);
+ return (SET_ERROR(EBADF));
}
- if (nvlist_lookup_nvlist(spa->spa_config,
- ZPOOL_REWIND_POLICY, &policy) == 0)
- VERIFY(nvlist_add_nvlist(mos_config,
- ZPOOL_REWIND_POLICY, policy) == 0);
+ }
+ if (nvlist_lookup_nvlist(spa->spa_config,
+ ZPOOL_REWIND_POLICY, &policy) == 0)
+ VERIFY(nvlist_add_nvlist(mos_config,
+ ZPOOL_REWIND_POLICY, policy) == 0);
- spa_config_set(spa, mos_config);
- spa_unload(spa);
- spa_deactivate(spa);
- spa_activate(spa, orig_mode);
+ spa_config_set(spa, mos_config);
+ spa_unload(spa);
+ spa_deactivate(spa);
+ spa_activate(spa, orig_mode);
- return (spa_load(spa, state, SPA_IMPORT_EXISTING, B_TRUE));
- }
+ return (0);
+}
+
+static int
+spa_ld_get_props(spa_t *spa)
+{
+ int error = 0;
+ uint64_t obj;
+ vdev_t *rvd = spa->spa_root_vdev;
/* Grab the secret checksum salt from the MOS. */
error = zap_lookup(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
@@ -2667,26 +2823,31 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
(void) random_get_pseudo_bytes(spa->spa_cksum_salt.zcs_bytes,
sizeof (spa->spa_cksum_salt.zcs_bytes));
} else if (error != 0) {
+ spa_load_failed(spa, "unable to retrieve checksum salt from "
+ "MOS [error=%d]", error);
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
}
- if (spa_dir_prop(spa, DMU_POOL_SYNC_BPOBJ, &obj) != 0)
+ if (spa_dir_prop(spa, DMU_POOL_SYNC_BPOBJ, &obj, B_TRUE) != 0)
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
error = bpobj_open(&spa->spa_deferred_bpobj, spa->spa_meta_objset, obj);
- if (error != 0)
+ if (error != 0) {
+ spa_load_failed(spa, "error opening deferred-frees bpobj "
+ "[error=%d]", error);
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
+ }
/*
* Load the bit that tells us to use the new accounting function
* (raid-z deflation). If we have an older pool, this will not
* be present.
*/
- error = spa_dir_prop(spa, DMU_POOL_DEFLATE, &spa->spa_deflate);
+ error = spa_dir_prop(spa, DMU_POOL_DEFLATE, &spa->spa_deflate, B_FALSE);
if (error != 0 && error != ENOENT)
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
error = spa_dir_prop(spa, DMU_POOL_CREATION_VERSION,
- &spa->spa_creation_version);
+ &spa->spa_creation_version, B_FALSE);
if (error != 0 && error != ENOENT)
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
@@ -2694,12 +2855,13 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
* Load the persistent error log. If we have an older pool, this will
* not be present.
*/
- error = spa_dir_prop(spa, DMU_POOL_ERRLOG_LAST, &spa->spa_errlog_last);
+ error = spa_dir_prop(spa, DMU_POOL_ERRLOG_LAST, &spa->spa_errlog_last,
+ B_FALSE);
if (error != 0 && error != ENOENT)
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
error = spa_dir_prop(spa, DMU_POOL_ERRLOG_SCRUB,
- &spa->spa_errlog_scrub);
+ &spa->spa_errlog_scrub, B_FALSE);
if (error != 0 && error != ENOENT)
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
@@ -2707,7 +2869,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
* Load the history object. If we have an older pool, this
* will not be present.
*/
- error = spa_dir_prop(spa, DMU_POOL_HISTORY, &spa->spa_history);
+ error = spa_dir_prop(spa, DMU_POOL_HISTORY, &spa->spa_history, B_FALSE);
if (error != 0 && error != ENOENT)
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
@@ -2720,11 +2882,13 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
/* The sentinel is only available in the MOS config. */
nvlist_t *mos_config;
- if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0)
+ if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) {
+ spa_load_failed(spa, "unable to retrieve MOS config");
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
+ }
error = spa_dir_prop(spa, DMU_POOL_VDEV_ZAP_MAP,
- &spa->spa_all_vdev_zaps);
+ &spa->spa_all_vdev_zaps, B_FALSE);
if (error == ENOENT) {
VERIFY(!nvlist_exists(mos_config,
@@ -2748,6 +2912,36 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
}
nvlist_free(mos_config);
+ spa->spa_delegation = zpool_prop_default_numeric(ZPOOL_PROP_DELEGATION);
+
+ error = spa_dir_prop(spa, DMU_POOL_PROPS, &spa->spa_pool_props_object,
+ B_FALSE);
+ if (error && error != ENOENT)
+ return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
+
+ if (error == 0) {
+ uint64_t autoreplace;
+
+ spa_prop_find(spa, ZPOOL_PROP_BOOTFS, &spa->spa_bootfs);
+ spa_prop_find(spa, ZPOOL_PROP_AUTOREPLACE, &autoreplace);
+ spa_prop_find(spa, ZPOOL_PROP_DELEGATION, &spa->spa_delegation);
+ spa_prop_find(spa, ZPOOL_PROP_FAILUREMODE, &spa->spa_failmode);
+ spa_prop_find(spa, ZPOOL_PROP_AUTOEXPAND, &spa->spa_autoexpand);
+ spa_prop_find(spa, ZPOOL_PROP_DEDUPDITTO,
+ &spa->spa_dedup_ditto);
+
+ spa->spa_autoreplace = (autoreplace != 0);
+ }
+
+ return (0);
+}
+
+static int
+spa_ld_open_aux_vdevs(spa_t *spa, spa_import_type_t type)
+{
+ int error = 0;
+ vdev_t *rvd = spa->spa_root_vdev;
+
/*
* If we're assembling the pool from the split-off vdevs of
* an existing pool, we don't want to attach the spares & cache
@@ -2757,14 +2951,17 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
/*
* Load any hot spares for this pool.
*/
- error = spa_dir_prop(spa, DMU_POOL_SPARES, &spa->spa_spares.sav_object);
+ error = spa_dir_prop(spa, DMU_POOL_SPARES, &spa->spa_spares.sav_object,
+ B_FALSE);
if (error != 0 && error != ENOENT)
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
if (error == 0 && type != SPA_IMPORT_ASSEMBLE) {
ASSERT(spa_version(spa) >= SPA_VERSION_SPARES);
if (load_nvlist(spa, spa->spa_spares.sav_object,
- &spa->spa_spares.sav_config) != 0)
+ &spa->spa_spares.sav_config) != 0) {
+ spa_load_failed(spa, "error loading spares nvlist");
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
+ }
spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
spa_load_spares(spa);
@@ -2777,14 +2974,16 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
* Load any level 2 ARC devices for this pool.
*/
error = spa_dir_prop(spa, DMU_POOL_L2CACHE,
- &spa->spa_l2cache.sav_object);
+ &spa->spa_l2cache.sav_object, B_FALSE);
if (error != 0 && error != ENOENT)
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
if (error == 0 && type != SPA_IMPORT_ASSEMBLE) {
ASSERT(spa_version(spa) >= SPA_VERSION_L2CACHE);
if (load_nvlist(spa, spa->spa_l2cache.sav_object,
- &spa->spa_l2cache.sav_config) != 0)
+ &spa->spa_l2cache.sav_config) != 0) {
+ spa_load_failed(spa, "error loading l2cache nvlist");
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
+ }
spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
spa_load_l2cache(spa);
@@ -2793,26 +2992,14 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
spa->spa_l2cache.sav_sync = B_TRUE;
}
- spa->spa_delegation = zpool_prop_default_numeric(ZPOOL_PROP_DELEGATION);
-
- error = spa_dir_prop(spa, DMU_POOL_PROPS, &spa->spa_pool_props_object);
- if (error && error != ENOENT)
- return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
-
- if (error == 0) {
- uint64_t autoreplace;
-
- spa_prop_find(spa, ZPOOL_PROP_BOOTFS, &spa->spa_bootfs);
- spa_prop_find(spa, ZPOOL_PROP_AUTOREPLACE, &autoreplace);
- spa_prop_find(spa, ZPOOL_PROP_DELEGATION, &spa->spa_delegation);
- spa_prop_find(spa, ZPOOL_PROP_FAILUREMODE, &spa->spa_failmode);
- spa_prop_find(spa, ZPOOL_PROP_AUTOEXPAND, &spa->spa_autoexpand);
- spa_prop_find(spa, ZPOOL_PROP_BOOTSIZE, &spa->spa_bootsize);
- spa_prop_find(spa, ZPOOL_PROP_DEDUPDITTO,
- &spa->spa_dedup_ditto);
+ return (0);
+}
- spa->spa_autoreplace = (autoreplace != 0);
- }
+static int
+spa_ld_load_vdev_metadata(spa_t *spa)
+{
+ int error = 0;
+ vdev_t *rvd = spa->spa_root_vdev;
/*
* If the 'autoreplace' property is set, then post a resource notifying
@@ -2821,54 +3008,309 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
* unopenable vdevs so that the normal autoreplace handler can take
* over.
*/
- if (spa->spa_autoreplace && state != SPA_LOAD_TRYIMPORT) {
+ if (spa->spa_autoreplace && spa->spa_load_state != SPA_LOAD_TRYIMPORT) {
spa_check_removed(spa->spa_root_vdev);
/*
* For the import case, this is done in spa_import(), because
* at this point we're using the spare definitions from
* the MOS config, not necessarily from the userland config.
*/
- if (state != SPA_LOAD_IMPORT) {
+ if (spa->spa_load_state != SPA_LOAD_IMPORT) {
spa_aux_check_removed(&spa->spa_spares);
spa_aux_check_removed(&spa->spa_l2cache);
}
}
/*
- * Load the vdev state for all toplevel vdevs.
+ * Load the vdev metadata such as metaslabs, DTLs, spacemap object, etc.
*/
error = vdev_load(rvd);
if (error != 0) {
- return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error));
- }
-
- error = spa_condense_init(spa);
- if (error != 0) {
+ spa_load_failed(spa, "vdev_load failed [error=%d]", error);
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, error));
}
/*
- * Propagate the leaf DTLs we just loaded all the way up the tree.
+ * Propagate the leaf DTLs we just loaded all the way up the vdev tree.
*/
spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
vdev_dtl_reassess(rvd, 0, 0, B_FALSE);
spa_config_exit(spa, SCL_ALL, FTAG);
+ return (0);
+}
+
+static int
+spa_ld_load_dedup_tables(spa_t *spa)
+{
+ int error = 0;
+ vdev_t *rvd = spa->spa_root_vdev;
+
+ error = ddt_load(spa);
+ if (error != 0) {
+ spa_load_failed(spa, "ddt_load failed [error=%d]", error);
+ return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
+ }
+
+ return (0);
+}
+
+static int
+spa_ld_verify_logs(spa_t *spa, spa_import_type_t type, char **ereport)
+{
+ vdev_t *rvd = spa->spa_root_vdev;
+
+ if (type != SPA_IMPORT_ASSEMBLE && spa_writeable(spa)) {
+ boolean_t missing = spa_check_logs(spa);
+ if (missing) {
+ *ereport = FM_EREPORT_ZFS_LOG_REPLAY;
+ spa_load_failed(spa, "spa_check_logs failed");
+ return (spa_vdev_err(rvd, VDEV_AUX_BAD_LOG, ENXIO));
+ }
+ }
+
+ return (0);
+}
+
+static int
+spa_ld_verify_pool_data(spa_t *spa)
+{
+ int error = 0;
+ vdev_t *rvd = spa->spa_root_vdev;
+
/*
- * Load the DDTs (dedup tables).
+ * We've successfully opened the pool, verify that we're ready
+ * to start pushing transactions.
*/
- error = ddt_load(spa);
+ if (spa->spa_load_state != SPA_LOAD_TRYIMPORT) {
+ error = spa_load_verify(spa);
+ if (error != 0) {
+ spa_load_failed(spa, "spa_load_verify failed "
+ "[error=%d]", error);
+ return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA,
+ error));
+ }
+ }
+
+ return (0);
+}
+
+static void
+spa_ld_claim_log_blocks(spa_t *spa)
+{
+ dmu_tx_t *tx;
+ dsl_pool_t *dp = spa_get_dsl(spa);
+
+ /*
+ * Claim log blocks that haven't been committed yet.
+ * This must all happen in a single txg.
+ * Note: spa_claim_max_txg is updated by spa_claim_notify(),
+ * invoked from zil_claim_log_block()'s i/o done callback.
+ * Price of rollback is that we abandon the log.
+ */
+ spa->spa_claiming = B_TRUE;
+
+ tx = dmu_tx_create_assigned(dp, spa_first_txg(spa));
+ (void) dmu_objset_find_dp(dp, dp->dp_root_dir_obj,
+ zil_claim, tx, DS_FIND_CHILDREN);
+ dmu_tx_commit(tx);
+
+ spa->spa_claiming = B_FALSE;
+
+ spa_set_log_state(spa, SPA_LOG_GOOD);
+}
+
+static void
+spa_ld_check_for_config_update(spa_t *spa, uint64_t config_cache_txg)
+{
+ vdev_t *rvd = spa->spa_root_vdev;
+ int need_update = B_FALSE;
+
+ /*
+ * If the config cache is stale, or we have uninitialized
+ * metaslabs (see spa_vdev_add()), then update the config.
+ *
+ * If this is a verbatim import, trust the current
+ * in-core spa_config and update the disk labels.
+ */
+ if (config_cache_txg != spa->spa_config_txg ||
+ spa->spa_load_state == SPA_LOAD_IMPORT ||
+ spa->spa_load_state == SPA_LOAD_RECOVER ||
+ (spa->spa_import_flags & ZFS_IMPORT_VERBATIM))
+ need_update = B_TRUE;
+
+ for (int c = 0; c < rvd->vdev_children; c++)
+ if (rvd->vdev_child[c]->vdev_ms_array == 0)
+ need_update = B_TRUE;
+
+ /*
+ * Update the config cache asychronously in case we're the
+ * root pool, in which case the config cache isn't writable yet.
+ */
+ if (need_update)
+ spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE);
+}
+
+/*
+ * Load an existing storage pool, using the config provided. This config
+ * describes which vdevs are part of the pool and is later validated against
+ * partial configs present in each vdev's label and an entire copy of the
+ * config stored in the MOS.
+ */
+static int
+spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
+ spa_load_state_t state, spa_import_type_t type, boolean_t trust_config,
+ char **ereport)
+{
+ int error = 0;
+ uint64_t config_cache_txg = spa->spa_config_txg;
+ int orig_mode = spa->spa_mode;
+ boolean_t missing_feat_write = B_FALSE;
+
+ ASSERT(MUTEX_HELD(&spa_namespace_lock));
+
+ spa->spa_load_state = state;
+ spa_load_note(spa, "LOADING");
+
+ /*
+ * If this is an untrusted config, first access the pool in read-only
+ * mode. We will then retrieve a trusted copy of the config from the MOS
+ * and use it to reopen the pool in read-write mode.
+ */
+ if (!trust_config)
+ spa->spa_mode = FREAD;
+
+ /*
+ * Parse the config provided to create a vdev tree.
+ */
+ error = spa_ld_parse_config(spa, pool_guid, config, type);
if (error != 0)
- return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
+ return (error);
- spa_update_dspace(spa);
+ /*
+ * Now that we have the vdev tree, try to open each vdev. This involves
+ * opening the underlying physical device, retrieving its geometry and
+ * probing the vdev with a dummy I/O. The state of each vdev will be set
+ * based on the success of those operations. After this we'll be ready
+ * to read from the vdevs.
+ */
+ error = spa_ld_open_vdevs(spa);
+ if (error != 0)
+ return (error);
+
+ /*
+ * Read the label of each vdev and make sure that the GUIDs stored
+ * there match the GUIDs in the config provided.
+ */
+ error = spa_ld_validate_vdevs(spa, type, trust_config);
+ if (error != 0)
+ return (error);
- if (type != SPA_IMPORT_ASSEMBLE && spa_writeable(spa) &&
- spa_check_logs(spa)) {
- *ereport = FM_EREPORT_ZFS_LOG_REPLAY;
- return (spa_vdev_err(rvd, VDEV_AUX_BAD_LOG, ENXIO));
+ /*
+ * Read vdev labels to find the best uberblock (i.e. latest, unless
+ * spa_load_max_txg is set) and store it in spa_uberblock. We get the
+ * list of features required to read blkptrs in the MOS from the vdev
+ * label with the best uberblock and verify that our version of zfs
+ * supports them all.
+ */
+ error = spa_ld_select_uberblock(spa, config, type, trust_config);
+ if (error != 0)
+ return (error);
+
+ /*
+ * Pass that uberblock to the dsl_pool layer which will open the root
+ * blkptr. This blkptr points to the latest version of the MOS and will
+ * allow us to read its contents.
+ */
+ error = spa_ld_open_rootbp(spa);
+ if (error != 0)
+ return (error);
+
+ /*
+ * Retrieve the config stored in the MOS and use it to validate the
+ * config provided. Also extract some information from the MOS config
+ * to update our vdev tree.
+ */
+ error = spa_ld_validate_config(spa, type);
+ if (error != 0)
+ return (error);
+
+ /*
+ * Retrieve the mapping of indirect vdevs. Those vdevs were removed
+ * from the pool and their contents were re-mapped to other vdevs. Note
+ * that everything that we read before this step must have been
+ * rewritten on concrete vdevs after the last device removal was
+ * initiated. Otherwise we could be reading from indirect vdevs before
+ * we have loaded their mappings.
+ */
+ error = spa_ld_open_indirect_vdev_metadata(spa);
+ if (error != 0)
+ return (error);
+
+ /*
+ * Retrieve the full list of active features from the MOS and check if
+ * they are all supported.
+ */
+ error = spa_ld_check_features(spa, &missing_feat_write);
+ if (error != 0)
+ return (error);
+
+ /*
+ * Load several special directories from the MOS needed by the dsl_pool
+ * layer.
+ */
+ error = spa_ld_load_special_directories(spa);
+ if (error != 0)
+ return (error);
+
+ /*
+ * If the config provided is not trusted, discard it and use the config
+ * from the MOS to reload the pool.
+ */
+ if (!trust_config) {
+ error = spa_ld_prepare_for_reload(spa, orig_mode);
+ if (error != 0)
+ return (error);
+
+ spa_load_note(spa, "RELOADING");
+ return (spa_load(spa, state, SPA_IMPORT_EXISTING, B_TRUE));
}
+ /*
+ * Retrieve pool properties from the MOS.
+ */
+ error = spa_ld_get_props(spa);
+ if (error != 0)
+ return (error);
+
+ /*
+ * Retrieve the list of auxiliary devices - cache devices and spares -
+ * and open them.
+ */
+ error = spa_ld_open_aux_vdevs(spa, type);
+ if (error != 0)
+ return (error);
+
+ /*
+ * Load the metadata for all vdevs. Also check if unopenable devices
+ * should be autoreplaced.
+ */
+ error = spa_ld_load_vdev_metadata(spa);
+ if (error != 0)
+ return (error);
+
+ error = spa_ld_load_dedup_tables(spa);
+ if (error != 0)
+ return (error);
+
+ /*
+ * Verify the logs now to make sure we don't have any unexpected errors
+ * when we claim log blocks later.
+ */
+ error = spa_ld_verify_logs(spa, type, ereport);
+ if (error != 0)
+ return (error);
+
if (missing_feat_write) {
ASSERT(state == SPA_LOAD_TRYIMPORT);
@@ -2877,24 +3319,34 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
* read-only mode but not read-write mode. We now have enough
* information and can return to userland.
*/
- return (spa_vdev_err(rvd, VDEV_AUX_UNSUP_FEAT, ENOTSUP));
+ return (spa_vdev_err(spa->spa_root_vdev, VDEV_AUX_UNSUP_FEAT,
+ ENOTSUP));
}
/*
- * We've successfully opened the pool, verify that we're ready
- * to start pushing transactions.
+ * Traverse the last txgs to make sure the pool was left off in a safe
+ * state. When performing an extreme rewind, we verify the whole pool,
+ * which can take a very long time.
*/
- if (state != SPA_LOAD_TRYIMPORT) {
- if (error = spa_load_verify(spa))
- return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA,
- error));
- }
+ error = spa_ld_verify_pool_data(spa);
+ if (error != 0)
+ return (error);
+ /*
+ * Calculate the deflated space for the pool. This must be done before
+ * we write anything to the pool because we'd need to update the space
+ * accounting using the deflated sizes.
+ */
+ spa_update_dspace(spa);
+
+ /*
+ * We have now retrieved all the information we needed to open the
+ * pool. If we are importing the pool in read-write mode, a few
+ * additional steps must be performed to finish the import.
+ */
if (spa_writeable(spa) && (state == SPA_LOAD_RECOVER ||
spa->spa_load_max_txg == UINT64_MAX)) {
- dmu_tx_t *tx;
- int need_update = B_FALSE;
- dsl_pool_t *dp = spa_get_dsl(spa);
+ ASSERT(state != SPA_LOAD_TRYIMPORT);
/*
* We must check this before we start the sync thread, because
@@ -2908,25 +3360,14 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
boolean_t condense_in_progress =
(spa->spa_condensing_indirect != NULL);
- ASSERT(state != SPA_LOAD_TRYIMPORT);
-
/*
- * Claim log blocks that haven't been committed yet.
- * This must all happen in a single txg.
- * Note: spa_claim_max_txg is updated by spa_claim_notify(),
- * invoked from zil_claim_log_block()'s i/o done callback.
- * Price of rollback is that we abandon the log.
+ * Traverse the ZIL and claim all blocks.
*/
- spa->spa_claiming = B_TRUE;
-
- tx = dmu_tx_create_assigned(dp, spa_first_txg(spa));
- (void) dmu_objset_find_dp(dp, dp->dp_root_dir_obj,
- zil_claim, tx, DS_FIND_CHILDREN);
- dmu_tx_commit(tx);
+ spa_ld_claim_log_blocks(spa);
- spa->spa_claiming = B_FALSE;
-
- spa_set_log_state(spa, SPA_LOG_GOOD);
+ /*
+ * Kick-off the syncing thread.
+ */
spa->spa_sync_on = B_TRUE;
txg_sync_start(spa->spa_dsl_pool);
@@ -2934,40 +3375,23 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
* Wait for all claims to sync. We sync up to the highest
* claimed log block birth time so that claimed log blocks
* don't appear to be from the future. spa_claim_max_txg
- * will have been set for us by either zil_check_log_chain()
- * (invoked from spa_check_logs()) or zil_claim() above.
+ * will have been set for us by ZIL traversal operations
+ * performed above.
*/
txg_wait_synced(spa->spa_dsl_pool, spa->spa_claim_max_txg);
/*
- * If the config cache is stale, or we have uninitialized
- * metaslabs (see spa_vdev_add()), then update the config.
- *
- * If this is a verbatim import, trust the current
- * in-core spa_config and update the disk labels.
+ * Check if we need to request an update of the config. On the
+ * next sync, we would update the config stored in vdev labels
+ * and the cachefile (by default /etc/zfs/zpool.cache).
*/
- if (config_cache_txg != spa->spa_config_txg ||
- state == SPA_LOAD_IMPORT ||
- state == SPA_LOAD_RECOVER ||
- (spa->spa_import_flags & ZFS_IMPORT_VERBATIM))
- need_update = B_TRUE;
-
- for (int c = 0; c < rvd->vdev_children; c++)
- if (rvd->vdev_child[c]->vdev_ms_array == 0)
- need_update = B_TRUE;
-
- /*
- * Update the config cache asychronously in case we're the
- * root pool, in which case the config cache isn't writable yet.
- */
- if (need_update)
- spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE);
+ spa_ld_check_for_config_update(spa, config_cache_txg);
/*
* Check all DTLs to see if anything needs resilvering.
*/
if (!dsl_scan_resilvering(spa->spa_dsl_pool) &&
- vdev_resilver_needed(rvd, NULL, NULL))
+ vdev_resilver_needed(spa->spa_root_vdev, NULL, NULL))
spa_async_request(spa, SPA_ASYNC_RESILVER);
/*
@@ -2998,11 +3422,13 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
spa_condense_indirect_restart(spa);
}
+ spa_load_note(spa, "LOADED");
+
return (0);
}
static int
-spa_load_retry(spa_t *spa, spa_load_state_t state, int mosconfig)
+spa_load_retry(spa_t *spa, spa_load_state_t state, int trust_config)
{
int mode = spa->spa_mode;
@@ -3014,7 +3440,10 @@ spa_load_retry(spa_t *spa, spa_load_state_t state, int mosconfig)
spa_activate(spa, mode);
spa_async_suspend(spa);
- return (spa_load(spa, state, SPA_IMPORT_EXISTING, mosconfig));
+ spa_load_note(spa, "spa_load_retry: rewind, max txg: %llu",
+ (u_longlong_t)spa->spa_load_max_txg);
+
+ return (spa_load(spa, state, SPA_IMPORT_EXISTING, trust_config));
}
/*
@@ -3025,7 +3454,7 @@ spa_load_retry(spa_t *spa, spa_load_state_t state, int mosconfig)
* spa_load().
*/
static int
-spa_load_best(spa_t *spa, spa_load_state_t state, int mosconfig,
+spa_load_best(spa_t *spa, spa_load_state_t state, int trust_config,
uint64_t max_request, int rewind_flags)
{
nvlist_t *loadinfo = NULL;
@@ -3044,7 +3473,7 @@ spa_load_best(spa_t *spa, spa_load_state_t state, int mosconfig,
}
load_error = rewind_error = spa_load(spa, state, SPA_IMPORT_EXISTING,
- mosconfig);
+ trust_config);
if (load_error == 0)
return (0);
@@ -3085,7 +3514,7 @@ spa_load_best(spa_t *spa, spa_load_state_t state, int mosconfig,
spa->spa_uberblock.ub_txg <= spa->spa_load_max_txg) {
if (spa->spa_load_max_txg < safe_rewind_txg)
spa->spa_extreme_rewind = B_TRUE;
- rewind_error = spa_load_retry(spa, state, mosconfig);
+ rewind_error = spa_load_retry(spa, state, trust_config);
}
spa->spa_extreme_rewind = B_FALSE;
@@ -3165,6 +3594,7 @@ spa_open_common(const char *pool, spa_t **spapp, void *tag, nvlist_t *nvpolicy,
if (state != SPA_LOAD_RECOVER)
spa->spa_last_ubsync_txg = spa->spa_load_txg = 0;
+ zfs_dbgmsg("spa_open_common: opening %s", pool);
error = spa_load_best(spa, state, B_FALSE, policy.zrp_txg,
policy.zrp_request);
@@ -4170,7 +4600,7 @@ spa_import(const char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags)
spa_write_cachefile(spa, B_FALSE, B_TRUE);
spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_IMPORT);
-
+ zfs_dbgmsg("spa_import: verbatim import of %s", pool);
mutex_exit(&spa_namespace_lock);
return (0);
}
@@ -4187,13 +4617,15 @@ spa_import(const char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags)
state = SPA_LOAD_RECOVER;
/*
- * Pass off the heavy lifting to spa_load(). Pass TRUE for mosconfig
+ * Pass off the heavy lifting to spa_load(). Pass TRUE for trust_config
* because the user-supplied config is actually the one to trust when
* doing an import.
*/
if (state != SPA_LOAD_RECOVER)
spa->spa_last_ubsync_txg = spa->spa_load_txg = 0;
+ zfs_dbgmsg("spa_import: importing %s%s", pool,
+ (state == SPA_LOAD_RECOVER) ? " (RECOVERY MODE)" : "");
error = spa_load_best(spa, state, B_TRUE, policy.zrp_txg,
policy.zrp_request);
@@ -4331,9 +4763,11 @@ spa_tryimport(nvlist_t *tryconfig)
spa = spa_add(TRYIMPORT_NAME, tryconfig, NULL);
spa_activate(spa, FREAD);
+ zfs_dbgmsg("spa_tryimport: importing %s", poolname);
+
/*
* Pass off the heavy lifting to spa_load().
- * Pass TRUE for mosconfig because the user-supplied config
+ * Pass TRUE for trust_config because the user-supplied config
* is actually the one to trust when doing an import.
*/
error = spa_load(spa, SPA_LOAD_TRYIMPORT, SPA_IMPORT_EXISTING, B_TRUE);
diff --git a/usr/src/uts/common/fs/zfs/spa_misc.c b/usr/src/uts/common/fs/zfs/spa_misc.c
index b38a52d945..33857db7ac 100644
--- a/usr/src/uts/common/fs/zfs/spa_misc.c
+++ b/usr/src/uts/common/fs/zfs/spa_misc.c
@@ -354,6 +354,34 @@ int spa_asize_inflation = 24;
int spa_slop_shift = 5;
uint64_t spa_min_slop = 128 * 1024 * 1024;
+/*PRINTFLIKE2*/
+void
+spa_load_failed(spa_t *spa, const char *fmt, ...)
+{
+ va_list adx;
+ char buf[256];
+
+ va_start(adx, fmt);
+ (void) vsnprintf(buf, sizeof (buf), fmt, adx);
+ va_end(adx);
+
+ zfs_dbgmsg("spa_load(%s): FAILED: %s", spa->spa_name, buf);
+}
+
+/*PRINTFLIKE2*/
+void
+spa_load_note(spa_t *spa, const char *fmt, ...)
+{
+ va_list adx;
+ char buf[256];
+
+ va_start(adx, fmt);
+ (void) vsnprintf(buf, sizeof (buf), fmt, adx);
+ va_end(adx);
+
+ zfs_dbgmsg("spa_load(%s): %s", spa->spa_name, buf);
+}
+
/*
* ==========================================================================
* SPA config locking
diff --git a/usr/src/uts/common/fs/zfs/sys/spa.h b/usr/src/uts/common/fs/zfs/sys/spa.h
index 8e4d2c5648..aff251b80e 100644
--- a/usr/src/uts/common/fs/zfs/sys/spa.h
+++ b/usr/src/uts/common/fs/zfs/sys/spa.h
@@ -807,6 +807,8 @@ extern objset_t *spa_meta_objset(spa_t *spa);
extern uint64_t spa_deadman_synctime(spa_t *spa);
/* Miscellaneous support routines */
+extern void spa_load_failed(spa_t *spa, const char *fmt, ...);
+extern void spa_load_note(spa_t *spa, const char *fmt, ...);
extern void spa_activate_mos_feature(spa_t *spa, const char *feature,
dmu_tx_t *tx);
extern void spa_deactivate_mos_feature(spa_t *spa, const char *feature);
diff --git a/usr/src/uts/common/fs/zfs/sys/vdev.h b/usr/src/uts/common/fs/zfs/sys/vdev.h
index eff21023bd..1297590eb3 100644
--- a/usr/src/uts/common/fs/zfs/sys/vdev.h
+++ b/usr/src/uts/common/fs/zfs/sys/vdev.h
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
*/
#ifndef _SYS_VDEV_H
@@ -47,6 +47,7 @@ typedef enum vdev_dtl_type {
extern boolean_t zfs_nocacheflush;
+extern void vdev_dbgmsg(vdev_t *vd, const char *fmt, ...);
extern int vdev_open(vdev_t *);
extern void vdev_open_children(vdev_t *);
extern boolean_t vdev_uses_zvols(vdev_t *);
diff --git a/usr/src/uts/common/fs/zfs/vdev.c b/usr/src/uts/common/fs/zfs/vdev.c
index bcc4be447f..656008bf9e 100644
--- a/usr/src/uts/common/fs/zfs/vdev.c
+++ b/usr/src/uts/common/fs/zfs/vdev.c
@@ -77,6 +77,28 @@ int zfs_scrub_limit = 10;
*/
int metaslabs_per_vdev = 200;
+/*PRINTFLIKE2*/
+void
+vdev_dbgmsg(vdev_t *vd, const char *fmt, ...)
+{
+ va_list adx;
+ char buf[256];
+
+ va_start(adx, fmt);
+ (void) vsnprintf(buf, sizeof (buf), fmt, adx);
+ va_end(adx);
+
+ if (vd->vdev_path != NULL) {
+ zfs_dbgmsg("%s vdev '%s': %s", vd->vdev_ops->vdev_op_type,
+ vd->vdev_path, buf);
+ } else {
+ zfs_dbgmsg("%s-%llu vdev (guid %llu): %s",
+ vd->vdev_ops->vdev_op_type,
+ (u_longlong_t)vd->vdev_id,
+ (u_longlong_t)vd->vdev_guid, buf);
+ }
+}
+
/*
* Given a vdev type, return the appropriate ops vector.
*/
@@ -932,14 +954,20 @@ vdev_metaslab_init(vdev_t *vd, uint64_t txg)
error = dmu_read(mos, vd->vdev_ms_array,
m * sizeof (uint64_t), sizeof (uint64_t), &object,
DMU_READ_PREFETCH);
- if (error)
+ if (error != 0) {
+ vdev_dbgmsg(vd, "unable to read the metaslab "
+ "array [error=%d]", error);
return (error);
+ }
}
error = metaslab_init(vd->vdev_mg, m, object, txg,
&(vd->vdev_ms[m]));
- if (error)
+ if (error != 0) {
+ vdev_dbgmsg(vd, "metaslab_init failed [error=%d]",
+ error);
return (error);
+ }
}
if (txg == 0)
@@ -1021,8 +1049,7 @@ vdev_probe_done(zio_t *zio)
zio->io_error = 0;
} else {
ASSERT(zio->io_error != 0);
- zfs_dbgmsg("failed probe on vdev %llu",
- (longlong_t)vd->vdev_id);
+ vdev_dbgmsg(vd, "failed probe");
zfs_ereport_post(FM_EREPORT_ZFS_PROBE_FAILURE,
spa, vd, NULL, 0, 0);
zio->io_error = SET_ERROR(ENXIO);
@@ -1465,6 +1492,7 @@ vdev_validate(vdev_t *vd, boolean_t strict)
if ((label = vdev_label_read_config(vd, txg)) == NULL) {
vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN,
VDEV_AUX_BAD_LABEL);
+ vdev_dbgmsg(vd, "vdev_validate: failed reading config");
return (0);
}
@@ -1477,6 +1505,8 @@ vdev_validate(vdev_t *vd, boolean_t strict)
vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN,
VDEV_AUX_SPLIT_POOL);
nvlist_free(label);
+ vdev_dbgmsg(vd, "vdev_validate: vdev split into other "
+ "pool");
return (0);
}
@@ -1486,6 +1516,10 @@ vdev_validate(vdev_t *vd, boolean_t strict)
vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN,
VDEV_AUX_CORRUPT_DATA);
nvlist_free(label);
+ vdev_dbgmsg(vd, "vdev_validate: vdev label pool_guid "
+ "doesn't match config (%llu != %llu)",
+ (u_longlong_t)guid,
+ (u_longlong_t)spa_guid(spa));
return (0);
}
@@ -1515,6 +1549,9 @@ vdev_validate(vdev_t *vd, boolean_t strict)
vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN,
VDEV_AUX_CORRUPT_DATA);
nvlist_free(label);
+ vdev_dbgmsg(vd, "vdev_validate: config guid doesn't "
+ "match label guid (%llu != %llu)",
+ (u_longlong_t)vd->vdev_guid, (u_longlong_t)guid);
return (0);
}
@@ -1523,6 +1560,8 @@ vdev_validate(vdev_t *vd, boolean_t strict)
vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN,
VDEV_AUX_CORRUPT_DATA);
nvlist_free(label);
+ vdev_dbgmsg(vd, "vdev_validate: '%s' missing",
+ ZPOOL_CONFIG_POOL_STATE);
return (0);
}
@@ -1534,8 +1573,12 @@ vdev_validate(vdev_t *vd, boolean_t strict)
*/
if (!(spa->spa_import_flags & ZFS_IMPORT_VERBATIM) &&
spa_load_state(spa) == SPA_LOAD_OPEN &&
- state != POOL_STATE_ACTIVE)
+ state != POOL_STATE_ACTIVE) {
+ vdev_dbgmsg(vd, "vdev_validate: invalid pool state "
+ "(%llu) for spa %s", (u_longlong_t)state,
+ spa->spa_name);
return (SET_ERROR(EBADF));
+ }
/*
* If we were able to open and validate a vdev that was
@@ -2149,9 +2192,10 @@ vdev_dtl_sync(vdev_t *vd, uint64_t txg)
* the top level so that we update the config.
*/
if (object != space_map_object(vd->vdev_dtl_sm)) {
- zfs_dbgmsg("txg %llu, spa %s, DTL old object %llu, "
- "new object %llu", txg, spa_name(spa), object,
- space_map_object(vd->vdev_dtl_sm));
+ vdev_dbgmsg(vd, "txg %llu, spa %s, DTL old object %llu, "
+ "new object %llu", (u_longlong_t)txg, spa_name(spa),
+ (u_longlong_t)object,
+ (u_longlong_t)space_map_object(vd->vdev_dtl_sm));
vdev_config_dirty(vd->vdev_top);
}
@@ -2259,8 +2303,13 @@ vdev_load(vdev_t *vd)
if (vd->vdev_ashift == 0 || vd->vdev_asize == 0) {
vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN,
VDEV_AUX_CORRUPT_DATA);
+ vdev_dbgmsg(vd, "vdev_load: invalid size. ashift=%llu, "
+ "asize=%llu", (u_longlong_t)vd->vdev_ashift,
+ (u_longlong_t)vd->vdev_asize);
return (SET_ERROR(ENXIO));
} else if ((error = vdev_metaslab_init(vd, 0)) != 0) {
+ vdev_dbgmsg(vd, "vdev_load: metaslab_init failed "
+ "[error=%d]", error);
vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN,
VDEV_AUX_CORRUPT_DATA);
return (error);
@@ -2273,6 +2322,8 @@ vdev_load(vdev_t *vd)
if (vd->vdev_ops->vdev_op_leaf && (error = vdev_dtl_load(vd)) != 0) {
vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN,
VDEV_AUX_CORRUPT_DATA);
+ vdev_dbgmsg(vd, "vdev_load: vdev_dtl_load failed "
+ "[error=%d]", error);
return (error);
}
@@ -2286,6 +2337,9 @@ vdev_load(vdev_t *vd)
obsolete_sm_object, 0, vd->vdev_asize, 0))) {
vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN,
VDEV_AUX_CORRUPT_DATA);
+ vdev_dbgmsg(vd, "vdev_load: space_map_open failed for "
+ "obsolete spacemap (obj %llu) [error=%d]",
+ (u_longlong_t)obsolete_sm_object, error);
return (error);
}
space_map_update(vd->vdev_obsolete_sm);
@@ -3647,9 +3701,9 @@ vdev_deadman(vdev_t *vd)
fio = avl_first(&vq->vq_active_tree);
delta = gethrtime() - fio->io_timestamp;
if (delta > spa_deadman_synctime(spa)) {
- zfs_dbgmsg("SLOW IO: zio timestamp %lluns, "
- "delta %lluns, last io %lluns",
- fio->io_timestamp, delta,
+ vdev_dbgmsg(vd, "SLOW IO: zio timestamp "
+ "%lluns, delta %lluns, last io %lluns",
+ fio->io_timestamp, (u_longlong_t)delta,
vq->vq_io_complete_ts);
fm_panic("I/O to pool '%s' appears to be "
"hung.", spa_name(spa));
diff --git a/usr/src/uts/common/fs/zfs/vdev_disk.c b/usr/src/uts/common/fs/zfs/vdev_disk.c
index 45637fe3fe..b63285d9fa 100644
--- a/usr/src/uts/common/fs/zfs/vdev_disk.c
+++ b/usr/src/uts/common/fs/zfs/vdev_disk.c
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
* Copyright 2016 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
@@ -333,6 +333,8 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
if (ddi_devid_str_decode(vd->vdev_devid, &dvd->vd_devid,
&dvd->vd_minor) != 0) {
vd->vdev_stat.vs_aux = VDEV_AUX_BAD_LABEL;
+ vdev_dbgmsg(vd, "vdev_disk_open: invalid "
+ "vdev_devid '%s'", vd->vdev_devid);
return (SET_ERROR(EINVAL));
}
}
@@ -425,6 +427,8 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
if (error) {
vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;
+ vdev_dbgmsg(vd, "vdev_disk_open: failed to open [error=%d]",
+ error);
return (error);
}
@@ -438,8 +442,8 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
char *vd_devid;
vd_devid = ddi_devid_str_encode(devid, dvd->vd_minor);
- zfs_dbgmsg("vdev %s: update devid from %s, "
- "to %s", vd->vdev_path, vd->vdev_devid, vd_devid);
+ vdev_dbgmsg(vd, "vdev_disk_open: update devid from "
+ "'%s' to '%s'", vd->vdev_devid, vd_devid);
spa_strfree(vd->vdev_devid);
vd->vdev_devid = spa_strdup(vd_devid);
ddi_devid_str_free(vd_devid);
@@ -499,6 +503,7 @@ skip_open:
*/
if (ldi_get_size(dvd->vd_lh, psize) != 0) {
vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;
+ vdev_dbgmsg(vd, "vdev_disk_open: failed to get size");
return (SET_ERROR(EINVAL));
}
diff --git a/usr/src/uts/common/fs/zfs/vdev_label.c b/usr/src/uts/common/fs/zfs/vdev_label.c
index 38c1add1ca..be3b89ee37 100644
--- a/usr/src/uts/common/fs/zfs/vdev_label.c
+++ b/usr/src/uts/common/fs/zfs/vdev_label.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
*/
/*
@@ -1057,8 +1057,15 @@ vdev_uberblock_load(vdev_t *rvd, uberblock_t *ub, nvlist_t **config)
* Search all labels on this vdev to find the configuration that
* matches the txg for our uberblock.
*/
- if (cb.ubl_vd != NULL)
+ if (cb.ubl_vd != NULL) {
+ vdev_dbgmsg(cb.ubl_vd, "best uberblock found for spa %s. "
+ "txg %llu", spa->spa_name, (u_longlong_t)ub->ub_txg);
+
*config = vdev_label_read_config(cb.ubl_vd, ub->ub_txg);
+ if (*config == NULL) {
+ vdev_dbgmsg(cb.ubl_vd, "failed to read label config");
+ }
+ }
spa_config_exit(spa, SCL_ALL, FTAG);
}
diff --git a/usr/src/uts/common/fs/zfs/zfs_acl.c b/usr/src/uts/common/fs/zfs/zfs_acl.c
index 519b4355d5..6c668b0930 100644
--- a/usr/src/uts/common/fs/zfs/zfs_acl.c
+++ b/usr/src/uts/common/fs/zfs/zfs_acl.c
@@ -1188,6 +1188,7 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t *aclp, cred_t *cr, dmu_tx_t *tx)
sa_bulk_attr_t bulk[5];
uint64_t ctime[2];
int count = 0;
+ zfs_acl_phys_t acl_phys;
mode = zp->z_mode;
@@ -1234,7 +1235,6 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t *aclp, cred_t *cr, dmu_tx_t *tx)
} else { /* Painful legacy way */
zfs_acl_node_t *aclnode;
uint64_t off = 0;
- zfs_acl_phys_t acl_phys;
uint64_t aoid;
if ((error = sa_lookup(zp->z_sa_hdl, SA_ZPL_ZNODE_ACL(zfsvfs),
diff --git a/usr/src/uts/i86pc/Makefile.rules b/usr/src/uts/i86pc/Makefile.rules
index 56e55ab1bd..849fadcc14 100644
--- a/usr/src/uts/i86pc/Makefile.rules
+++ b/usr/src/uts/i86pc/Makefile.rules
@@ -224,7 +224,7 @@ DBOOT_MACH_32 = -D_BOOT_TARGET_i386
DBOOT_MACH_64 = -D_BOOT_TARGET_amd64
DBOOT_DEFS = -D_BOOT $(DBOOT_MACH_$(CLASS))
DBOOT_DEFS += -D_MACHDEP -U_KERNEL -D_I32LPx
-DBOOT_FLAGS = $(CCVERBOSE) $(C99MODE) $(CERRWARN) $(CCNOAUTOINLINE)
+DBOOT_FLAGS = $(CCVERBOSE) $(CSTD) $(CERRWARN) $(CCNOAUTOINLINE)
DBOOT_CC_INCL = -I$(SRC)/common -I$(SRC)/common/util $(INCLUDE_PATH)
DBOOT_AS_INCL = $(AS_INC_PATH)
diff --git a/usr/src/uts/i86xpv/Makefile.rules b/usr/src/uts/i86xpv/Makefile.rules
index a7be74569c..df2ff3b3b8 100644
--- a/usr/src/uts/i86xpv/Makefile.rules
+++ b/usr/src/uts/i86xpv/Makefile.rules
@@ -184,7 +184,7 @@ DBOOT_OBJS_DIR= dboot/$(OBJS_DIR)
DBOOT_XARCH_32 = $(i386_XARCH)
DBOOT_XARCH_64 = $(amd64_XARCH)
-DBOOT_CFLAGS = $(DBOOT_XARCH_$(CLASS)) $(C99MODE) $(CERRWARN) \
+DBOOT_CFLAGS = $(DBOOT_XARCH_$(CLASS)) $(CSTD) $(CERRWARN) \
$(CCNOAUTOINLINE) -O
DBOOT_AS_XARCH_32 = $(i386_AS_XARCH)
diff --git a/usr/src/uts/intel/bfe/Makefile b/usr/src/uts/intel/bfe/Makefile
index 89b13ec0be..da2b8f55c5 100644
--- a/usr/src/uts/intel/bfe/Makefile
+++ b/usr/src/uts/intel/bfe/Makefile
@@ -66,7 +66,7 @@ CFGFLAGS = -DGEM_CONFIG_POLLING -DGEM_CONFIG_GLDv3 -DGEM_CONFIG_VLAN \
CPPFLAGS += $(VFLAGS) $(AFLAGS) $(DFLAGS) $(CFGFLAGS) $(CCVERBOSE) \
-I$(UTSBASE)/common/io/bfe
-CFLAGS += $(CPPFLAGS) -xc99=%all
+CFLAGS += $(CPPFLAGS)
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-uninitialized
diff --git a/usr/src/uts/intel/bnxe/Makefile b/usr/src/uts/intel/bnxe/Makefile
index ff44f0d4d8..4b078ae559 100644
--- a/usr/src/uts/intel/bnxe/Makefile
+++ b/usr/src/uts/intel/bnxe/Makefile
@@ -49,7 +49,6 @@ ALL_TARGET = $(BINARY) $(CONFMOD)
LINT_TARGET = $(MODULE).lint
INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
#
diff --git a/usr/src/uts/intel/chxge/Makefile b/usr/src/uts/intel/chxge/Makefile
index 0d1a5010a1..052bd467d2 100644
--- a/usr/src/uts/intel/chxge/Makefile
+++ b/usr/src/uts/intel/chxge/Makefile
@@ -65,8 +65,6 @@ CFLAGS += -DCONFIG_CHELSIO_T1_OFFLOAD
CFLAGS += -DSUN_KSTATS -DHOST_PAUSE -DTX_CKSUM_FIX -DTX_THREAD_RECLAIM
-CFLAGS += -xc99=%all
-
# Debug flags
# CFLAGS += -DCH_DEBUG=1 -DPE_DBGOUT_ENABLED=1
diff --git a/usr/src/uts/intel/cxgbe/cxgbe/Makefile b/usr/src/uts/intel/cxgbe/cxgbe/Makefile
index acb33502c8..19c7d29776 100644
--- a/usr/src/uts/intel/cxgbe/cxgbe/Makefile
+++ b/usr/src/uts/intel/cxgbe/cxgbe/Makefile
@@ -45,7 +45,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
CFLAGS += -g -I$(UTSBASE)/common/io/cxgbe -I$(UTSBASE)/common/io/cxgbe/common \
-I$(UTSBASE)/common/io/cxgbe/t4nex -I$(UTSBASE)/common/io/cxgbe/shared
-CFLAGS += -xc99=%all
#
# Driver depends
diff --git a/usr/src/uts/intel/cxgbe/t4nex/Makefile b/usr/src/uts/intel/cxgbe/t4nex/Makefile
index 6ebef6a7ea..8185b52238 100644
--- a/usr/src/uts/intel/cxgbe/t4nex/Makefile
+++ b/usr/src/uts/intel/cxgbe/t4nex/Makefile
@@ -50,7 +50,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
CFLAGS += -g -I$(UTSBASE)/common/io/cxgbe -I$(UTSBASE)/common/io/cxgbe/common \
-I$(UTSBASE)/common/io/cxgbe/t4nex -I$(UTSBASE)/common/io/cxgbe/shared \
-I$(UTSBASE)/common/io/cxgbe/firmware
-CFLAGS += -xc99=%all
#
# Driver depends
diff --git a/usr/src/uts/intel/dca/Makefile b/usr/src/uts/intel/dca/Makefile
index a1ff33c62a..034e2019c3 100644
--- a/usr/src/uts/intel/dca/Makefile
+++ b/usr/src/uts/intel/dca/Makefile
@@ -58,9 +58,6 @@ ALL_TARGET = $(BINARY) $(SRC_CONFFILE)
LINT_TARGET = $(MODULE).lint
INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOTLINK) $(ROOT_CONFFILE)
-# C99 mode is needed for dca
-CFLAGS += $(C99_ENABLE)
-
#
# For now, disable these lint checks; maintainers should endeavor
# to investigate and remove these for maximum lint coverage.
diff --git a/usr/src/uts/intel/fct/Makefile b/usr/src/uts/intel/fct/Makefile
index 3281db0d10..b61a18873d 100644
--- a/usr/src/uts/intel/fct/Makefile
+++ b/usr/src/uts/intel/fct/Makefile
@@ -60,7 +60,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
#
diff --git a/usr/src/uts/intel/iscsit/Makefile b/usr/src/uts/intel/iscsit/Makefile
index 1d61a81d72..73b9139ec9 100644
--- a/usr/src/uts/intel/iscsit/Makefile
+++ b/usr/src/uts/intel/iscsit/Makefile
@@ -60,7 +60,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf -Nmisc/idm -Nfs/sockfs -Nmisc/md5 -Nmisc/ksocket
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-switch
diff --git a/usr/src/uts/intel/nsmb/Makefile b/usr/src/uts/intel/nsmb/Makefile
index dbe89e1b9d..35be8a8316 100644
--- a/usr/src/uts/intel/nsmb/Makefile
+++ b/usr/src/uts/intel/nsmb/Makefile
@@ -63,7 +63,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
$(MODSTUBS_O) := AS_CPPFLAGS += -DNSMB_MODULE
CLEANFILES += $(MODSTUBS_O) $(IOC_CHECK_H)
-C99MODE = $(C99_ENABLE)
CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
INC_PATH += -I$(UTSBASE)/common/fs/smbclnt
LDFLAGS += -dy -Ncrypto/md4 -Ncrypto/md5 -Nmisc/tlimod
diff --git a/usr/src/uts/intel/pppt/Makefile b/usr/src/uts/intel/pppt/Makefile
index 78f8e8b7f7..f492a4d1b0 100644
--- a/usr/src/uts/intel/pppt/Makefile
+++ b/usr/src/uts/intel/pppt/Makefile
@@ -60,7 +60,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-switch
diff --git a/usr/src/uts/intel/qlge/Makefile b/usr/src/uts/intel/qlge/Makefile
index 3883358dbf..d9951b0d1a 100644
--- a/usr/src/uts/intel/qlge/Makefile
+++ b/usr/src/uts/intel/qlge/Makefile
@@ -61,7 +61,6 @@ INC_PATH += -I$(UTSBASE)/common/sys/fibre-channel/fca/qlge
LDFLAGS += -dy -Nmisc/mac -Ndrv/ip
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-switch
diff --git a/usr/src/uts/intel/qlt/Makefile b/usr/src/uts/intel/qlt/Makefile
index cdbef29ee9..6285b973eb 100644
--- a/usr/src/uts/intel/qlt/Makefile
+++ b/usr/src/uts/intel/qlt/Makefile
@@ -60,7 +60,6 @@ LDFLAGS += -dy -Ndrv/fct -Ndrv/stmf
CFLAGS += -DUNIQUE_FW_NAME
LINTTAGS += -DUNIQUE_FW_NAME
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
#
diff --git a/usr/src/uts/intel/sfe/Makefile b/usr/src/uts/intel/sfe/Makefile
index 9f2ad1e63a..00aaa13a71 100644
--- a/usr/src/uts/intel/sfe/Makefile
+++ b/usr/src/uts/intel/sfe/Makefile
@@ -71,7 +71,7 @@ CFGFLAGS = -DGEM_CONFIG_POLLING -DGEM_CONFIG_GLDv3 -DGEM_CONFIG_VLAN \
CPPFLAGS += $(VFLAGS) $(AFLAGS) $(DFLAGS) $(CFGFLAGS) $(CCVERBOSE) \
-I$(UTSBASE)/common/io/sfe
-CFLAGS += $(CPPFLAGS) -xc99=%all
+CFLAGS += $(CPPFLAGS)
CERRWARN += -_gcc=-Wno-unused-label
CERRWARN += -_gcc=-Wno-switch
diff --git a/usr/src/uts/intel/smbfs/Makefile b/usr/src/uts/intel/smbfs/Makefile
index 49538576b6..6defe60e32 100644
--- a/usr/src/uts/intel/smbfs/Makefile
+++ b/usr/src/uts/intel/smbfs/Makefile
@@ -61,7 +61,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
MODSTUBS_DIR = $(OBJS_DIR)
$(MODSTUBS_O) := AS_CPPFLAGS += -DSMBFS_MODULE
CLEANFILES += $(MODSTUBS_O)
-C99MODE = $(C99_ENABLE)
INC_PATH += -I$(UTSBASE)/common/fs/smbclnt
INC_PATH += -I$(COMMONBASE)/smbclnt
LDFLAGS += -dy -Ndrv/nsmb
diff --git a/usr/src/uts/intel/srpt/Makefile b/usr/src/uts/intel/srpt/Makefile
index 7c83e44453..424e85470e 100644
--- a/usr/src/uts/intel/srpt/Makefile
+++ b/usr/src/uts/intel/srpt/Makefile
@@ -60,7 +60,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf -Nmisc/ibtl -Nmisc/ibcm
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-unused-label
diff --git a/usr/src/uts/intel/stmf/Makefile b/usr/src/uts/intel/stmf/Makefile
index 1e45739dbb..50ec544cbb 100644
--- a/usr/src/uts/intel/stmf/Makefile
+++ b/usr/src/uts/intel/stmf/Makefile
@@ -58,7 +58,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
#
diff --git a/usr/src/uts/intel/stmf_sbd/Makefile b/usr/src/uts/intel/stmf_sbd/Makefile
index ac64b10708..4259f16b69 100644
--- a/usr/src/uts/intel/stmf_sbd/Makefile
+++ b/usr/src/uts/intel/stmf_sbd/Makefile
@@ -61,7 +61,6 @@ LDFLAGS += -dy -Ndrv/stmf -Nfs/zfs
INC_PATH += -I$(UTSBASE)/common/fs/zfs
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
#
diff --git a/usr/src/uts/intel/xge/Makefile b/usr/src/uts/intel/xge/Makefile
index b3836ba90f..7df734d75d 100644
--- a/usr/src/uts/intel/xge/Makefile
+++ b/usr/src/uts/intel/xge/Makefile
@@ -85,8 +85,8 @@ XGE_CFLAGS = $(HAL_CFLAGS) $(TRACE_CFLAGS) $(CCVERBOSE) \
-I$(UTSBASE)/common/io/xge/hal/xgehal \
-I$(UTSBASE)/common/io/xge/drv -DSOLARIS
-CFLAGS += $(XGE_CFLAGS) -xO4 -xcrossfile -xc99=%all
-CFLAGS64 += $(XGE_CFLAGS) -xO4 -xcrossfile -xc99=%all
+CFLAGS += $(XGE_CFLAGS) -xO4 -xcrossfile
+CFLAGS64 += $(XGE_CFLAGS) -xO4 -xcrossfile
#
# Driver depends on MAC & IP
diff --git a/usr/src/uts/intel/zfs/Makefile b/usr/src/uts/intel/zfs/Makefile
index 1d3da0ec8a..a4a2f4a561 100644
--- a/usr/src/uts/intel/zfs/Makefile
+++ b/usr/src/uts/intel/zfs/Makefile
@@ -72,7 +72,6 @@ INC_PATH += -I$(UTSBASE)/common/fs/zfs/lua
INC_PATH += -I$(SRC)/common
INC_PATH += -I$(COMMONBASE)/zfs
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
#
diff --git a/usr/src/uts/intel/zut/Makefile b/usr/src/uts/intel/zut/Makefile
index 7df92bc696..23db5c4405 100644
--- a/usr/src/uts/intel/zut/Makefile
+++ b/usr/src/uts/intel/zut/Makefile
@@ -62,7 +62,6 @@ INC_PATH += -I$(UTSBASE)/common/fs/zut
INC_PATH += -I$(SRC)/common
INC_PATH += -I$(COMMONBASE)/zut
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
#
diff --git a/usr/src/uts/sparc/Makefile.sparc b/usr/src/uts/sparc/Makefile.sparc
index c31fa33c40..4ae8d879d1 100644
--- a/usr/src/uts/sparc/Makefile.sparc
+++ b/usr/src/uts/sparc/Makefile.sparc
@@ -137,7 +137,7 @@ CFLAGS += $(CCMODE)
CFLAGS += $(SPACEFLAG)
CFLAGS += $(CERRWARN)
CFLAGS += $(CTF_FLAGS_$(CLASS))
-CFLAGS += $(C99MODE)
+CFLAGS += $(CSTD)
CFLAGS += $(CCUNBOUND)
CFLAGS += $(CCSTATICSYM)
CFLAGS += $(CC32BITCALLERS)
diff --git a/usr/src/uts/sparc/bnxe/Makefile b/usr/src/uts/sparc/bnxe/Makefile
index d8e2b3ac60..ba59f51fee 100644
--- a/usr/src/uts/sparc/bnxe/Makefile
+++ b/usr/src/uts/sparc/bnxe/Makefile
@@ -49,7 +49,6 @@ ALL_TARGET = $(BINARY) $(CONFMOD)
LINT_TARGET = $(MODULE).lint
INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
#
diff --git a/usr/src/uts/sparc/chxge/Makefile b/usr/src/uts/sparc/chxge/Makefile
index 90c194aa9f..2a19c82e25 100644
--- a/usr/src/uts/sparc/chxge/Makefile
+++ b/usr/src/uts/sparc/chxge/Makefile
@@ -65,8 +65,6 @@ CFLAGS += -DCONFIG_CHELSIO_T1_OFFLOAD
CFLAGS += -DSUN_KSTATS -DHOST_PAUSE -DTX_CKSUM_FIX -DTX_THREAD_RECLAIM
-CFLAGS += -xc99=%all
-
# Debug flags
# CFLAGS += -DCH_DEBUG=1 -DPE_DBGOUT_ENABLED=1
diff --git a/usr/src/uts/sparc/dca/Makefile b/usr/src/uts/sparc/dca/Makefile
index f4420ccd16..1f4c8a7b2e 100644
--- a/usr/src/uts/sparc/dca/Makefile
+++ b/usr/src/uts/sparc/dca/Makefile
@@ -62,7 +62,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOTLINK) $(ROOT_CONFFILE)
# lint pass one enforcement
#
CFLAGS += $(CCVERBOSE)
-CFLAGS += $(C99_ENABLE)
#
# For now, disable these lint checks; maintainers should endeavor
diff --git a/usr/src/uts/sparc/fct/Makefile b/usr/src/uts/sparc/fct/Makefile
index 3281db0d10..b61a18873d 100644
--- a/usr/src/uts/sparc/fct/Makefile
+++ b/usr/src/uts/sparc/fct/Makefile
@@ -60,7 +60,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
#
diff --git a/usr/src/uts/sparc/iscsit/Makefile b/usr/src/uts/sparc/iscsit/Makefile
index 1d61a81d72..73b9139ec9 100644
--- a/usr/src/uts/sparc/iscsit/Makefile
+++ b/usr/src/uts/sparc/iscsit/Makefile
@@ -60,7 +60,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf -Nmisc/idm -Nfs/sockfs -Nmisc/md5 -Nmisc/ksocket
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-switch
diff --git a/usr/src/uts/sparc/nsmb/Makefile b/usr/src/uts/sparc/nsmb/Makefile
index 79515e3de4..7100a34dd9 100644
--- a/usr/src/uts/sparc/nsmb/Makefile
+++ b/usr/src/uts/sparc/nsmb/Makefile
@@ -87,7 +87,6 @@ INSTALL_TARGET_obj64 = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
$(MODSTUBS_O) := AS_CPPFLAGS += -DNSMB_MODULE
CLEANFILES += $(MODSTUBS_O) $(IOC_CHECK_H)
-C99MODE = $(C99_ENABLE)
CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
INC_PATH += -I$(UTSBASE)/common/fs/smbclnt
LDFLAGS += -dy -Ncrypto/md4 -Ncrypto/md5 -Nmisc/tlimod
diff --git a/usr/src/uts/sparc/pppt/Makefile b/usr/src/uts/sparc/pppt/Makefile
index 78f8e8b7f7..f492a4d1b0 100644
--- a/usr/src/uts/sparc/pppt/Makefile
+++ b/usr/src/uts/sparc/pppt/Makefile
@@ -60,7 +60,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-switch
diff --git a/usr/src/uts/sparc/qlge/Makefile b/usr/src/uts/sparc/qlge/Makefile
index 3883358dbf..d9951b0d1a 100644
--- a/usr/src/uts/sparc/qlge/Makefile
+++ b/usr/src/uts/sparc/qlge/Makefile
@@ -61,7 +61,6 @@ INC_PATH += -I$(UTSBASE)/common/sys/fibre-channel/fca/qlge
LDFLAGS += -dy -Nmisc/mac -Ndrv/ip
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-switch
diff --git a/usr/src/uts/sparc/qlt/Makefile b/usr/src/uts/sparc/qlt/Makefile
index 171ba3631d..f145c2e880 100644
--- a/usr/src/uts/sparc/qlt/Makefile
+++ b/usr/src/uts/sparc/qlt/Makefile
@@ -59,7 +59,6 @@ MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/fct -Ndrv/stmf
CFLAGS += -DUNIQUE_FW_NAME
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
#
diff --git a/usr/src/uts/sparc/sfe/Makefile b/usr/src/uts/sparc/sfe/Makefile
index c01fa6ade3..235f9df0b7 100644
--- a/usr/src/uts/sparc/sfe/Makefile
+++ b/usr/src/uts/sparc/sfe/Makefile
@@ -71,7 +71,7 @@ CFGFLAGS = -DGEM_CONFIG_POLLING -DGEM_CONFIG_GLDv3 -DGEM_CONFIG_VLAN \
CPPFLAGS += $(VFLAGS) $(AFLAGS) $(DFLAGS) $(CFGFLAGS) $(CCVERBOSE) \
-I$(UTSBASE)/common/io/sfe
-CFLAGS += $(CPPFLAGS) -xc99=%all
+CFLAGS += $(CPPFLAGS)
CERRWARN += -_gcc=-Wno-unused-label
CERRWARN += -_gcc=-Wno-switch
diff --git a/usr/src/uts/sparc/smbfs/Makefile b/usr/src/uts/sparc/smbfs/Makefile
index 88ad9dd4ef..9525c70171 100644
--- a/usr/src/uts/sparc/smbfs/Makefile
+++ b/usr/src/uts/sparc/smbfs/Makefile
@@ -61,7 +61,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
MODSTUBS_DIR = $(OBJS_DIR)
$(MODSTUBS_O) := AS_CPPFLAGS += -DSMBFS_MODULE
CLEANFILES += $(MODSTUBS_O)
-C99MODE = $(C99_ENABLE)
INC_PATH += -I$(UTSBASE)/common/fs/smbclnt
INC_PATH += -I$(COMMONBASE)/smbclnt
LDFLAGS += -dy -Ndrv/nsmb
diff --git a/usr/src/uts/sparc/srpt/Makefile b/usr/src/uts/sparc/srpt/Makefile
index 7c83e44453..424e85470e 100644
--- a/usr/src/uts/sparc/srpt/Makefile
+++ b/usr/src/uts/sparc/srpt/Makefile
@@ -60,7 +60,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf -Nmisc/ibtl -Nmisc/ibcm
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-unused-label
diff --git a/usr/src/uts/sparc/stmf/Makefile b/usr/src/uts/sparc/stmf/Makefile
index 1e45739dbb..50ec544cbb 100644
--- a/usr/src/uts/sparc/stmf/Makefile
+++ b/usr/src/uts/sparc/stmf/Makefile
@@ -58,7 +58,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
#
diff --git a/usr/src/uts/sparc/stmf_sbd/Makefile b/usr/src/uts/sparc/stmf_sbd/Makefile
index ac64b10708..4259f16b69 100644
--- a/usr/src/uts/sparc/stmf_sbd/Makefile
+++ b/usr/src/uts/sparc/stmf_sbd/Makefile
@@ -61,7 +61,6 @@ LDFLAGS += -dy -Ndrv/stmf -Nfs/zfs
INC_PATH += -I$(UTSBASE)/common/fs/zfs
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
#
diff --git a/usr/src/uts/sparc/xge/Makefile b/usr/src/uts/sparc/xge/Makefile
index d9d3ce531c..422a552783 100644
--- a/usr/src/uts/sparc/xge/Makefile
+++ b/usr/src/uts/sparc/xge/Makefile
@@ -85,8 +85,8 @@ XGE_CFLAGS = $(HAL_CFLAGS) $(TRACE_CFLAGS) $(CCVERBOSE) \
-I$(UTSBASE)/common/io/xge/hal/xgehal \
-I$(UTSBASE)/common/io/xge/drv -DSOLARIS
-CFLAGS += $(XGE_CFLAGS) -xO4 -xcrossfile -xc99=%all
-CFLAGS64 += $(XGE_CFLAGS) -xO4 -xcrossfile -xc99=%all
+CFLAGS += $(XGE_CFLAGS) -xO4 -xcrossfile
+CFLAGS64 += $(XGE_CFLAGS) -xO4 -xcrossfile
#
# Driver depends on MAC & IP
diff --git a/usr/src/uts/sparc/zfs/Makefile b/usr/src/uts/sparc/zfs/Makefile
index f9d5d42165..f32b408306 100644
--- a/usr/src/uts/sparc/zfs/Makefile
+++ b/usr/src/uts/sparc/zfs/Makefile
@@ -75,7 +75,6 @@ INC_PATH += -I$(UTSBASE)/common/fs/zfs/lua
INC_PATH += -I$(SRC)/common
INC_PATH += -I$(COMMONBASE)/zfs
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
#
diff --git a/usr/src/uts/sparc/zut/Makefile b/usr/src/uts/sparc/zut/Makefile
index 7df92bc696..23db5c4405 100644
--- a/usr/src/uts/sparc/zut/Makefile
+++ b/usr/src/uts/sparc/zut/Makefile
@@ -62,7 +62,6 @@ INC_PATH += -I$(UTSBASE)/common/fs/zut
INC_PATH += -I$(SRC)/common
INC_PATH += -I$(COMMONBASE)/zut
-C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
#
diff --git a/usr/src/uts/sun4u/Makefile.sun4u b/usr/src/uts/sun4u/Makefile.sun4u
index a34dbed5de..d2b2b5cba7 100644
--- a/usr/src/uts/sun4u/Makefile.sun4u
+++ b/usr/src/uts/sun4u/Makefile.sun4u
@@ -204,7 +204,7 @@ CFLAGS += $(CCMODE)
CFLAGS += $(SPACEFLAG)
CFLAGS += $(CERRWARN)
CFLAGS += $(CTF_FLAGS_$(CLASS))
-CFLAGS += $(C99MODE)
+CFLAGS += $(CSTD)
CFLAGS += $(CCUNBOUND)
CFLAGS += $(CCNOAUTOINLINE)
CFLAGS += $(CCSTATICSYM)
diff --git a/usr/src/uts/sun4v/Makefile.sun4v b/usr/src/uts/sun4v/Makefile.sun4v
index 14246eb05a..3a1b469d21 100644
--- a/usr/src/uts/sun4v/Makefile.sun4v
+++ b/usr/src/uts/sun4v/Makefile.sun4v
@@ -181,7 +181,7 @@ CFLAGS += $(CCMODE)
CFLAGS += $(SPACEFLAG)
CFLAGS += $(CERRWARN)
CFLAGS += $(CTF_FLAGS_$(CLASS))
-CFLAGS += $(C99MODE)
+CFLAGS += $(CSTD)
CFLAGS += $(CCUNBOUND)
CFLAGS += $(CCNOAUTOINLINE)
CFLAGS += $(CCSTATICSYM)
diff --git a/usr/src/uts/sun4v/vsw/Makefile b/usr/src/uts/sun4v/vsw/Makefile
index 6e093ce7f0..bbc07208ef 100644
--- a/usr/src/uts/sun4v/vsw/Makefile
+++ b/usr/src/uts/sun4v/vsw/Makefile
@@ -75,17 +75,6 @@ CFLAGS += $(CCVERBOSE)
LDFLAGS += -dy -Nmisc/ldc -Nmisc/mac -Nmisc/platsvc
#
-# Re-enable C99 compilation to use stack allocation of variable-sized arrays.
-# According to usr/src/uts/Makefile.uts, C99 is disabled until a problem seen
-# on x86 machines can be fully diagnosed; presumably a sun4v (i.e., SPARC)
-# module should be "safe". Furthermore, only the variable-sized array
-# extension is needed/used.
-#
-# C99 mode also gives us macros such as __func__
-#
-C99MODE = $(99_ENABLE)
-
-#
# For now, disable these lint checks; maintainers should endeavor
# to investigate and remove these for maximum lint coverage.
# Please do not carry these forward to new Makefiles.