From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 07:48:05 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 43F0D1065673; Wed, 18 Jul 2012 07:48:05 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2AA5B8FC0C; Wed, 18 Jul 2012 07:48:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I7m5ew042531; Wed, 18 Jul 2012 07:48:05 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I7m43S042525; Wed, 18 Jul 2012 07:48:04 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207180748.q6I7m43S042525@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 07:48:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238566 - in vendor/opensolaris/dist: . cmd/pyzfs cmd/sgs/include cmd/sgs/messages cmd/sgs/tools/common cmd/stat cmd/stat/common cmd/zdb cmd/zfs cmd/zinject cmd/zlook cmd/zpool cmd/zstr... X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 07:48:05 -0000 Author: mm Date: Wed Jul 18 07:48:04 2012 New Revision: 238566 URL: http://svn.freebsd.org/changeset/base/238566 Log: Update vendor/opensolaris to last OpenSolaris state (13149:b23a4dab3d50) Add ZFS bits to vendor/opensolaris Obtained from: https://hg.openindiana.org/upstream/oracle/onnv-gate Added: vendor/opensolaris/dist/OPENSOLARIS.LICENSE vendor/opensolaris/dist/cmd/pyzfs/ vendor/opensolaris/dist/cmd/pyzfs/pyzfs.py vendor/opensolaris/dist/cmd/stat/ vendor/opensolaris/dist/cmd/stat/common/ vendor/opensolaris/dist/cmd/stat/common/statcommon.h vendor/opensolaris/dist/cmd/stat/common/timestamp.c vendor/opensolaris/dist/cmd/zdb/ vendor/opensolaris/dist/cmd/zdb/zdb.c vendor/opensolaris/dist/cmd/zdb/zdb_il.c vendor/opensolaris/dist/cmd/zfs/ vendor/opensolaris/dist/cmd/zfs/zfs_iter.c vendor/opensolaris/dist/cmd/zfs/zfs_iter.h vendor/opensolaris/dist/cmd/zfs/zfs_main.c vendor/opensolaris/dist/cmd/zfs/zfs_util.h vendor/opensolaris/dist/cmd/zinject/ vendor/opensolaris/dist/cmd/zinject/translate.c vendor/opensolaris/dist/cmd/zinject/zinject.c vendor/opensolaris/dist/cmd/zinject/zinject.h vendor/opensolaris/dist/cmd/zlook/ vendor/opensolaris/dist/cmd/zlook/zlook.c vendor/opensolaris/dist/cmd/zpool/ vendor/opensolaris/dist/cmd/zpool/zpool_iter.c vendor/opensolaris/dist/cmd/zpool/zpool_main.c vendor/opensolaris/dist/cmd/zpool/zpool_util.c vendor/opensolaris/dist/cmd/zpool/zpool_util.h vendor/opensolaris/dist/cmd/zpool/zpool_vdev.c vendor/opensolaris/dist/cmd/zstreamdump/ vendor/opensolaris/dist/cmd/zstreamdump/zstreamdump.c vendor/opensolaris/dist/cmd/ztest/ vendor/opensolaris/dist/cmd/ztest/ztest.c vendor/opensolaris/dist/head/atomic.h vendor/opensolaris/dist/head/libintl.h vendor/opensolaris/dist/head/stdio_ext.h vendor/opensolaris/dist/head/synch.h vendor/opensolaris/dist/head/thread.h vendor/opensolaris/dist/lib/libnvpair/ vendor/opensolaris/dist/lib/libnvpair/libnvpair.c vendor/opensolaris/dist/lib/libnvpair/libnvpair.h vendor/opensolaris/dist/lib/libnvpair/nvpair_alloc_system.c vendor/opensolaris/dist/lib/libuutil/ vendor/opensolaris/dist/lib/libuutil/common/ vendor/opensolaris/dist/lib/libuutil/common/libuutil.h vendor/opensolaris/dist/lib/libuutil/common/libuutil_common.h vendor/opensolaris/dist/lib/libuutil/common/libuutil_impl.h vendor/opensolaris/dist/lib/libuutil/common/uu_alloc.c vendor/opensolaris/dist/lib/libuutil/common/uu_avl.c vendor/opensolaris/dist/lib/libuutil/common/uu_dprintf.c vendor/opensolaris/dist/lib/libuutil/common/uu_ident.c vendor/opensolaris/dist/lib/libuutil/common/uu_list.c vendor/opensolaris/dist/lib/libuutil/common/uu_misc.c vendor/opensolaris/dist/lib/libuutil/common/uu_open.c vendor/opensolaris/dist/lib/libuutil/common/uu_pname.c vendor/opensolaris/dist/lib/libuutil/common/uu_string.c vendor/opensolaris/dist/lib/libuutil/common/uu_strtoint.c vendor/opensolaris/dist/lib/libzfs/ vendor/opensolaris/dist/lib/libzfs/common/ vendor/opensolaris/dist/lib/libzfs/common/libzfs.h vendor/opensolaris/dist/lib/libzfs/common/libzfs_changelist.c vendor/opensolaris/dist/lib/libzfs/common/libzfs_config.c vendor/opensolaris/dist/lib/libzfs/common/libzfs_dataset.c vendor/opensolaris/dist/lib/libzfs/common/libzfs_diff.c vendor/opensolaris/dist/lib/libzfs/common/libzfs_fru.c vendor/opensolaris/dist/lib/libzfs/common/libzfs_graph.c vendor/opensolaris/dist/lib/libzfs/common/libzfs_impl.h vendor/opensolaris/dist/lib/libzfs/common/libzfs_import.c vendor/opensolaris/dist/lib/libzfs/common/libzfs_mount.c vendor/opensolaris/dist/lib/libzfs/common/libzfs_pool.c vendor/opensolaris/dist/lib/libzfs/common/libzfs_sendrecv.c vendor/opensolaris/dist/lib/libzfs/common/libzfs_status.c vendor/opensolaris/dist/lib/libzfs/common/libzfs_util.c vendor/opensolaris/dist/lib/libzpool/ vendor/opensolaris/dist/lib/libzpool/common/ vendor/opensolaris/dist/lib/libzpool/common/kernel.c vendor/opensolaris/dist/lib/libzpool/common/sys/ vendor/opensolaris/dist/lib/libzpool/common/sys/zfs_context.h vendor/opensolaris/dist/lib/libzpool/common/taskq.c vendor/opensolaris/dist/lib/libzpool/common/util.c vendor/opensolaris/dist/lib/pyzfs/ vendor/opensolaris/dist/lib/pyzfs/common/ vendor/opensolaris/dist/lib/pyzfs/common/__init__.py vendor/opensolaris/dist/lib/pyzfs/common/allow.py vendor/opensolaris/dist/lib/pyzfs/common/dataset.py vendor/opensolaris/dist/lib/pyzfs/common/groupspace.py vendor/opensolaris/dist/lib/pyzfs/common/holds.py vendor/opensolaris/dist/lib/pyzfs/common/ioctl.c vendor/opensolaris/dist/lib/pyzfs/common/table.py vendor/opensolaris/dist/lib/pyzfs/common/unallow.py vendor/opensolaris/dist/lib/pyzfs/common/userspace.py vendor/opensolaris/dist/lib/pyzfs/common/util.py Modified: vendor/opensolaris/dist/cmd/sgs/include/alist.h vendor/opensolaris/dist/cmd/sgs/include/debug.h vendor/opensolaris/dist/cmd/sgs/include/sgs.h vendor/opensolaris/dist/cmd/sgs/messages/sgs.ident vendor/opensolaris/dist/cmd/sgs/tools/common/sgsmsg.c vendor/opensolaris/dist/cmd/sgs/tools/common/string_table.c vendor/opensolaris/dist/lib/libdtrace/common/dt_decl.c vendor/opensolaris/dist/lib/libdtrace/common/dt_ident.c vendor/opensolaris/dist/lib/libdtrace/common/dt_parser.c vendor/opensolaris/dist/lib/libdtrace/common/dt_pragma.c vendor/opensolaris/dist/lib/libdtrace/common/dt_string.c vendor/opensolaris/dist/lib/libdtrace/common/dt_string.h vendor/opensolaris/dist/lib/libdtrace/common/dt_subr.c Added: vendor/opensolaris/dist/OPENSOLARIS.LICENSE ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/opensolaris/dist/OPENSOLARIS.LICENSE Wed Jul 18 07:48:04 2012 (r238566) @@ -0,0 +1,384 @@ +Unless otherwise noted, all files in this distribution are released +under the Common Development and Distribution License (CDDL). +Exceptions are noted within the associated source files. + +-------------------------------------------------------------------- + + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE Version 1.0 + +1. Definitions. + + 1.1. "Contributor" means each individual or entity that creates + or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Software, prior Modifications used by a Contributor (if any), + and the Modifications made by that particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or (b) + Modifications, or (c) the combination of files containing + Original Software with files containing Modifications, in + each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form other + than Source Code. + + 1.5. "Initial Developer" means the individual or entity that first + makes Original Software available under this License. + + 1.6. "Larger Work" means a work which combines Covered Software or + portions thereof with code not governed by the terms of this + License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed + herein. + + 1.9. "Modifications" means the Source Code and Executable form of + any of the following: + + A. Any file that results from an addition to, deletion from or + modification of the contents of a file containing Original + Software or previous Modifications; + + B. Any new file that contains any part of the Original + Software or previous Modifications; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and Executable + form of computer software code that is originally released + under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, + process, and apparatus claims, in any patent Licensable by + grantor. + + 1.12. "Source Code" means (a) the common form of computer software + code in which modifications are made and (b) associated + documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms + of, this License. For legal entities, "You" includes any + entity which controls, is controlled by, or is under common + control with You. For purposes of this definition, + "control" means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty + percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the Initial + Developer hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer, to use, + reproduce, modify, display, perform, sublicense and + distribute the Original Software (or portions thereof), + with or without Modifications, and/or as part of a Larger + Work; and + + (b) under Patent Claims infringed by the making, using or + selling of Original Software, to make, have made, use, + practice, sell, and offer for sale, and/or otherwise + dispose of the Original Software (or portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) are + effective on the date Initial Developer first distributes + or otherwise makes the Original Software available to a + third party under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: (1) for code that You delete from the Original + Software, or (2) for infringements caused by: (i) the + modification of the Original Software, or (ii) the + combination of the Original Software with other software + or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor to use, reproduce, + modify, display, perform, sublicense and distribute the + Modifications created by such Contributor (or portions + thereof), either on an unmodified basis, with other + Modifications, as Covered Software and/or as part of a + Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either + alone and/or in combination with its Contributor Version + (or portions of such combination), to make, use, sell, + offer for sale, have made, and/or otherwise dispose of: + (1) Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications made by + that Contributor with its Contributor Version (or portions + of such combination). + + (c) The licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first distributes or + otherwise makes the Modifications available to a third + party. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: (1) for any code that Contributor has deleted + from the Contributor Version; (2) for infringements caused + by: (i) third party modifications of Contributor Version, + or (ii) the combination of Modifications made by that + Contributor with other software (except as part of the + Contributor Version) or other devices; or (3) under Patent + Claims infringed by Covered Software in the absence of + Modifications made by that Contributor. + +3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in Source + Code form and that Source Code form must be distributed only under + the terms of this License. You must include a copy of this + License with every copy of the Source Code form of the Covered + Software You distribute or otherwise make available. You must + inform recipients of any such Covered Software in Executable form + as to how they can obtain such Covered Software in Source Code + form in a reasonable manner on or through a medium customarily + used for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You contribute are + governed by the terms of this License. You represent that You + believe Your Modifications are Your original creation(s) and/or + You have sufficient rights to grant the rights conveyed by this + License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications that + identifies You as the Contributor of the Modification. You may + not remove or alter any copyright, patent or trademark notices + contained within the Covered Software, or any notices of licensing + or any descriptive text giving attribution to any Contributor or + the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered Software in + Source Code form that alters or restricts the applicable version + of this License or the recipients' rights hereunder. You may + choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of + Covered Software. However, you may do so only on Your own behalf, + and not on behalf of the Initial Developer or any Contributor. + You must make it absolutely clear that any such warranty, support, + indemnity or liability obligation is offered by You alone, and You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial Developer or + such Contributor as a result of warranty, support, indemnity or + liability terms You offer. + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered Software + under the terms of this License or under the terms of a license of + Your choice, which may contain terms different from this License, + provided that You are in compliance with the terms of this License + and that the license for the Executable form does not attempt to + limit or alter the recipient's rights in the Source Code form from + the rights set forth in this License. If You distribute the + Covered Software in Executable form under a different license, You + must make it absolutely clear that any terms which differ from + this License are offered by You alone, not by the Initial + Developer or Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of any + such terms You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software with + other code not governed by the terms of this License and + distribute the Larger Work as a single product. In such a case, + You must make sure the requirements of this License are fulfilled + for the Covered Software. + +4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and may + publish revised and/or new versions of this License from time to + time. Each version will be given a distinguishing version number. + Except as provided in Section 4.3, no one other than the license + steward has the right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise make the + Covered Software available under the terms of the version of the + License under which You originally received the Covered Software. + If the Initial Developer includes a notice in the Original + Software prohibiting it from being distributed or otherwise made + available under any subsequent version of the License, You must + distribute and make the Covered Software available under the terms + of the version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to use, + distribute or otherwise make the Covered Software available under + the terms of any subsequent version of the License published by + the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a new + license for Your Original Software, You may create and use a + modified version of this License if You: (a) rename the license + and remove any references to the name of the license steward + (except to note that the license differs from this License); and + (b) otherwise make it clear that the license contains terms which + differ from this License. + +5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY + NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + +6. TERMINATION. + + 6.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to + cure such breach within 30 days of becoming aware of the breach. + Provisions which, by their nature, must remain in effect beyond + the termination of this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or a + Contributor (the Initial Developer or Contributor against whom You + assert such claim is referred to as "Participant") alleging that + the Participant Software (meaning the Contributor Version where + the Participant is a Contributor or the Original Software where + the Participant is the Initial Developer) directly or indirectly + infringes any patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial Developer (if + the Initial Developer is not the Participant) and all Contributors + under Sections 2.1 and/or 2.2 of this License shall, upon 60 days + notice from Participant terminate prospectively and automatically + at the expiration of such 60 day notice period, unless if within + such 60 day period You withdraw Your claim with respect to the + Participant Software against such Participant either unilaterally + or pursuant to a written agreement with Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 above, + all end user licenses that have been validly granted by You or any + distributor hereunder prior to termination (excluding licenses + granted to You by any distributor) shall survive termination. + +7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + +8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 + C.F.R. 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 + (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 + C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all + U.S. Government End Users acquire Covered Software with only those + rights set forth herein. This U.S. Government Rights clause is in + lieu of, and supersedes, any other FAR, DFAR, or other clause or + provision that addresses Government rights in computer software + under this License. + +9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed + by the law of the jurisdiction specified in a notice contained + within the Original Software (except to the extent applicable law, + if any, provides otherwise), excluding such jurisdiction's + conflict-of-law provisions. Any litigation relating to this + License shall be subject to the jurisdiction of the courts located + in the jurisdiction and venue specified in a notice contained + within the Original Software, with the losing party responsible + for costs, including, without limitation, court costs and + reasonable attorneys' fees and expenses. The application of the + United Nations Convention on Contracts for the International Sale + of Goods is expressly excluded. Any law or regulation which + provides that the language of a contract shall be construed + against the drafter shall not apply to this License. You agree + that You alone are responsible for compliance with the United + States export administration regulations (and the export control + laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + +10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + +-------------------------------------------------------------------- + +NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND +DISTRIBUTION LICENSE (CDDL) + +For Covered Software in this distribution, this License shall +be governed by the laws of the State of California (excluding +conflict-of-law provisions). + +Any litigation relating to this License shall be subject to the +jurisdiction of the Federal Courts of the Northern District of +California and the state courts of the State of California, with +venue lying in Santa Clara County, California. Added: vendor/opensolaris/dist/cmd/pyzfs/pyzfs.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/opensolaris/dist/cmd/pyzfs/pyzfs.py Wed Jul 18 07:48:04 2012 (r238566) @@ -0,0 +1,82 @@ +#! /usr/bin/python2.6 -S +# +# CDDL HEADER START +# +# 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] +# +# CDDL HEADER END +# +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. +# + +# Note, we want SIGINT (control-c) to exit the process quietly, to mimic +# the standard behavior of C programs. The best we can do with pure +# Python is to run with -S (to disable "import site"), and start our +# program with a "try" statement. Hopefully nobody hits ^C before our +# try statement is executed. + +try: + import site + import gettext + import zfs.util + import zfs.ioctl + import sys + import errno + import solaris.misc + + """This is the main script for doing zfs subcommands. It doesn't know + what subcommands there are, it just looks for a module zfs. + that implements that subcommand.""" + + try: + _ = gettext.translation("SUNW_OST_OSCMD", "/usr/lib/locale", + fallback=True).gettext + except: + _ = solaris.misc.gettext + + if len(sys.argv) < 2: + sys.exit(_("missing subcommand argument")) + + zfs.ioctl.set_cmdstr(" ".join(["zfs"] + sys.argv[1:])) + + try: + # import zfs. + # subfunc = zfs..do_ + + subcmd = sys.argv[1] + __import__("zfs." + subcmd) + submod = getattr(zfs, subcmd) + subfunc = getattr(submod, "do_" + subcmd) + except (ImportError, AttributeError): + sys.exit(_("invalid subcommand")) + + try: + subfunc() + except zfs.util.ZFSError, e: + print(e) + sys.exit(1) + +except IOError, e: + import errno + import sys + + if e.errno == errno.EPIPE: + sys.exit(1) + raise +except KeyboardInterrupt: + import sys + + sys.exit(1) Modified: vendor/opensolaris/dist/cmd/sgs/include/alist.h ============================================================================== --- vendor/opensolaris/dist/cmd/sgs/include/alist.h Wed Jul 18 07:26:20 2012 (r238565) +++ vendor/opensolaris/dist/cmd/sgs/include/alist.h Wed Jul 18 07:48:04 2012 (r238566) @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Define an Alist, a list maintained as a reallocable array, and a for() loop @@ -32,8 +32,6 @@ #ifndef _ALIST_H #define _ALIST_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -138,6 +136,13 @@ typedef struct { void *apl_data[1]; /* data area: (arrcnt * size) bytes */ } APlist; +#ifdef _SYSCALL32 /* required by librtld_db */ +typedef struct { + Elf32_Word apl_arritems; + Elf32_Word apl_nitems; + Elf32_Addr apl_data[1]; +} APlist32; +#endif /* _SYSCALL32 */ /* * The ALIST_OFF_DATA and APLIST_OFF_DATA macros give the byte offset @@ -224,7 +229,7 @@ typedef struct { * Possible values returned by aplist_test() */ typedef enum { - ALE_ALLOCFAIL = 0, /* Memory allocation error */ + ALE_ALLOCFAIL = 0, /* memory allocation error */ ALE_EXISTS = 1, /* alist entry already exists */ ALE_NOTFND = 2, /* item not found and insert not required */ ALE_CREATE = 3 /* alist entry created */ @@ -244,11 +249,14 @@ typedef enum { ((void *)((_off) + (char *)(_lp))) /* - * # of items currently found in a list. These macros handle the case - * where the list has not been allocated yet. - */ -#define alist_nitems(_lp) (((_lp) == NULL) ? 0 : (_lp)->al_nitems) -#define aplist_nitems(_lp) (((_lp) == NULL) ? 0 : (_lp)->apl_nitems) + * The number of items currently found in a list (nitems), and the total number + * of slots in the current data allocation (arritems). These macros handle the + * case where the list has not been allocated yet. + */ +#define alist_nitems(_lp) (((_lp) == NULL) ? 0 : (_lp)->al_nitems) +#define aplist_nitems(_lp) (((_lp) == NULL) ? 0 : (_lp)->apl_nitems) +#define alist_arritems(_lp) (((_lp) == NULL) ? 0 : (_lp)->al_arritems) +#define aplist_arritems(_lp) (((_lp) == NULL) ? 0 : (_lp)->apl_arritems) extern void *alist_append(Alist **, const void *, size_t, Aliste); Modified: vendor/opensolaris/dist/cmd/sgs/include/debug.h ============================================================================== --- vendor/opensolaris/dist/cmd/sgs/include/debug.h Wed Jul 18 07:26:20 2012 (r238565) +++ vendor/opensolaris/dist/cmd/sgs/include/debug.h Wed Jul 18 07:48:04 2012 (r238566) @@ -20,15 +20,12 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _DEBUG_H #define _DEBUG_H -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Global include file for lddbg debugging. * @@ -45,6 +42,7 @@ * start with the `Elf_' prefix. These latter routines are the only * routines used by the elfdump(1) utility. */ +#include #include #include #include @@ -55,13 +53,12 @@ extern "C" { #endif /* - * Define Dbg_*() interface flags. These flags direct the debugging routine to - * generate different diagnostics, thus the strings themselves are maintained + * Define Dbg_*() interface values. These values direct the debugging routine + * to generate different diagnostics, thus the strings themselves are maintained * in the debugging library. */ #define DBG_SUP_ENVIRON 1 #define DBG_SUP_CMDLINE 2 -#define DBG_SUP_DEFAULT 3 #define DBG_CONF_IGNORE 1 /* configuration processing errors */ #define DBG_CONF_VERSION 2 @@ -87,18 +84,22 @@ extern "C" { #define DBG_DLSYM_SELF 3 #define DBG_DLSYM_PROBE 4 #define DBG_DLSYM_SINGLETON 5 +#define DBG_DLSYM_NUM DBG_DLSYM_SINGLETON + 1 #define DBG_DLCLOSE_NULL 0 #define DBG_DLCLOSE_IGNORE 1 #define DBG_DLCLOSE_RESCAN 2 -#define DBG_WAIT_INIT 1 -#define DBG_WAIT_FINI 2 -#define DBG_WAIT_SYMBOL 3 - #define DBG_SYM_REDUCE_GLOBAL 1 /* reporting global symbols to local */ #define DBG_SYM_REDUCE_RETAIN 2 /* reporting non reduced local syms */ +#define DBG_AUD_CALL 1 /* original call to auditor */ +#define DBG_AUD_RET 2 /* return from auditor diagnostic */ + +#define DBG_AUD_LOCAL 0 /* auditor is local */ +#define DBG_AUD_GLOBAL 1 /* auditor is global */ +#define DBG_AUD_PRELOAD 2 /* auditor is preloaded */ + /* * Group handle operations - passed to Dbg_file_hdl_title(). Indicate why * handle dependencies are being manipulated. @@ -139,12 +140,18 @@ extern "C" { #define DBG_BINFO_REF_PARENT 0x2000 /* reference to PARENT */ #define DBG_BINFO_REF_MSK 0xf000 - -#define DBG_CAP_INITIAL 0 -#define DBG_CAP_IGNORE 1 -#define DBG_CAP_OLD 2 -#define DBG_CAP_NEW 3 -#define DBG_CAP_RESOLVED 4 +/* + * ld.so.1(1) symbol capabilities processing. + */ +#define DBG_CAP_DEFAULT 0 +#define DBG_CAP_USED 1 +#define DBG_CAP_CANDIDATE 2 +#define DBG_CAP_REJECTED 3 +#define DBG_CAP_HW_1 4 +#define DBG_CAP_SF_1 5 +#define DBG_CAP_HW_2 6 +#define DBG_CAP_PLAT 7 +#define DBG_CAP_MACH 8 #define DBG_REL_START 1 #define DBG_REL_FINISH 2 @@ -153,23 +160,53 @@ extern "C" { #define DBG_NL_STD 0 /* newline controllers - standard and */ #define DBG_NL_FRC 2 /* forced. */ -#define DBG_BNDREJ_NODIR 0 /* bind rejected, direct to nodirect */ -#define DBG_BNDREJ_SINGLE 1 /* bind rejected, singleton without */ +#define DBG_BNDREJ_DIRECT 0 /* bind rejected, direct to nodirect */ +#define DBG_BNDREJ_GROUP 1 /* bind rejected, group to nodirect */ +#define DBG_BNDREJ_SINGLE 2 /* bind rejected, singleton without */ /* default search model */ #define DBG_BNDREJ_NUM DBG_BNDREJ_SINGLE /* + * Dbg_state_str() is used to obtain commonly used "state transition" + * strings used in various debugging output. + */ +#define DBG_STATE_ADD 0 /* add */ +#define DBG_STATE_CURRENT 1 /* current */ +#define DBG_STATE_EXCLUDE 2 /* exclude */ +#define DBG_STATE_IGNORED 3 /* ignored */ +#define DBG_STATE_MOD_BEFORE 4 /* modify (before) */ +#define DBG_STATE_MOD_AFTER 5 /* modify (after) */ +#define DBG_STATE_NEW 6 /* new */ +#define DBG_STATE_NEW_IMPLICIT 7 /* new (implicit) */ +#define DBG_STATE_RESET 8 /* reset */ +#define DBG_STATE_ORIGINAL 9 /* original */ +#define DBG_STATE_RESOLVED 10 /* resolved */ + +#define DBG_STATE_NUM 11 +typedef uint_t dbg_state_t; +extern const char *Dbg_state_str(dbg_state_t); + +/* * Define a debug descriptor, and a user macro that inspects the descriptor as * a means of triggering a class of diagnostic output. */ typedef struct { uint_t d_class; /* debugging classes */ - uint_t d_extra; /* extra information for classes */ - APlist *d_list; /* associated strings */ + uint_t d_extra; /* extra public information */ + APlist *d_list; /* accepted link-map list names */ + struct timeval d_totaltime; /* total time since entry - */ + /* gettimeofday(3c) */ + struct timeval d_deltatime; /* delta time since last diagnostic - */ + /* gettimeofday(3c) */ } Dbg_desc; extern Dbg_desc *dbg_desc; +/* + * Macros used to avoid calls to liblddbg unless debugging is enabled. + * liblddbg is lazy loaded --- this prevents it from happening unless + * it will actually be used. + */ #define DBG_ENABLED (dbg_desc->d_class) #define DBG_CALL(func) if (DBG_ENABLED) func @@ -180,26 +217,51 @@ extern Dbg_desc *dbg_desc; * may be interpreted by the debugging library itself or from the callers * dbg_print() routine. */ -#define DBG_E_DETAIL 0x0001 /* add detail to a class */ -#define DBG_E_LONG 0x0002 /* use long names (ie. no truncation) */ - -#define DBG_E_STDNL 0x0010 /* standard newline indicator */ +#define DBG_E_DETAIL 0x00000001 /* add detail to a class */ +#define DBG_E_LONG 0x00000002 /* use long names (ie. no truncation) */ +#define DBG_E_DEMANGLE 0x00000004 /* demangle symbol names */ +#define DBG_E_STDNL 0x00000008 /* standard newline indicator */ +#define DBG_E_HELP 0x00000010 /* help requested */ +#define DBG_E_HELP_EXIT 0x00000020 /* hint: user should exit after help */ +#define DBG_E_TTIME 0x00000040 /* prepend total time */ +#define DBG_E_DTIME 0x00000080 /* prepend delta time */ +#define DBG_E_RESET 0x00000100 /* reset times */ + +/* ld only */ +#define DBG_E_SNAME 0x00001000 /* prepend simple name */ +#define DBG_E_FNAME 0x00002000 /* prepend full name */ +#define DBG_E_CLASS 0x00004000 /* prepend ELF class */ + +/* ld.so.1 only */ +#define DBG_E_LMID 0x00100000 /* prepend link-map id */ +#define DBG_E_LMID_LDSO 0x00200000 /* show ldso link-map list */ +#define DBG_E_LMID_ALL 0x00400000 /* show all non-ldso link-map lists */ +#define DBG_E_LMID_ALT 0x00800000 /* show all ALT link-map lists */ +#define DBG_E_LMID_BASE 0x01000000 /* show BASE link-map list */ -#define DBG_E_SNAME 0x0100 /* prepend simple name (ld only) */ -#define DBG_E_FNAME 0x0200 /* prepend full name (ld only) */ -#define DBG_E_CLASS 0x0400 /* prepend ELF class (ld only) */ -#define DBG_E_LMID 0x0800 /* prepend link-map id (ld.so.1 only) */ -#define DBG_E_DEMANGLE 0x1000 /* demangle symbol names */ #define DBG_NOTDETAIL() !(dbg_desc->d_extra & DBG_E_DETAIL) #define DBG_NOTLONG() !(dbg_desc->d_extra & DBG_E_LONG) +#define DBG_ISDEMANGLE() \ + (dbg_desc->d_extra & DBG_E_DEMANGLE) + +#define DBG_TOTALTIME (dbg_desc->d_totaltime) +#define DBG_DELTATIME (dbg_desc->d_deltatime) + +#define DBG_ISTTIME() (dbg_desc->d_extra & DBG_E_TTIME) +#define DBG_ISDTIME() (dbg_desc->d_extra & DBG_E_DTIME) +#define DBG_ISTIME() (dbg_desc->d_extra & (DBG_E_TTIME | DBG_E_DTIME)) +#define DBG_NOTTIME() !(dbg_desc->d_extra & (DBG_E_TTIME | DBG_E_DTIME)) + +#define DBG_ISRESET() (dbg_desc->d_extra & DBG_E_RESET) +#define DBG_ONRESET() (dbg_desc->d_extra |= DBG_E_RESET) +#define DBG_OFFRESET() (dbg_desc->d_extra &= ~DBG_E_RESET) + #define DBG_ISSNAME() (dbg_desc->d_extra & DBG_E_SNAME) #define DBG_ISFNAME() (dbg_desc->d_extra & DBG_E_FNAME) #define DBG_ISCLASS() (dbg_desc->d_extra & DBG_E_CLASS) #define DBG_ISLMID() (dbg_desc->d_extra & DBG_E_LMID) -#define DBG_ISDEMANGLE() \ - (dbg_desc->d_extra & DBG_E_DEMANGLE) /* * Print routine, this must be supplied by the application. The initial @@ -209,7 +271,19 @@ extern Dbg_desc *dbg_desc; /* PRINTFLIKE2 */ extern void dbg_print(Lm_list *, const char *, ...); -extern uintptr_t Dbg_setup(const char *, Dbg_desc *); +/* + * Initialization routine, called before any other Dbg routines to + * establish the necessary state. + */ +typedef enum { DBG_CALLER_LD, DBG_CALLER_RTLD } dbg_setup_caller_t; +extern int Dbg_setup(dbg_setup_caller_t, const char *, + Dbg_desc *, const char **); + +/* Call dbg_print() to produce linker version output */ +extern void Dbg_version(void); + +/* Call dbg_print() to produce help output */ +extern void Dbg_help(void); /* * Establish ELF32 and ELF64 class Dbg_*() interfaces. @@ -225,12 +299,28 @@ extern uintptr_t Dbg_setup(const char *, #define Dbg_bind_reject Dbg64_bind_reject #define Dbg_bind_weak Dbg64_bind_weak -#define Dbg_cap_val_hw1 Dbg64_cap_val_hw1 -#define Dbg_cap_hw_candidate Dbg64_cap_hw_candidate -#define Dbg_cap_hw_filter Dbg64_cap_hw_filter -#define Dbg_cap_mapfile Dbg64_cap_mapfile -#define Dbg_cap_sec_entry Dbg64_cap_sec_entry +#define Dbg_cap_candidate Dbg64_cap_candidate +#define Dbg_cap_filter Dbg64_cap_filter +#define Dbg_cap_id Dbg64_cap_id +#define Dbg_cap_identical Dbg64_cap_identical +#define Dbg_cap_mapfile_title Dbg64_cap_mapfile_title +#define Dbg_cap_post_title Dbg64_cap_post_title #define Dbg_cap_sec_title Dbg64_cap_sec_title +#define Dbg_cap_val Dbg64_cap_val +#define Dbg_cap_ptr_entry Dbg64_cap_ptr_entry +#define Dbg_cap_val_entry Dbg64_cap_val_entry + +#define Dbg_dl_dladdr Dbg64_dl_dladdr +#define Dbg_dl_dlclose Dbg64_dl_dlclose +#define Dbg_dl_dldump Dbg64_dl_dldump +#define Dbg_dl_dlerror Dbg64_dl_dlerror +#define Dbg_dl_dlinfo Dbg64_dl_dlinfo +#define Dbg_dl_dlopen Dbg64_dl_dlopen +#define Dbg_dl_dlsym Dbg64_dl_dlsym +#define Dbg_dl_iphdr_enter Dbg64_dl_iphdr_enter +#define Dbg_dl_iphdr_callback Dbg64_dl_iphdr_callback +#define Dbg_dl_iphdr_mapchange Dbg64_dl_iphdr_mapchange +#define Dbg_dl_iphdr_unmap_ret Dbg64_dl_iphdr_unmap_ret #define Dbg_ent_entry Dbg64_ent_entry #define Dbg_ent_print Dbg64_ent_print @@ -241,15 +331,14 @@ extern uintptr_t Dbg_setup(const char *, #define Dbg_file_ar_rescan Dbg64_file_ar_rescan #define Dbg_file_bind_entry Dbg64_file_bind_entry #define Dbg_file_bindings Dbg64_file_bindings +#define Dbg_file_bindings_done Dbg64_file_bindings_done #define Dbg_file_cleanup Dbg64_file_cleanup #define Dbg_file_cntl Dbg64_file_cntl #define Dbg_file_config_dis Dbg64_file_config_dis #define Dbg_file_config_obj Dbg64_file_config_obj #define Dbg_file_del_rescan Dbg64_file_del_rescan #define Dbg_file_delete Dbg64_file_delete -#define Dbg_file_dlclose Dbg64_file_dlclose -#define Dbg_file_dldump Dbg64_file_dldump -#define Dbg_file_dlopen Dbg64_file_dlopen +#define Dbg_file_deferred Dbg64_file_deferred #define Dbg_file_elf Dbg64_file_elf #define Dbg_file_filtee Dbg64_file_filtee #define Dbg_file_filter Dbg64_file_filter @@ -260,6 +349,7 @@ extern uintptr_t Dbg_setup(const char *, #define Dbg_file_hdl_title Dbg64_file_hdl_title #define Dbg_file_lazyload Dbg64_file_lazyload #define Dbg_file_ldso Dbg64_file_ldso +#define Dbg_file_mmapobj Dbg64_file_mmapobj #define Dbg_file_mode_promote Dbg64_file_mode_promote #define Dbg_file_modified Dbg64_file_modified #define Dbg_file_needed Dbg64_file_needed @@ -275,7 +365,7 @@ extern uintptr_t Dbg_setup(const char *, #define Dbg_libs_audit Dbg64_libs_audit #define Dbg_libs_find Dbg64_libs_find #define Dbg_libs_found Dbg64_libs_found -#define Dbg_libs_ignore Dbg64_libs_ignore +#define Dbg_libs_insecure Dbg64_libs_insecure #define Dbg_libs_init Dbg64_libs_init #define Dbg_libs_l Dbg64_libs_l #define Dbg_libs_path Dbg64_libs_path @@ -284,22 +374,28 @@ extern uintptr_t Dbg_setup(const char *, #define Dbg_libs_yp Dbg64_libs_yp #define Dbg_libs_ylu Dbg64_libs_ylu -#define Dbg_map_dash Dbg64_map_dash +#define Dbg_map_cexp_id Dbg64_map_cexp_id +#define Dbg_map_dv Dbg64_map_dv +#define Dbg_map_dv_entry Dbg64_map_dv_entry #define Dbg_map_ent Dbg64_map_ent +#define Dbg_map_ent_ord_title Dbg64_map_ent_ord_title +#define Dbg_map_hdr_noalloc Dbg64_map_hdr_noalloc #define Dbg_map_parse Dbg64_map_parse -#define Dbg_map_pipe Dbg64_map_pipe +#define Dbg_map_pass Dbg64_map_pass +#define Dbg_map_post_title Dbg64_map_post_title #define Dbg_map_seg Dbg64_map_seg -#define Dbg_map_set_atsign Dbg64_map_set_atsign -#define Dbg_map_set_equal Dbg64_map_set_equal +#define Dbg_map_seg_order Dbg64_map_seg_order +#define Dbg_map_seg_os_order Dbg64_map_seg_os_order #define Dbg_map_size_new Dbg64_map_size_new #define Dbg_map_size_old Dbg64_map_size_old -#define Dbg_map_sort_fini Dbg64_map_sort_fini -#define Dbg_map_sort_orig Dbg64_map_sort_orig +#define Dbg_map_sort_seg Dbg64_map_sort_seg +#define Dbg_map_sort_title Dbg64_map_sort_title #define Dbg_map_symbol Dbg64_map_symbol #define Dbg_map_version Dbg64_map_version #define Dbg_move_adjexpandreloc Dbg64_move_adjexpandreloc #define Dbg_move_adjmovereloc Dbg64_move_adjmovereloc +#define Dbg_move_bad Dbg64_move_bad #define Dbg_move_data Dbg64_move_data #define Dbg_move_entry1 Dbg64_move_entry1 #define Dbg_move_entry2 Dbg64_move_entry2 @@ -329,13 +425,16 @@ extern uintptr_t Dbg_setup(const char *, #define Dbg_reloc_sloppycomdat Dbg64_reloc_sloppycomdat #define Dbg_sec_added Dbg64_sec_added +#define Dbg_sec_backing Dbg64_sec_backing #define Dbg_sec_created Dbg64_sec_created #define Dbg_sec_discarded Dbg64_sec_discarded #define Dbg_sec_genstr_compress Dbg64_sec_genstr_compress #define Dbg_sec_group Dbg64_sec_group +#define Dbg_sec_gnu_comdat Dbg64_sec_gnu_comdat #define Dbg_sec_in Dbg64_sec_in #define Dbg_sec_order_error Dbg64_sec_order_error #define Dbg_sec_order_list Dbg64_sec_order_list +#define Dbg_sec_redirected Dbg64_sec_redirected #define Dbg_sec_strtab Dbg64_sec_strtab #define Dbg_sec_unsup_strmerge Dbg64_sec_unsup_strmerge @@ -353,17 +452,24 @@ extern uintptr_t Dbg_setup(const char *, #define Dbg_support_action Dbg64_support_action #define Dbg_support_load Dbg64_support_load #define Dbg_support_req Dbg64_support_req +#define Dbg_support_vnone Dbg64_support_vnone #define Dbg_syminfo_entry Dbg64_syminfo_entry #define Dbg_syminfo_title Dbg64_syminfo_title #define Dbg_syms_ar_checking Dbg64_syms_ar_checking -#define Dbg_syms_ar_entry Dbg64_syms_ar_entry +#define Dbg_syms_ar_force Dbg64_syms_ar_force #define Dbg_syms_ar_resolve Dbg64_syms_ar_resolve +#define Dbg_syms_ar_skip Dbg64_syms_ar_skip #define Dbg_syms_ar_title Dbg64_syms_ar_title +#define Dbg_syms_cap_convert Dbg64_syms_cap_convert +#define Dbg_syms_cap_local Dbg64_syms_cap_local +#define Dbg_syms_cap_lookup Dbg64_syms_cap_lookup +#define Dbg_syms_cap_title Dbg64_syms_cap_title +#define Dbg_syms_copy_reloc Dbg64_syms_copy_reloc #define Dbg_syms_created Dbg64_syms_created #define Dbg_syms_discarded Dbg64_syms_discarded -#define Dbg_syms_dlsym Dbg64_syms_dlsym +#define Dbg_syms_dup_discarded Dbg64_syms_dup_discarded #define Dbg_syms_dup_sort_addr Dbg64_syms_dup_sort_addr #define Dbg_syms_entered Dbg64_syms_entered #define Dbg_syms_entry Dbg64_syms_entry @@ -376,7 +482,6 @@ extern uintptr_t Dbg_setup(const char *, #define Dbg_syms_old Dbg64_syms_old #define Dbg_syms_process Dbg64_syms_process #define Dbg_syms_reduce Dbg64_syms_reduce -#define Dbg_syms_reloc Dbg64_syms_reloc #define Dbg_syms_resolved Dbg64_syms_resolved #define Dbg_syms_resolving Dbg64_syms_resolving #define Dbg_syms_sec_entry Dbg64_syms_sec_entry @@ -384,8 +489,8 @@ extern uintptr_t Dbg_setup(const char *, #define Dbg_syms_spec_title Dbg64_syms_spec_title #define Dbg_syms_updated Dbg64_syms_updated #define Dbg_syms_up_title Dbg64_syms_up_title +#define Dbg_syms_wrap Dbg64_syms_wrap -#define Dbg_util_broadcast Dbg64_util_broadcast #define Dbg_util_call_array Dbg64_util_call_array #define Dbg_util_call_fini Dbg64_util_call_fini #define Dbg_util_call_init Dbg64_util_call_init @@ -401,7 +506,6 @@ extern uintptr_t Dbg_setup(const char *, #define Dbg_util_scc_entry Dbg64_util_scc_entry #define Dbg_util_scc_title Dbg64_util_scc_title #define Dbg_util_str Dbg64_util_str -#define Dbg_util_wait Dbg64_util_wait #define Dbg_unused_file Dbg64_unused_file #define Dbg_unused_lcinterface Dbg64_unused_lcinterface @@ -413,6 +517,7 @@ extern uintptr_t Dbg_setup(const char *, #define Dbg_ver_avail_title Dbg64_ver_avail_title #define Dbg_ver_def_title Dbg64_ver_def_title #define Dbg_ver_desc_entry Dbg64_ver_desc_entry +#define Dbg_ver_need_done Dbg64_ver_need_done #define Dbg_ver_need_entry Dbg64_ver_need_entry #define Dbg_ver_need_title Dbg64_ver_need_title #define Dbg_ver_nointerface Dbg64_ver_nointerface @@ -427,12 +532,28 @@ extern uintptr_t Dbg_setup(const char *, #define Dbg_bind_reject Dbg32_bind_reject #define Dbg_bind_weak Dbg32_bind_weak -#define Dbg_cap_val_hw1 Dbg32_cap_val_hw1 -#define Dbg_cap_hw_candidate Dbg32_cap_hw_candidate -#define Dbg_cap_hw_filter Dbg32_cap_hw_filter -#define Dbg_cap_mapfile Dbg32_cap_mapfile -#define Dbg_cap_sec_entry Dbg32_cap_sec_entry +#define Dbg_cap_candidate Dbg32_cap_candidate +#define Dbg_cap_filter Dbg32_cap_filter +#define Dbg_cap_id Dbg32_cap_id +#define Dbg_cap_identical Dbg32_cap_identical +#define Dbg_cap_mapfile_title Dbg32_cap_mapfile_title +#define Dbg_cap_post_title Dbg32_cap_post_title #define Dbg_cap_sec_title Dbg32_cap_sec_title +#define Dbg_cap_val Dbg32_cap_val +#define Dbg_cap_ptr_entry Dbg32_cap_ptr_entry +#define Dbg_cap_val_entry Dbg32_cap_val_entry + +#define Dbg_dl_dladdr Dbg32_dl_dladdr +#define Dbg_dl_dlclose Dbg32_dl_dlclose +#define Dbg_dl_dldump Dbg32_dl_dldump +#define Dbg_dl_dlerror Dbg32_dl_dlerror +#define Dbg_dl_dlinfo Dbg32_dl_dlinfo +#define Dbg_dl_dlopen Dbg32_dl_dlopen +#define Dbg_dl_dlsym Dbg32_dl_dlsym +#define Dbg_dl_iphdr_enter Dbg32_dl_iphdr_enter +#define Dbg_dl_iphdr_callback Dbg32_dl_iphdr_callback +#define Dbg_dl_iphdr_mapchange Dbg32_dl_iphdr_mapchange +#define Dbg_dl_iphdr_unmap_ret Dbg32_dl_iphdr_unmap_ret #define Dbg_ent_entry Dbg32_ent_entry #define Dbg_ent_print Dbg32_ent_print @@ -443,15 +564,14 @@ extern uintptr_t Dbg_setup(const char *, #define Dbg_file_ar_rescan Dbg32_file_ar_rescan #define Dbg_file_bind_entry Dbg32_file_bind_entry #define Dbg_file_bindings Dbg32_file_bindings +#define Dbg_file_bindings_done Dbg32_file_bindings_done #define Dbg_file_cleanup Dbg32_file_cleanup #define Dbg_file_cntl Dbg32_file_cntl #define Dbg_file_config_dis Dbg32_file_config_dis #define Dbg_file_config_obj Dbg32_file_config_obj #define Dbg_file_del_rescan Dbg32_file_del_rescan #define Dbg_file_delete Dbg32_file_delete -#define Dbg_file_dlclose Dbg32_file_dlclose *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 08:12:05 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6A2581065670; Wed, 18 Jul 2012 08:12:05 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 501CF8FC0A; Wed, 18 Jul 2012 08:12:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I8C5pG044228; Wed, 18 Jul 2012 08:12:05 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I8C5vK044224; Wed, 18 Jul 2012 08:12:05 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207180812.q6I8C5vK044224@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 08:12:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238567 - in vendor-sys/opensolaris/dist: . common common/acl common/atomic common/atomic/amd64 common/atomic/i386 common/atomic/sparc common/avl common/list common/nvpair common/unicod... X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 08:12:05 -0000 Author: mm Date: Wed Jul 18 08:12:04 2012 New Revision: 238567 URL: http://svn.freebsd.org/changeset/base/238567 Log: Update vendor-sys/opensolaris to last OpenSolaris state (13149:b23a4dab3d50) Add ZFS bits to vendor-sys/opensolaris Obtained from: https://hg.openindiana.org/upstream/oracle/onnv-gate Added: vendor-sys/opensolaris/dist/OPENSOLARIS.LICENSE vendor-sys/opensolaris/dist/common/ vendor-sys/opensolaris/dist/common/acl/ vendor-sys/opensolaris/dist/common/acl/acl_common.c vendor-sys/opensolaris/dist/common/acl/acl_common.h vendor-sys/opensolaris/dist/common/atomic/ vendor-sys/opensolaris/dist/common/atomic/amd64/ vendor-sys/opensolaris/dist/common/atomic/amd64/atomic.s vendor-sys/opensolaris/dist/common/atomic/i386/ vendor-sys/opensolaris/dist/common/atomic/i386/atomic.s vendor-sys/opensolaris/dist/common/atomic/sparc/ vendor-sys/opensolaris/dist/common/atomic/sparc/atomic.s vendor-sys/opensolaris/dist/common/avl/ vendor-sys/opensolaris/dist/common/avl/avl.c vendor-sys/opensolaris/dist/common/list/ vendor-sys/opensolaris/dist/common/list/list.c vendor-sys/opensolaris/dist/common/nvpair/ vendor-sys/opensolaris/dist/common/nvpair/nvpair.c vendor-sys/opensolaris/dist/common/nvpair/nvpair_alloc_fixed.c vendor-sys/opensolaris/dist/common/unicode/ vendor-sys/opensolaris/dist/common/unicode/u8_textprep.c vendor-sys/opensolaris/dist/common/zfs/ vendor-sys/opensolaris/dist/common/zfs/zfs_comutil.c vendor-sys/opensolaris/dist/common/zfs/zfs_comutil.h vendor-sys/opensolaris/dist/common/zfs/zfs_deleg.c vendor-sys/opensolaris/dist/common/zfs/zfs_deleg.h vendor-sys/opensolaris/dist/common/zfs/zfs_fletcher.c vendor-sys/opensolaris/dist/common/zfs/zfs_fletcher.h vendor-sys/opensolaris/dist/common/zfs/zfs_namecheck.c vendor-sys/opensolaris/dist/common/zfs/zfs_namecheck.h vendor-sys/opensolaris/dist/common/zfs/zfs_prop.c vendor-sys/opensolaris/dist/common/zfs/zfs_prop.h vendor-sys/opensolaris/dist/common/zfs/zpool_prop.c vendor-sys/opensolaris/dist/common/zfs/zprop_common.c vendor-sys/opensolaris/dist/uts/common/Makefile.files vendor-sys/opensolaris/dist/uts/common/fs/ vendor-sys/opensolaris/dist/uts/common/fs/gfs.c vendor-sys/opensolaris/dist/uts/common/fs/vnode.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/ vendor-sys/opensolaris/dist/uts/common/fs/zfs/arc.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/bplist.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/bpobj.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dbuf.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/ddt.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/ddt_zap.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu_diff.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu_object.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu_objset.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu_send.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu_traverse.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu_tx.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu_zfetch.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dnode.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dnode_sync.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_dataset.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_deadlist.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_deleg.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_dir.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_pool.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_prop.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_synctask.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/gzip.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/lzjb.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/metaslab.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/refcount.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/rrwlock.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/sa.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/sha256.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/spa.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/spa_config.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/spa_errlog.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/spa_history.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/space_map.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/ vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/arc.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/bplist.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/bpobj.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dbuf.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/ddt.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dmu.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dmu_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dmu_objset.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dmu_traverse.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dmu_tx.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dmu_zfetch.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dnode.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_dataset.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_deadlist.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_deleg.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_dir.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_pool.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_prop.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_scan.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_synctask.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/metaslab.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/metaslab_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/refcount.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/rrwlock.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/sa.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/sa_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/spa_boot.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/space_map.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/txg.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/txg_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/uberblock.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/uberblock_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/unique.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/vdev_disk.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/vdev_file.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zap.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zap_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zap_leaf.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_acl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_context.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_ctldir.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_debug.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_dir.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_fuid.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_ioctl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_onexit.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_rlock.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_sa.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_stat.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_vfsops.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_znode.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zil.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zil_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zio_checksum.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zio_compress.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zio_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zrlock.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zvol.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/txg.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/uberblock.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/unique.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_cache.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_disk.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_file.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_mirror.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_missing.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_queue.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_raidz.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_root.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zap.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zap_leaf.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zap_micro.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs.conf vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_acl.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_byteswap.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_ctldir.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_debug.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_dir.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_fm.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_fuid.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_log.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_onexit.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_replay.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_rlock.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_sa.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_vfsops.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_vnops.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_znode.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zil.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zio.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zio_checksum.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zio_compress.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zio_inject.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zle.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zrlock.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zvol.c vendor-sys/opensolaris/dist/uts/common/os/ vendor-sys/opensolaris/dist/uts/common/os/callb.c vendor-sys/opensolaris/dist/uts/common/os/fm.c vendor-sys/opensolaris/dist/uts/common/os/nvpair_alloc_system.c vendor-sys/opensolaris/dist/uts/common/sys/acl.h vendor-sys/opensolaris/dist/uts/common/sys/acl_impl.h vendor-sys/opensolaris/dist/uts/common/sys/avl.h vendor-sys/opensolaris/dist/uts/common/sys/avl_impl.h vendor-sys/opensolaris/dist/uts/common/sys/bitmap.h vendor-sys/opensolaris/dist/uts/common/sys/callb.h vendor-sys/opensolaris/dist/uts/common/sys/ccompile.h vendor-sys/opensolaris/dist/uts/common/sys/compress.h vendor-sys/opensolaris/dist/uts/common/sys/cred.h vendor-sys/opensolaris/dist/uts/common/sys/debug.h vendor-sys/opensolaris/dist/uts/common/sys/errorq.h vendor-sys/opensolaris/dist/uts/common/sys/extdirent.h vendor-sys/opensolaris/dist/uts/common/sys/feature_tests.h vendor-sys/opensolaris/dist/uts/common/sys/fm/ vendor-sys/opensolaris/dist/uts/common/sys/fm/fs/ vendor-sys/opensolaris/dist/uts/common/sys/fm/fs/zfs.h vendor-sys/opensolaris/dist/uts/common/sys/fm/protocol.h vendor-sys/opensolaris/dist/uts/common/sys/fm/util.h vendor-sys/opensolaris/dist/uts/common/sys/fs/ vendor-sys/opensolaris/dist/uts/common/sys/fs/zfs.h vendor-sys/opensolaris/dist/uts/common/sys/fs/zut.h vendor-sys/opensolaris/dist/uts/common/sys/gfs.h vendor-sys/opensolaris/dist/uts/common/sys/idmap.h vendor-sys/opensolaris/dist/uts/common/sys/isa_defs.h vendor-sys/opensolaris/dist/uts/common/sys/list.h vendor-sys/opensolaris/dist/uts/common/sys/list_impl.h vendor-sys/opensolaris/dist/uts/common/sys/note.h vendor-sys/opensolaris/dist/uts/common/sys/nvpair.h vendor-sys/opensolaris/dist/uts/common/sys/nvpair_impl.h vendor-sys/opensolaris/dist/uts/common/sys/processor.h vendor-sys/opensolaris/dist/uts/common/sys/procset.h vendor-sys/opensolaris/dist/uts/common/sys/synch.h vendor-sys/opensolaris/dist/uts/common/sys/sysevent/ vendor-sys/opensolaris/dist/uts/common/sys/sysevent.h vendor-sys/opensolaris/dist/uts/common/sys/sysevent/dev.h vendor-sys/opensolaris/dist/uts/common/sys/sysevent/eventdefs.h vendor-sys/opensolaris/dist/uts/common/sys/sysmacros.h vendor-sys/opensolaris/dist/uts/common/sys/taskq.h vendor-sys/opensolaris/dist/uts/common/sys/u8_textprep.h vendor-sys/opensolaris/dist/uts/common/sys/u8_textprep_data.h vendor-sys/opensolaris/dist/uts/common/sys/vnode.h vendor-sys/opensolaris/dist/uts/common/sys/zmod.h vendor-sys/opensolaris/dist/uts/common/zmod/ vendor-sys/opensolaris/dist/uts/common/zmod/adler32.c vendor-sys/opensolaris/dist/uts/common/zmod/crc32.c vendor-sys/opensolaris/dist/uts/common/zmod/crc32.h vendor-sys/opensolaris/dist/uts/common/zmod/deflate.c vendor-sys/opensolaris/dist/uts/common/zmod/deflate.h vendor-sys/opensolaris/dist/uts/common/zmod/inffast.c vendor-sys/opensolaris/dist/uts/common/zmod/inffast.h vendor-sys/opensolaris/dist/uts/common/zmod/inffixed.h vendor-sys/opensolaris/dist/uts/common/zmod/inflate.c vendor-sys/opensolaris/dist/uts/common/zmod/inflate.h vendor-sys/opensolaris/dist/uts/common/zmod/inftrees.c vendor-sys/opensolaris/dist/uts/common/zmod/inftrees.h vendor-sys/opensolaris/dist/uts/common/zmod/trees.c vendor-sys/opensolaris/dist/uts/common/zmod/zconf.h vendor-sys/opensolaris/dist/uts/common/zmod/zlib.h vendor-sys/opensolaris/dist/uts/common/zmod/zmod.c vendor-sys/opensolaris/dist/uts/common/zmod/zmod_subr.c vendor-sys/opensolaris/dist/uts/common/zmod/zutil.c vendor-sys/opensolaris/dist/uts/common/zmod/zutil.h Modified: vendor-sys/opensolaris/dist/uts/common/dtrace/dtrace.c vendor-sys/opensolaris/dist/uts/common/dtrace/fasttrap.c vendor-sys/opensolaris/dist/uts/common/dtrace/lockstat.c vendor-sys/opensolaris/dist/uts/common/dtrace/profile.c vendor-sys/opensolaris/dist/uts/common/dtrace/sdt_subr.c vendor-sys/opensolaris/dist/uts/common/dtrace/systrace.c vendor-sys/opensolaris/dist/uts/common/sys/cpupart.h vendor-sys/opensolaris/dist/uts/common/sys/cpuvar.h vendor-sys/opensolaris/dist/uts/common/sys/dtrace.h Added: vendor-sys/opensolaris/dist/OPENSOLARIS.LICENSE ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/opensolaris/dist/OPENSOLARIS.LICENSE Wed Jul 18 08:12:04 2012 (r238567) @@ -0,0 +1,384 @@ +Unless otherwise noted, all files in this distribution are released +under the Common Development and Distribution License (CDDL). +Exceptions are noted within the associated source files. + +-------------------------------------------------------------------- + + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE Version 1.0 + +1. Definitions. + + 1.1. "Contributor" means each individual or entity that creates + or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Software, prior Modifications used by a Contributor (if any), + and the Modifications made by that particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or (b) + Modifications, or (c) the combination of files containing + Original Software with files containing Modifications, in + each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form other + than Source Code. + + 1.5. "Initial Developer" means the individual or entity that first + makes Original Software available under this License. + + 1.6. "Larger Work" means a work which combines Covered Software or + portions thereof with code not governed by the terms of this + License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed + herein. + + 1.9. "Modifications" means the Source Code and Executable form of + any of the following: + + A. Any file that results from an addition to, deletion from or + modification of the contents of a file containing Original + Software or previous Modifications; + + B. Any new file that contains any part of the Original + Software or previous Modifications; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and Executable + form of computer software code that is originally released + under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, + process, and apparatus claims, in any patent Licensable by + grantor. + + 1.12. "Source Code" means (a) the common form of computer software + code in which modifications are made and (b) associated + documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms + of, this License. For legal entities, "You" includes any + entity which controls, is controlled by, or is under common + control with You. For purposes of this definition, + "control" means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty + percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the Initial + Developer hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer, to use, + reproduce, modify, display, perform, sublicense and + distribute the Original Software (or portions thereof), + with or without Modifications, and/or as part of a Larger + Work; and + + (b) under Patent Claims infringed by the making, using or + selling of Original Software, to make, have made, use, + practice, sell, and offer for sale, and/or otherwise + dispose of the Original Software (or portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) are + effective on the date Initial Developer first distributes + or otherwise makes the Original Software available to a + third party under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: (1) for code that You delete from the Original + Software, or (2) for infringements caused by: (i) the + modification of the Original Software, or (ii) the + combination of the Original Software with other software + or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor to use, reproduce, + modify, display, perform, sublicense and distribute the + Modifications created by such Contributor (or portions + thereof), either on an unmodified basis, with other + Modifications, as Covered Software and/or as part of a + Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either + alone and/or in combination with its Contributor Version + (or portions of such combination), to make, use, sell, + offer for sale, have made, and/or otherwise dispose of: + (1) Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications made by + that Contributor with its Contributor Version (or portions + of such combination). + + (c) The licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first distributes or + otherwise makes the Modifications available to a third + party. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: (1) for any code that Contributor has deleted + from the Contributor Version; (2) for infringements caused + by: (i) third party modifications of Contributor Version, + or (ii) the combination of Modifications made by that + Contributor with other software (except as part of the + Contributor Version) or other devices; or (3) under Patent + Claims infringed by Covered Software in the absence of + Modifications made by that Contributor. + +3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in Source + Code form and that Source Code form must be distributed only under + the terms of this License. You must include a copy of this + License with every copy of the Source Code form of the Covered + Software You distribute or otherwise make available. You must + inform recipients of any such Covered Software in Executable form + as to how they can obtain such Covered Software in Source Code + form in a reasonable manner on or through a medium customarily + used for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You contribute are + governed by the terms of this License. You represent that You + believe Your Modifications are Your original creation(s) and/or + You have sufficient rights to grant the rights conveyed by this + License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications that + identifies You as the Contributor of the Modification. You may + not remove or alter any copyright, patent or trademark notices + contained within the Covered Software, or any notices of licensing + or any descriptive text giving attribution to any Contributor or + the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered Software in + Source Code form that alters or restricts the applicable version + of this License or the recipients' rights hereunder. You may + choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of + Covered Software. However, you may do so only on Your own behalf, + and not on behalf of the Initial Developer or any Contributor. + You must make it absolutely clear that any such warranty, support, + indemnity or liability obligation is offered by You alone, and You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial Developer or + such Contributor as a result of warranty, support, indemnity or + liability terms You offer. + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered Software + under the terms of this License or under the terms of a license of + Your choice, which may contain terms different from this License, + provided that You are in compliance with the terms of this License + and that the license for the Executable form does not attempt to + limit or alter the recipient's rights in the Source Code form from + the rights set forth in this License. If You distribute the + Covered Software in Executable form under a different license, You + must make it absolutely clear that any terms which differ from + this License are offered by You alone, not by the Initial + Developer or Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of any + such terms You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software with + other code not governed by the terms of this License and + distribute the Larger Work as a single product. In such a case, + You must make sure the requirements of this License are fulfilled + for the Covered Software. + +4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and may + publish revised and/or new versions of this License from time to + time. Each version will be given a distinguishing version number. + Except as provided in Section 4.3, no one other than the license + steward has the right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise make the + Covered Software available under the terms of the version of the + License under which You originally received the Covered Software. + If the Initial Developer includes a notice in the Original + Software prohibiting it from being distributed or otherwise made + available under any subsequent version of the License, You must + distribute and make the Covered Software available under the terms + of the version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to use, + distribute or otherwise make the Covered Software available under + the terms of any subsequent version of the License published by + the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a new + license for Your Original Software, You may create and use a + modified version of this License if You: (a) rename the license + and remove any references to the name of the license steward + (except to note that the license differs from this License); and + (b) otherwise make it clear that the license contains terms which + differ from this License. + +5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY + NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + +6. TERMINATION. + + 6.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to + cure such breach within 30 days of becoming aware of the breach. + Provisions which, by their nature, must remain in effect beyond + the termination of this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or a + Contributor (the Initial Developer or Contributor against whom You + assert such claim is referred to as "Participant") alleging that + the Participant Software (meaning the Contributor Version where + the Participant is a Contributor or the Original Software where + the Participant is the Initial Developer) directly or indirectly + infringes any patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial Developer (if + the Initial Developer is not the Participant) and all Contributors + under Sections 2.1 and/or 2.2 of this License shall, upon 60 days + notice from Participant terminate prospectively and automatically + at the expiration of such 60 day notice period, unless if within + such 60 day period You withdraw Your claim with respect to the + Participant Software against such Participant either unilaterally + or pursuant to a written agreement with Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 above, + all end user licenses that have been validly granted by You or any + distributor hereunder prior to termination (excluding licenses + granted to You by any distributor) shall survive termination. + +7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + +8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 + C.F.R. 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 + (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 + C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all + U.S. Government End Users acquire Covered Software with only those + rights set forth herein. This U.S. Government Rights clause is in + lieu of, and supersedes, any other FAR, DFAR, or other clause or + provision that addresses Government rights in computer software + under this License. + +9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed + by the law of the jurisdiction specified in a notice contained + within the Original Software (except to the extent applicable law, + if any, provides otherwise), excluding such jurisdiction's + conflict-of-law provisions. Any litigation relating to this + License shall be subject to the jurisdiction of the courts located + in the jurisdiction and venue specified in a notice contained + within the Original Software, with the losing party responsible + for costs, including, without limitation, court costs and + reasonable attorneys' fees and expenses. The application of the + United Nations Convention on Contracts for the International Sale + of Goods is expressly excluded. Any law or regulation which + provides that the language of a contract shall be construed + against the drafter shall not apply to this License. You agree + that You alone are responsible for compliance with the United + States export administration regulations (and the export control + laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + +10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + +-------------------------------------------------------------------- + +NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND +DISTRIBUTION LICENSE (CDDL) + +For Covered Software in this distribution, this License shall +be governed by the laws of the State of California (excluding +conflict-of-law provisions). + +Any litigation relating to this License shall be subject to the +jurisdiction of the Federal Courts of the Northern District of +California and the state courts of the State of California, with +venue lying in Santa Clara County, California. Added: vendor-sys/opensolaris/dist/common/acl/acl_common.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/opensolaris/dist/common/acl/acl_common.c Wed Jul 18 08:12:04 2012 (r238567) @@ -0,0 +1,1755 @@ +/* + * CDDL HEADER START + * + * 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] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + */ + +#include +#include +#include +#if defined(_KERNEL) +#include +#include +#include +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define ASSERT assert +#endif + +#define ACE_POSIX_SUPPORTED_BITS (ACE_READ_DATA | \ + ACE_WRITE_DATA | ACE_APPEND_DATA | ACE_EXECUTE | \ + ACE_READ_ATTRIBUTES | ACE_READ_ACL | ACE_WRITE_ACL) + + +#define ACL_SYNCHRONIZE_SET_DENY 0x0000001 +#define ACL_SYNCHRONIZE_SET_ALLOW 0x0000002 +#define ACL_SYNCHRONIZE_ERR_DENY 0x0000004 +#define ACL_SYNCHRONIZE_ERR_ALLOW 0x0000008 + +#define ACL_WRITE_OWNER_SET_DENY 0x0000010 +#define ACL_WRITE_OWNER_SET_ALLOW 0x0000020 +#define ACL_WRITE_OWNER_ERR_DENY 0x0000040 +#define ACL_WRITE_OWNER_ERR_ALLOW 0x0000080 + +#define ACL_DELETE_SET_DENY 0x0000100 +#define ACL_DELETE_SET_ALLOW 0x0000200 +#define ACL_DELETE_ERR_DENY 0x0000400 +#define ACL_DELETE_ERR_ALLOW 0x0000800 + +#define ACL_WRITE_ATTRS_OWNER_SET_DENY 0x0001000 +#define ACL_WRITE_ATTRS_OWNER_SET_ALLOW 0x0002000 +#define ACL_WRITE_ATTRS_OWNER_ERR_DENY 0x0004000 +#define ACL_WRITE_ATTRS_OWNER_ERR_ALLOW 0x0008000 + +#define ACL_WRITE_ATTRS_WRITER_SET_DENY 0x0010000 +#define ACL_WRITE_ATTRS_WRITER_SET_ALLOW 0x0020000 +#define ACL_WRITE_ATTRS_WRITER_ERR_DENY 0x0040000 +#define ACL_WRITE_ATTRS_WRITER_ERR_ALLOW 0x0080000 + +#define ACL_WRITE_NAMED_WRITER_SET_DENY 0x0100000 +#define ACL_WRITE_NAMED_WRITER_SET_ALLOW 0x0200000 +#define ACL_WRITE_NAMED_WRITER_ERR_DENY 0x0400000 +#define ACL_WRITE_NAMED_WRITER_ERR_ALLOW 0x0800000 + +#define ACL_READ_NAMED_READER_SET_DENY 0x1000000 +#define ACL_READ_NAMED_READER_SET_ALLOW 0x2000000 +#define ACL_READ_NAMED_READER_ERR_DENY 0x4000000 +#define ACL_READ_NAMED_READER_ERR_ALLOW 0x8000000 + + +#define ACE_VALID_MASK_BITS (\ + ACE_READ_DATA | \ + ACE_LIST_DIRECTORY | \ + ACE_WRITE_DATA | \ + ACE_ADD_FILE | \ + ACE_APPEND_DATA | \ + ACE_ADD_SUBDIRECTORY | \ + ACE_READ_NAMED_ATTRS | \ + ACE_WRITE_NAMED_ATTRS | \ + ACE_EXECUTE | \ + ACE_DELETE_CHILD | \ + ACE_READ_ATTRIBUTES | \ + ACE_WRITE_ATTRIBUTES | \ + ACE_DELETE | \ + ACE_READ_ACL | \ + ACE_WRITE_ACL | \ + ACE_WRITE_OWNER | \ + ACE_SYNCHRONIZE) + +#define ACE_MASK_UNDEFINED 0x80000000 + +#define ACE_VALID_FLAG_BITS (ACE_FILE_INHERIT_ACE | \ + ACE_DIRECTORY_INHERIT_ACE | \ + ACE_NO_PROPAGATE_INHERIT_ACE | ACE_INHERIT_ONLY_ACE | \ + ACE_SUCCESSFUL_ACCESS_ACE_FLAG | ACE_FAILED_ACCESS_ACE_FLAG | \ + ACE_IDENTIFIER_GROUP | ACE_OWNER | ACE_GROUP | ACE_EVERYONE) + +/* + * ACL conversion helpers + */ + +typedef enum { + ace_unused, + ace_user_obj, + ace_user, + ace_group, /* includes GROUP and GROUP_OBJ */ + ace_other_obj +} ace_to_aent_state_t; + +typedef struct acevals { + uid_t key; + avl_node_t avl; + uint32_t mask; + uint32_t allowed; + uint32_t denied; + int aent_type; +} acevals_t; + +typedef struct ace_list { + acevals_t user_obj; + avl_tree_t user; + int numusers; + acevals_t group_obj; + avl_tree_t group; + int numgroups; + acevals_t other_obj; + uint32_t acl_mask; + int hasmask; + int dfacl_flag; + ace_to_aent_state_t state; + int seen; /* bitmask of all aclent_t a_type values seen */ +} ace_list_t; + +/* + * Generic shellsort, from K&R (1st ed, p 58.), somewhat modified. + * v = Ptr to array/vector of objs + * n = # objs in the array + * s = size of each obj (must be multiples of a word size) + * f = ptr to function to compare two objs + * returns (-1 = less than, 0 = equal, 1 = greater than + */ +void +ksort(caddr_t v, int n, int s, int (*f)()) +{ + int g, i, j, ii; + unsigned int *p1, *p2; + unsigned int tmp; + + /* No work to do */ + if (v == NULL || n <= 1) + return; + + /* Sanity check on arguments */ + ASSERT(((uintptr_t)v & 0x3) == 0 && (s & 0x3) == 0); + ASSERT(s > 0); + for (g = n / 2; g > 0; g /= 2) { + for (i = g; i < n; i++) { + for (j = i - g; j >= 0 && + (*f)(v + j * s, v + (j + g) * s) == 1; + j -= g) { + p1 = (void *)(v + j * s); + p2 = (void *)(v + (j + g) * s); + for (ii = 0; ii < s / 4; ii++) { + tmp = *p1; + *p1++ = *p2; + *p2++ = tmp; + } + } + } + } +} + +/* + * Compare two acls, all fields. Returns: + * -1 (less than) + * 0 (equal) + * +1 (greater than) + */ +int +cmp2acls(void *a, void *b) +{ + aclent_t *x = (aclent_t *)a; + aclent_t *y = (aclent_t *)b; + + /* Compare types */ + if (x->a_type < y->a_type) + return (-1); + if (x->a_type > y->a_type) + return (1); + /* Equal types; compare id's */ + if (x->a_id < y->a_id) + return (-1); + if (x->a_id > y->a_id) + return (1); + /* Equal ids; compare perms */ + if (x->a_perm < y->a_perm) + return (-1); + if (x->a_perm > y->a_perm) + return (1); + /* Totally equal */ + return (0); +} + +/*ARGSUSED*/ +static void * +cacl_realloc(void *ptr, size_t size, size_t new_size) +{ +#if defined(_KERNEL) + void *tmp; + + tmp = kmem_alloc(new_size, KM_SLEEP); + (void) memcpy(tmp, ptr, (size < new_size) ? size : new_size); + kmem_free(ptr, size); + return (tmp); +#else + return (realloc(ptr, new_size)); +#endif +} + +static int +cacl_malloc(void **ptr, size_t size) +{ +#if defined(_KERNEL) + *ptr = kmem_zalloc(size, KM_SLEEP); + return (0); +#else + *ptr = calloc(1, size); + if (*ptr == NULL) + return (errno); + + return (0); +#endif +} + +/*ARGSUSED*/ +static void +cacl_free(void *ptr, size_t size) +{ +#if defined(_KERNEL) + kmem_free(ptr, size); +#else + free(ptr); +#endif +} + +acl_t * +acl_alloc(enum acl_type type) +{ + acl_t *aclp; + + if (cacl_malloc((void **)&aclp, sizeof (acl_t)) != 0) + return (NULL); + + aclp->acl_aclp = NULL; + aclp->acl_cnt = 0; + + switch (type) { + case ACE_T: + aclp->acl_type = ACE_T; + aclp->acl_entry_size = sizeof (ace_t); + break; + case ACLENT_T: + aclp->acl_type = ACLENT_T; + aclp->acl_entry_size = sizeof (aclent_t); + break; + default: + acl_free(aclp); + aclp = NULL; + } + return (aclp); +} + +/* + * Free acl_t structure + */ +void +acl_free(acl_t *aclp) +{ + int acl_size; + + if (aclp == NULL) + return; + + if (aclp->acl_aclp) { + acl_size = aclp->acl_cnt * aclp->acl_entry_size; + cacl_free(aclp->acl_aclp, acl_size); + } + + cacl_free(aclp, sizeof (acl_t)); +} + +static uint32_t +access_mask_set(int haswriteperm, int hasreadperm, int isowner, int isallow) +{ + uint32_t access_mask = 0; + int acl_produce; + int synchronize_set = 0, write_owner_set = 0; + int delete_set = 0, write_attrs_set = 0; + int read_named_set = 0, write_named_set = 0; + + acl_produce = (ACL_SYNCHRONIZE_SET_ALLOW | + ACL_WRITE_ATTRS_OWNER_SET_ALLOW | + ACL_WRITE_ATTRS_WRITER_SET_DENY); + + if (isallow) { + synchronize_set = ACL_SYNCHRONIZE_SET_ALLOW; + write_owner_set = ACL_WRITE_OWNER_SET_ALLOW; + delete_set = ACL_DELETE_SET_ALLOW; + if (hasreadperm) + read_named_set = ACL_READ_NAMED_READER_SET_ALLOW; + if (haswriteperm) + write_named_set = ACL_WRITE_NAMED_WRITER_SET_ALLOW; + if (isowner) + write_attrs_set = ACL_WRITE_ATTRS_OWNER_SET_ALLOW; + else if (haswriteperm) + write_attrs_set = ACL_WRITE_ATTRS_WRITER_SET_ALLOW; + } else { + + synchronize_set = ACL_SYNCHRONIZE_SET_DENY; + write_owner_set = ACL_WRITE_OWNER_SET_DENY; + delete_set = ACL_DELETE_SET_DENY; + if (hasreadperm) + read_named_set = ACL_READ_NAMED_READER_SET_DENY; + if (haswriteperm) + write_named_set = ACL_WRITE_NAMED_WRITER_SET_DENY; + if (isowner) + write_attrs_set = ACL_WRITE_ATTRS_OWNER_SET_DENY; + else if (haswriteperm) + write_attrs_set = ACL_WRITE_ATTRS_WRITER_SET_DENY; + else + /* + * If the entity is not the owner and does not + * have write permissions ACE_WRITE_ATTRIBUTES will + * always go in the DENY ACE. + */ + access_mask |= ACE_WRITE_ATTRIBUTES; + } + + if (acl_produce & synchronize_set) + access_mask |= ACE_SYNCHRONIZE; + if (acl_produce & write_owner_set) + access_mask |= ACE_WRITE_OWNER; + if (acl_produce & delete_set) + access_mask |= ACE_DELETE; + if (acl_produce & write_attrs_set) + access_mask |= ACE_WRITE_ATTRIBUTES; + if (acl_produce & read_named_set) + access_mask |= ACE_READ_NAMED_ATTRS; + if (acl_produce & write_named_set) + access_mask |= ACE_WRITE_NAMED_ATTRS; + + return (access_mask); +} + +/* + * Given an mode_t, convert it into an access_mask as used + * by nfsace, assuming aclent_t -> nfsace semantics. + */ +static uint32_t +mode_to_ace_access(mode_t mode, int isdir, int isowner, int isallow) +{ + uint32_t access = 0; + int haswriteperm = 0; + int hasreadperm = 0; + + if (isallow) { + haswriteperm = (mode & S_IWOTH); + hasreadperm = (mode & S_IROTH); + } else { + haswriteperm = !(mode & S_IWOTH); + hasreadperm = !(mode & S_IROTH); + } + + /* + * The following call takes care of correctly setting the following + * mask bits in the access_mask: + * ACE_SYNCHRONIZE, ACE_WRITE_OWNER, ACE_DELETE, + * ACE_WRITE_ATTRIBUTES, ACE_WRITE_NAMED_ATTRS, ACE_READ_NAMED_ATTRS + */ + access = access_mask_set(haswriteperm, hasreadperm, isowner, isallow); + + if (isallow) { + access |= ACE_READ_ACL | ACE_READ_ATTRIBUTES; + if (isowner) + access |= ACE_WRITE_ACL; + } else { + if (! isowner) + access |= ACE_WRITE_ACL; + } + + /* read */ + if (mode & S_IROTH) { + access |= ACE_READ_DATA; + } + /* write */ + if (mode & S_IWOTH) { + access |= ACE_WRITE_DATA | + ACE_APPEND_DATA; + if (isdir) + access |= ACE_DELETE_CHILD; + } + /* exec */ + if (mode & 01) { + access |= ACE_EXECUTE; + } + + return (access); +} + +/* + * Given an nfsace (presumably an ALLOW entry), make a + * corresponding DENY entry at the address given. + */ +static void +ace_make_deny(ace_t *allow, ace_t *deny, int isdir, int isowner) +{ + (void) memcpy(deny, allow, sizeof (ace_t)); + + deny->a_who = allow->a_who; + + deny->a_type = ACE_ACCESS_DENIED_ACE_TYPE; + deny->a_access_mask ^= ACE_POSIX_SUPPORTED_BITS; + if (isdir) + deny->a_access_mask ^= ACE_DELETE_CHILD; + + deny->a_access_mask &= ~(ACE_SYNCHRONIZE | ACE_WRITE_OWNER | + ACE_DELETE | ACE_WRITE_ATTRIBUTES | ACE_READ_NAMED_ATTRS | + ACE_WRITE_NAMED_ATTRS); + deny->a_access_mask |= access_mask_set((allow->a_access_mask & + ACE_WRITE_DATA), (allow->a_access_mask & ACE_READ_DATA), isowner, + B_FALSE); +} +/* + * Make an initial pass over an array of aclent_t's. Gather + * information such as an ACL_MASK (if any), number of users, + * number of groups, and whether the array needs to be sorted. + */ +static int +ln_aent_preprocess(aclent_t *aclent, int n, + int *hasmask, mode_t *mask, + int *numuser, int *numgroup, int *needsort) +{ + int error = 0; + int i; + int curtype = 0; + + *hasmask = 0; + *mask = 07; + *needsort = 0; + *numuser = 0; + *numgroup = 0; + + for (i = 0; i < n; i++) { + if (aclent[i].a_type < curtype) + *needsort = 1; + else if (aclent[i].a_type > curtype) + curtype = aclent[i].a_type; + if (aclent[i].a_type & USER) + (*numuser)++; + if (aclent[i].a_type & (GROUP | GROUP_OBJ)) + (*numgroup)++; + if (aclent[i].a_type & CLASS_OBJ) { + if (*hasmask) { + error = EINVAL; + goto out; + } else { + *hasmask = 1; + *mask = aclent[i].a_perm; + } + } + } + + if ((! *hasmask) && (*numuser + *numgroup > 1)) { + error = EINVAL; + goto out; + } + +out: + return (error); +} + +/* + * Convert an array of aclent_t into an array of nfsace entries, + * following POSIX draft -> nfsv4 conversion semantics as outlined in + * the IETF draft. + */ +static int +ln_aent_to_ace(aclent_t *aclent, int n, ace_t **acepp, int *rescount, int isdir) +{ + int error = 0; + mode_t mask; + int numuser, numgroup, needsort; + int resultsize = 0; + int i, groupi = 0, skip; + ace_t *acep, *result = NULL; + int hasmask; + + error = ln_aent_preprocess(aclent, n, &hasmask, &mask, + &numuser, &numgroup, &needsort); + if (error != 0) + goto out; + + /* allow + deny for each aclent */ + resultsize = n * 2; + if (hasmask) { + /* + * stick extra deny on the group_obj and on each + * user|group for the mask (the group_obj was added + * into the count for numgroup) + */ + resultsize += numuser + numgroup; + /* ... and don't count the mask itself */ + resultsize -= 2; + } + + /* sort the source if necessary */ + if (needsort) + ksort((caddr_t)aclent, n, sizeof (aclent_t), cmp2acls); + + if (cacl_malloc((void **)&result, resultsize * sizeof (ace_t)) != 0) + goto out; + + acep = result; + + for (i = 0; i < n; i++) { + /* + * don't process CLASS_OBJ (mask); mask was grabbed in + * ln_aent_preprocess() + */ + if (aclent[i].a_type & CLASS_OBJ) + continue; + + /* If we need an ACL_MASK emulator, prepend it now */ + if ((hasmask) && + (aclent[i].a_type & (USER | GROUP | GROUP_OBJ))) { + acep->a_type = ACE_ACCESS_DENIED_ACE_TYPE; + acep->a_flags = 0; + if (aclent[i].a_type & GROUP_OBJ) { + acep->a_who = (uid_t)-1; + acep->a_flags |= + (ACE_IDENTIFIER_GROUP|ACE_GROUP); + } else if (aclent[i].a_type & USER) { + acep->a_who = aclent[i].a_id; + } else { + acep->a_who = aclent[i].a_id; + acep->a_flags |= ACE_IDENTIFIER_GROUP; + } + if (aclent[i].a_type & ACL_DEFAULT) { + acep->a_flags |= ACE_INHERIT_ONLY_ACE | + ACE_FILE_INHERIT_ACE | + ACE_DIRECTORY_INHERIT_ACE; + } + /* + * Set the access mask for the prepended deny + * ace. To do this, we invert the mask (found + * in ln_aent_preprocess()) then convert it to an + * DENY ace access_mask. + */ + acep->a_access_mask = mode_to_ace_access((mask ^ 07), + isdir, 0, 0); + acep += 1; + } + + /* handle a_perm -> access_mask */ + acep->a_access_mask = mode_to_ace_access(aclent[i].a_perm, + isdir, aclent[i].a_type & USER_OBJ, 1); + + /* emulate a default aclent */ + if (aclent[i].a_type & ACL_DEFAULT) { + acep->a_flags |= ACE_INHERIT_ONLY_ACE | + ACE_FILE_INHERIT_ACE | + ACE_DIRECTORY_INHERIT_ACE; + } + + /* + * handle a_perm and a_id + * + * this must be done last, since it involves the + * corresponding deny aces, which are handled + * differently for each different a_type. + */ + if (aclent[i].a_type & USER_OBJ) { + acep->a_who = (uid_t)-1; + acep->a_flags |= ACE_OWNER; + ace_make_deny(acep, acep + 1, isdir, B_TRUE); + acep += 2; + } else if (aclent[i].a_type & USER) { + acep->a_who = aclent[i].a_id; + ace_make_deny(acep, acep + 1, isdir, B_FALSE); + acep += 2; + } else if (aclent[i].a_type & (GROUP_OBJ | GROUP)) { + if (aclent[i].a_type & GROUP_OBJ) { + acep->a_who = (uid_t)-1; + acep->a_flags |= ACE_GROUP; + } else { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 08:17:40 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34E88106566C; Wed, 18 Jul 2012 08:17:40 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 056BB8FC0C; Wed, 18 Jul 2012 08:17:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I8HdC8044731; Wed, 18 Jul 2012 08:17:39 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I8HdK2044730; Wed, 18 Jul 2012 08:17:39 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207180817.q6I8HdK2044730@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 08:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238568 - vendor-sys/opensolaris/20100818 vendor/opensolaris/20100818 X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 08:17:40 -0000 Author: mm Date: Wed Jul 18 08:17:39 2012 New Revision: 238568 URL: http://svn.freebsd.org/changeset/base/238568 Log: Tag vendor/opensolaris and vendor-sys/opensolaris as 20100818 Added: vendor-sys/opensolaris/20100818/ - copied from r238567, vendor-sys/opensolaris/dist/ Changes in other areas also in this revision: Added: vendor/opensolaris/20100818/ - copied from r238566, vendor/opensolaris/dist/ From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 08:17:40 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 65DB01065670; Wed, 18 Jul 2012 08:17:40 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37B138FC14; Wed, 18 Jul 2012 08:17:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I8Hev5044736; Wed, 18 Jul 2012 08:17:40 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I8Het6044735; Wed, 18 Jul 2012 08:17:40 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207180817.q6I8Het6044735@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 08:17:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238568 - vendor-sys/opensolaris/20100818 vendor/opensolaris/20100818 X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 08:17:40 -0000 Author: mm Date: Wed Jul 18 08:17:39 2012 New Revision: 238568 URL: http://svn.freebsd.org/changeset/base/238568 Log: Tag vendor/opensolaris and vendor-sys/opensolaris as 20100818 Added: vendor/opensolaris/20100818/ - copied from r238566, vendor/opensolaris/dist/ Changes in other areas also in this revision: Added: vendor-sys/opensolaris/20100818/ - copied from r238567, vendor-sys/opensolaris/dist/ From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 08:23:49 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 22585106564A; Wed, 18 Jul 2012 08:23:49 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E96DF8FC16; Wed, 18 Jul 2012 08:23:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I8Nmoi045181; Wed, 18 Jul 2012 08:23:48 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I8Nmbm045180; Wed, 18 Jul 2012 08:23:48 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207180823.q6I8Nmbm045180@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 08:23:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238569 - vendor-sys/illumos/dist X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 08:23:49 -0000 Author: mm Date: Wed Jul 18 08:23:48 2012 New Revision: 238569 URL: http://svn.freebsd.org/changeset/base/238569 Log: Remove vendor-sys/illumos/dist for repopulation from latest vendor/opensolaris Deleted: vendor-sys/illumos/dist/ From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 08:25:00 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 609C2106567E; Wed, 18 Jul 2012 08:25:00 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 313398FC16; Wed, 18 Jul 2012 08:25:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I8P0G9045302; Wed, 18 Jul 2012 08:25:00 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I8P0SZ045300; Wed, 18 Jul 2012 08:25:00 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207180825.q6I8P0SZ045300@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 08:24:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238570 - vendor-sys/illumos/dist X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 08:25:00 -0000 Author: mm Date: Wed Jul 18 08:24:59 2012 New Revision: 238570 URL: http://svn.freebsd.org/changeset/base/238570 Log: Copy vendor-sys/opensolaris/dist to vendor-sys/illumos/dist Added: vendor-sys/illumos/dist/ - copied from r238567, vendor-sys/opensolaris/dist/ From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 08:37:09 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 50E69106564A; Wed, 18 Jul 2012 08:37:09 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23E638FC1F; Wed, 18 Jul 2012 08:37:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I8b8ZE046227; Wed, 18 Jul 2012 08:37:08 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I8b8do046226; Wed, 18 Jul 2012 08:37:08 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207180837.q6I8b8do046226@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 08:37:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238571 - vendor-sys/illumos/20100818 X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 08:37:09 -0000 Author: mm Date: Wed Jul 18 08:37:08 2012 New Revision: 238571 URL: http://svn.freebsd.org/changeset/base/238571 Log: Tag initial vendor-sys/illumos/dist as 20100818 Added: vendor-sys/illumos/20100818/ - copied from r238570, vendor-sys/illumos/dist/ From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 09:10:54 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB6281065673; Wed, 18 Jul 2012 09:10:54 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A21D18FC20; Wed, 18 Jul 2012 09:10:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I9AspJ049181; Wed, 18 Jul 2012 09:10:54 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I9AsM7049174; Wed, 18 Jul 2012 09:10:54 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207180910.q6I9AsM7049174@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 09:10:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238575 - in vendor-sys/illumos/dist: common/acl common/nvpair common/zfs uts/common uts/common/dtrace uts/common/fs/zfs uts/common/fs/zfs/sys uts/common/os uts/common/sys uts/common/sy... X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 09:10:54 -0000 Author: mm Date: Wed Jul 18 09:10:54 2012 New Revision: 238575 URL: http://svn.freebsd.org/changeset/base/238575 Log: Update vendor-sys/illumos/dist to pre libzfs_core state illumos-gate revision 13742:b6bbdd77139c Obtained from: ssh://anonhg@hg.illumos.org/illumos-gate Added: vendor-sys/illumos/dist/common/nvpair/fnvpair.c vendor-sys/illumos/dist/common/zfs/zfeature_common.c vendor-sys/illumos/dist/common/zfs/zfeature_common.h vendor-sys/illumos/dist/uts/common/fs/zfs/bptree.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/bptree.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfeature.h vendor-sys/illumos/dist/uts/common/fs/zfs/zfeature.c Modified: vendor-sys/illumos/dist/common/acl/acl_common.c vendor-sys/illumos/dist/common/acl/acl_common.h vendor-sys/illumos/dist/common/zfs/zfs_deleg.c vendor-sys/illumos/dist/common/zfs/zfs_deleg.h vendor-sys/illumos/dist/common/zfs/zfs_prop.c vendor-sys/illumos/dist/common/zfs/zpool_prop.c vendor-sys/illumos/dist/uts/common/Makefile.files vendor-sys/illumos/dist/uts/common/dtrace/dtrace.c vendor-sys/illumos/dist/uts/common/dtrace/fasttrap.c vendor-sys/illumos/dist/uts/common/dtrace/profile.c vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c vendor-sys/illumos/dist/uts/common/fs/zfs/bpobj.c vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode_sync.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deadlist.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deleg.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_config.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_history.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_traverse.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_deleg.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_pool.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_scan.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_acl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_context.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_vfsops.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_cache.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_mirror.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_missing.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_raidz.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_root.c vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_fm.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c vendor-sys/illumos/dist/uts/common/os/fm.c vendor-sys/illumos/dist/uts/common/sys/ccompile.h vendor-sys/illumos/dist/uts/common/sys/cmn_err.h vendor-sys/illumos/dist/uts/common/sys/dtrace.h vendor-sys/illumos/dist/uts/common/sys/dtrace_impl.h vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h vendor-sys/illumos/dist/uts/common/sys/nvpair.h vendor-sys/illumos/dist/uts/common/sys/sysevent/eventdefs.h vendor-sys/illumos/dist/uts/common/sys/sysmacros.h Modified: vendor-sys/illumos/dist/common/acl/acl_common.c ============================================================================== --- vendor-sys/illumos/dist/common/acl/acl_common.c Wed Jul 18 09:06:07 2012 (r238574) +++ vendor-sys/illumos/dist/common/acl/acl_common.c Wed Jul 18 09:10:54 2012 (r238575) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ #include @@ -372,7 +373,7 @@ access_mask_set(int haswriteperm, int ha * by nfsace, assuming aclent_t -> nfsace semantics. */ static uint32_t -mode_to_ace_access(mode_t mode, int isdir, int isowner, int isallow) +mode_to_ace_access(mode_t mode, boolean_t isdir, int isowner, int isallow) { uint32_t access = 0; int haswriteperm = 0; @@ -415,7 +416,7 @@ mode_to_ace_access(mode_t mode, int isdi access |= ACE_DELETE_CHILD; } /* exec */ - if (mode & 01) { + if (mode & S_IXOTH) { access |= ACE_EXECUTE; } @@ -666,7 +667,7 @@ out: } static int -convert_aent_to_ace(aclent_t *aclentp, int aclcnt, int isdir, +convert_aent_to_ace(aclent_t *aclentp, int aclcnt, boolean_t isdir, ace_t **retacep, int *retacecnt) { ace_t *acep; @@ -692,7 +693,7 @@ convert_aent_to_ace(aclent_t *aclentp, i dfaclcnt = aclcnt - i; } - if (dfaclcnt && isdir == 0) { + if (dfaclcnt && !isdir) { return (EINVAL); } @@ -730,7 +731,7 @@ convert_aent_to_ace(aclent_t *aclentp, i } static int -ace_mask_to_mode(uint32_t mask, o_mode_t *modep, int isdir) +ace_mask_to_mode(uint32_t mask, o_mode_t *modep, boolean_t isdir) { int error = 0; o_mode_t mode = 0; @@ -1027,7 +1028,7 @@ out: } static int -ace_allow_to_mode(uint32_t mask, o_mode_t *modep, int isdir) +ace_allow_to_mode(uint32_t mask, o_mode_t *modep, boolean_t isdir) { /* ACE_READ_ACL and ACE_READ_ATTRIBUTES must both be set */ if ((mask & (ACE_READ_ACL | ACE_READ_ATTRIBUTES)) != @@ -1040,7 +1041,7 @@ ace_allow_to_mode(uint32_t mask, o_mode_ static int acevals_to_aent(acevals_t *vals, aclent_t *dest, ace_list_t *list, - uid_t owner, gid_t group, int isdir) + uid_t owner, gid_t group, boolean_t isdir) { int error; uint32_t flips = ACE_POSIX_SUPPORTED_BITS; @@ -1080,7 +1081,7 @@ out: static int ace_list_to_aent(ace_list_t *list, aclent_t **aclentp, int *aclcnt, - uid_t owner, gid_t group, int isdir) + uid_t owner, gid_t group, boolean_t isdir) { int error = 0; aclent_t *aent, *result = NULL; @@ -1260,7 +1261,7 @@ acevals_compare(const void *va, const vo static int ln_ace_to_aent(ace_t *ace, int n, uid_t owner, gid_t group, aclent_t **aclentp, int *aclcnt, aclent_t **dfaclentp, int *dfaclcnt, - int isdir) + boolean_t isdir) { int error = 0; ace_t *acep; @@ -1455,7 +1456,7 @@ out: } static int -convert_ace_to_aent(ace_t *acebufp, int acecnt, int isdir, +convert_ace_to_aent(ace_t *acebufp, int acecnt, boolean_t isdir, uid_t owner, gid_t group, aclent_t **retaclentp, int *retaclcnt) { int error = 0; @@ -1497,7 +1498,7 @@ convert_ace_to_aent(ace_t *acebufp, int int -acl_translate(acl_t *aclp, int target_flavor, int isdir, uid_t owner, +acl_translate(acl_t *aclp, int target_flavor, boolean_t isdir, uid_t owner, gid_t group) { int aclcnt; @@ -1568,101 +1569,105 @@ out: } void -acl_trivial_access_masks(mode_t mode, uint32_t *allow0, uint32_t *deny1, - uint32_t *deny2, uint32_t *owner, uint32_t *group, uint32_t *everyone) +acl_trivial_access_masks(mode_t mode, boolean_t isdir, trivial_acl_t *masks) { - *deny1 = *deny2 = *allow0 = *group = 0; + uint32_t read_mask = ACE_READ_DATA; + uint32_t write_mask = ACE_WRITE_DATA|ACE_APPEND_DATA; + uint32_t execute_mask = ACE_EXECUTE; + (void) isdir; /* will need this later */ + + masks->deny1 = 0; if (!(mode & S_IRUSR) && (mode & (S_IRGRP|S_IROTH))) - *deny1 |= ACE_READ_DATA; + masks->deny1 |= read_mask; if (!(mode & S_IWUSR) && (mode & (S_IWGRP|S_IWOTH))) - *deny1 |= ACE_WRITE_DATA; + masks->deny1 |= write_mask; if (!(mode & S_IXUSR) && (mode & (S_IXGRP|S_IXOTH))) - *deny1 |= ACE_EXECUTE; + masks->deny1 |= execute_mask; + masks->deny2 = 0; if (!(mode & S_IRGRP) && (mode & S_IROTH)) - *deny2 = ACE_READ_DATA; + masks->deny2 |= read_mask; if (!(mode & S_IWGRP) && (mode & S_IWOTH)) - *deny2 |= ACE_WRITE_DATA; + masks->deny2 |= write_mask; if (!(mode & S_IXGRP) && (mode & S_IXOTH)) - *deny2 |= ACE_EXECUTE; + masks->deny2 |= execute_mask; + masks->allow0 = 0; if ((mode & S_IRUSR) && (!(mode & S_IRGRP) && (mode & S_IROTH))) - *allow0 |= ACE_READ_DATA; + masks->allow0 |= read_mask; if ((mode & S_IWUSR) && (!(mode & S_IWGRP) && (mode & S_IWOTH))) - *allow0 |= ACE_WRITE_DATA; + masks->allow0 |= write_mask; if ((mode & S_IXUSR) && (!(mode & S_IXGRP) && (mode & S_IXOTH))) - *allow0 |= ACE_EXECUTE; + masks->allow0 |= execute_mask; - *owner = ACE_WRITE_ATTRIBUTES|ACE_WRITE_OWNER|ACE_WRITE_ACL| + masks->owner = ACE_WRITE_ATTRIBUTES|ACE_WRITE_OWNER|ACE_WRITE_ACL| ACE_WRITE_NAMED_ATTRS|ACE_READ_ACL|ACE_READ_ATTRIBUTES| ACE_READ_NAMED_ATTRS|ACE_SYNCHRONIZE; if (mode & S_IRUSR) - *owner |= ACE_READ_DATA; + masks->owner |= read_mask; if (mode & S_IWUSR) - *owner |= ACE_WRITE_DATA|ACE_APPEND_DATA; + masks->owner |= write_mask; if (mode & S_IXUSR) - *owner |= ACE_EXECUTE; + masks->owner |= execute_mask; - *group = ACE_READ_ACL|ACE_READ_ATTRIBUTES| ACE_READ_NAMED_ATTRS| + masks->group = ACE_READ_ACL|ACE_READ_ATTRIBUTES|ACE_READ_NAMED_ATTRS| ACE_SYNCHRONIZE; if (mode & S_IRGRP) - *group |= ACE_READ_DATA; + masks->group |= read_mask; if (mode & S_IWGRP) - *group |= ACE_WRITE_DATA|ACE_APPEND_DATA; + masks->group |= write_mask; if (mode & S_IXGRP) - *group |= ACE_EXECUTE; + masks->group |= execute_mask; - *everyone = ACE_READ_ACL|ACE_READ_ATTRIBUTES| ACE_READ_NAMED_ATTRS| + masks->everyone = ACE_READ_ACL|ACE_READ_ATTRIBUTES|ACE_READ_NAMED_ATTRS| ACE_SYNCHRONIZE; if (mode & S_IROTH) - *everyone |= ACE_READ_DATA; + masks->everyone |= read_mask; if (mode & S_IWOTH) - *everyone |= ACE_WRITE_DATA|ACE_APPEND_DATA; + masks->everyone |= write_mask; if (mode & S_IXOTH) - *everyone |= ACE_EXECUTE; + masks->everyone |= execute_mask; } int -acl_trivial_create(mode_t mode, ace_t **acl, int *count) +acl_trivial_create(mode_t mode, boolean_t isdir, ace_t **acl, int *count) { - uint32_t deny1, deny2; - uint32_t allow0; - uint32_t owner, group, everyone; int index = 0; int error; + trivial_acl_t masks; *count = 3; - acl_trivial_access_masks(mode, &allow0, &deny1, &deny2, &owner, &group, - &everyone); + acl_trivial_access_masks(mode, isdir, &masks); - if (allow0) + if (masks.allow0) (*count)++; - if (deny1) + if (masks.deny1) (*count)++; - if (deny2) + if (masks.deny2) (*count)++; if ((error = cacl_malloc((void **)acl, *count * sizeof (ace_t))) != 0) return (error); - if (allow0) { - SET_ACE(acl, index, -1, allow0, ACE_ACCESS_ALLOWED_ACE_TYPE, - ACE_OWNER); - } - if (deny1) { - SET_ACE(acl, index, -1, deny1, ACE_ACCESS_DENIED_ACE_TYPE, - ACE_OWNER); - } - if (deny2) { - SET_ACE(acl, index, -1, deny2, ACE_ACCESS_DENIED_ACE_TYPE, - ACE_GROUP|ACE_IDENTIFIER_GROUP); - } - - SET_ACE(acl, index, -1, owner, ACE_ACCESS_ALLOWED_ACE_TYPE, ACE_OWNER); - SET_ACE(acl, index, -1, group, ACE_ACCESS_ALLOWED_ACE_TYPE, + if (masks.allow0) { + SET_ACE(acl, index, -1, masks.allow0, + ACE_ACCESS_ALLOWED_ACE_TYPE, ACE_OWNER); + } + if (masks.deny1) { + SET_ACE(acl, index, -1, masks.deny1, + ACE_ACCESS_DENIED_ACE_TYPE, ACE_OWNER); + } + if (masks.deny2) { + SET_ACE(acl, index, -1, masks.deny2, + ACE_ACCESS_DENIED_ACE_TYPE, ACE_GROUP|ACE_IDENTIFIER_GROUP); + } + + SET_ACE(acl, index, -1, masks.owner, ACE_ACCESS_ALLOWED_ACE_TYPE, + ACE_OWNER); + SET_ACE(acl, index, -1, masks.group, ACE_ACCESS_ALLOWED_ACE_TYPE, ACE_IDENTIFIER_GROUP|ACE_GROUP); - SET_ACE(acl, index, -1, everyone, ACE_ACCESS_ALLOWED_ACE_TYPE, + SET_ACE(acl, index, -1, masks.everyone, ACE_ACCESS_ALLOWED_ACE_TYPE, ACE_EVERYONE); return (0); Modified: vendor-sys/illumos/dist/common/acl/acl_common.h ============================================================================== --- vendor-sys/illumos/dist/common/acl/acl_common.h Wed Jul 18 09:06:07 2012 (r238574) +++ vendor-sys/illumos/dist/common/acl/acl_common.h Wed Jul 18 09:10:54 2012 (r238575) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ #ifndef _ACL_COMMON_H @@ -33,7 +34,14 @@ extern "C" { #endif -extern ace_t trivial_acl[6]; +typedef struct trivial_acl { + uint32_t allow0; /* allow mask for bits only in owner */ + uint32_t deny1; /* deny mask for bits not in owner */ + uint32_t deny2; /* deny mask for bits not in group */ + uint32_t owner; /* allow mask matching mode */ + uint32_t group; /* allow mask matching mode */ + uint32_t everyone; /* allow mask matching mode */ +} trivial_acl_t; extern int acltrivial(const char *); extern void adjust_ace_pair(ace_t *pair, mode_t mode); @@ -44,13 +52,13 @@ extern int ace_trivial_common(void *, in uint32_t *mask)); extern acl_t *acl_alloc(acl_type_t); extern void acl_free(acl_t *aclp); -extern int acl_translate(acl_t *aclp, int target_flavor, - int isdir, uid_t owner, gid_t group); +extern int acl_translate(acl_t *aclp, int target_flavor, boolean_t isdir, + uid_t owner, gid_t group); void ksort(caddr_t v, int n, int s, int (*f)()); int cmp2acls(void *a, void *b); -int acl_trivial_create(mode_t mode, ace_t **acl, int *count); -void acl_trivial_access_masks(mode_t mode, uint32_t *allow0, uint32_t *deny1, - uint32_t *deny2, uint32_t *owner, uint32_t *group, uint32_t *everyone); +int acl_trivial_create(mode_t mode, boolean_t isdir, ace_t **acl, int *count); +void acl_trivial_access_masks(mode_t mode, boolean_t isdir, + trivial_acl_t *masks); #ifdef __cplusplus } Added: vendor-sys/illumos/dist/common/nvpair/fnvpair.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/illumos/dist/common/nvpair/fnvpair.c Wed Jul 18 09:10:54 2012 (r238575) @@ -0,0 +1,496 @@ +/* + * CDDL HEADER START + * + * 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] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +#include +#include +#include +#ifndef _KERNEL +#include +#endif + +/* + * "Force" nvlist wrapper. + * + * These functions wrap the nvlist_* functions with assertions that assume + * the operation is successful. This allows the caller's code to be much + * more readable, especially for the fnvlist_lookup_* and fnvpair_value_* + * functions, which can return the requested value (rather than filling in + * a pointer). + * + * These functions use NV_UNIQUE_NAME, encoding NV_ENCODE_NATIVE, and allocate + * with KM_SLEEP. + * + * More wrappers should be added as needed -- for example + * nvlist_lookup_*_array and nvpair_value_*_array. + */ + +nvlist_t * +fnvlist_alloc(void) +{ + nvlist_t *nvl; + VERIFY3U(nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_SLEEP), ==, 0); + return (nvl); +} + +void +fnvlist_free(nvlist_t *nvl) +{ + nvlist_free(nvl); +} + +size_t +fnvlist_size(nvlist_t *nvl) +{ + size_t size; + VERIFY3U(nvlist_size(nvl, &size, NV_ENCODE_NATIVE), ==, 0); + return (size); +} + +/* + * Returns allocated buffer of size *sizep. Caller must free the buffer with + * fnvlist_pack_free(). + */ +char * +fnvlist_pack(nvlist_t *nvl, size_t *sizep) +{ + char *packed = 0; + VERIFY3U(nvlist_pack(nvl, &packed, sizep, NV_ENCODE_NATIVE, + KM_SLEEP), ==, 0); + return (packed); +} + +/*ARGSUSED*/ +void +fnvlist_pack_free(char *pack, size_t size) +{ +#ifdef _KERNEL + kmem_free(pack, size); +#else + free(pack); +#endif +} + +nvlist_t * +fnvlist_unpack(char *buf, size_t buflen) +{ + nvlist_t *rv; + VERIFY3U(nvlist_unpack(buf, buflen, &rv, KM_SLEEP), ==, 0); + return (rv); +} + +nvlist_t * +fnvlist_dup(nvlist_t *nvl) +{ + nvlist_t *rv; + VERIFY3U(nvlist_dup(nvl, &rv, KM_SLEEP), ==, 0); + return (rv); +} + +void +fnvlist_merge(nvlist_t *dst, nvlist_t *src) +{ + VERIFY3U(nvlist_merge(dst, src, KM_SLEEP), ==, 0); +} + +void +fnvlist_add_boolean(nvlist_t *nvl, const char *name) +{ + VERIFY3U(nvlist_add_boolean(nvl, name), ==, 0); +} + +void +fnvlist_add_boolean_value(nvlist_t *nvl, const char *name, boolean_t val) +{ + VERIFY3U(nvlist_add_boolean_value(nvl, name, val), ==, 0); +} + +void +fnvlist_add_byte(nvlist_t *nvl, const char *name, uchar_t val) +{ + VERIFY3U(nvlist_add_byte(nvl, name, val), ==, 0); +} + +void +fnvlist_add_int8(nvlist_t *nvl, const char *name, int8_t val) +{ + VERIFY3U(nvlist_add_int8(nvl, name, val), ==, 0); +} + +void +fnvlist_add_uint8(nvlist_t *nvl, const char *name, uint8_t val) +{ + VERIFY3U(nvlist_add_uint8(nvl, name, val), ==, 0); +} + +void +fnvlist_add_int16(nvlist_t *nvl, const char *name, int16_t val) +{ + VERIFY3U(nvlist_add_int16(nvl, name, val), ==, 0); +} + +void +fnvlist_add_uint16(nvlist_t *nvl, const char *name, uint16_t val) +{ + VERIFY3U(nvlist_add_uint16(nvl, name, val), ==, 0); +} + +void +fnvlist_add_int32(nvlist_t *nvl, const char *name, int32_t val) +{ + VERIFY3U(nvlist_add_int32(nvl, name, val), ==, 0); +} + +void +fnvlist_add_uint32(nvlist_t *nvl, const char *name, uint32_t val) +{ + VERIFY3U(nvlist_add_uint32(nvl, name, val), ==, 0); +} + +void +fnvlist_add_int64(nvlist_t *nvl, const char *name, int64_t val) +{ + VERIFY3U(nvlist_add_int64(nvl, name, val), ==, 0); +} + +void +fnvlist_add_uint64(nvlist_t *nvl, const char *name, uint64_t val) +{ + VERIFY3U(nvlist_add_uint64(nvl, name, val), ==, 0); +} + +void +fnvlist_add_string(nvlist_t *nvl, const char *name, const char *val) +{ + VERIFY3U(nvlist_add_string(nvl, name, val), ==, 0); +} + +void +fnvlist_add_nvlist(nvlist_t *nvl, const char *name, nvlist_t *val) +{ + VERIFY3U(nvlist_add_nvlist(nvl, name, val), ==, 0); +} + +void +fnvlist_add_nvpair(nvlist_t *nvl, nvpair_t *pair) +{ + VERIFY3U(nvlist_add_nvpair(nvl, pair), ==, 0); +} + +void +fnvlist_add_boolean_array(nvlist_t *nvl, const char *name, + boolean_t *val, uint_t n) +{ + VERIFY3U(nvlist_add_boolean_array(nvl, name, val, n), ==, 0); +} + +void +fnvlist_add_byte_array(nvlist_t *nvl, const char *name, uchar_t *val, uint_t n) +{ + VERIFY3U(nvlist_add_byte_array(nvl, name, val, n), ==, 0); +} + +void +fnvlist_add_int8_array(nvlist_t *nvl, const char *name, int8_t *val, uint_t n) +{ + VERIFY3U(nvlist_add_int8_array(nvl, name, val, n), ==, 0); +} + +void +fnvlist_add_uint8_array(nvlist_t *nvl, const char *name, uint8_t *val, uint_t n) +{ + VERIFY3U(nvlist_add_uint8_array(nvl, name, val, n), ==, 0); +} + +void +fnvlist_add_int16_array(nvlist_t *nvl, const char *name, int16_t *val, uint_t n) +{ + VERIFY3U(nvlist_add_int16_array(nvl, name, val, n), ==, 0); +} + +void +fnvlist_add_uint16_array(nvlist_t *nvl, const char *name, + uint16_t *val, uint_t n) +{ + VERIFY3U(nvlist_add_uint16_array(nvl, name, val, n), ==, 0); +} + +void +fnvlist_add_int32_array(nvlist_t *nvl, const char *name, int32_t *val, uint_t n) +{ + VERIFY3U(nvlist_add_int32_array(nvl, name, val, n), ==, 0); +} + +void +fnvlist_add_uint32_array(nvlist_t *nvl, const char *name, + uint32_t *val, uint_t n) +{ + VERIFY3U(nvlist_add_uint32_array(nvl, name, val, n), ==, 0); +} + +void +fnvlist_add_int64_array(nvlist_t *nvl, const char *name, int64_t *val, uint_t n) +{ + VERIFY3U(nvlist_add_int64_array(nvl, name, val, n), ==, 0); +} + +void +fnvlist_add_uint64_array(nvlist_t *nvl, const char *name, + uint64_t *val, uint_t n) +{ + VERIFY3U(nvlist_add_uint64_array(nvl, name, val, n), ==, 0); +} + +void +fnvlist_add_string_array(nvlist_t *nvl, const char *name, + char * const *val, uint_t n) +{ + VERIFY3U(nvlist_add_string_array(nvl, name, val, n), ==, 0); +} + +void +fnvlist_add_nvlist_array(nvlist_t *nvl, const char *name, + nvlist_t **val, uint_t n) +{ + VERIFY3U(nvlist_add_nvlist_array(nvl, name, val, n), ==, 0); +} + +void +fnvlist_remove(nvlist_t *nvl, const char *name) +{ + VERIFY3U(nvlist_remove_all(nvl, name), ==, 0); +} + +void +fnvlist_remove_nvpair(nvlist_t *nvl, nvpair_t *pair) +{ + VERIFY3U(nvlist_remove_nvpair(nvl, pair), ==, 0); +} + +nvpair_t * +fnvlist_lookup_nvpair(nvlist_t *nvl, const char *name) +{ + nvpair_t *rv; + VERIFY3U(nvlist_lookup_nvpair(nvl, name, &rv), ==, 0); + return (rv); +} + +/* returns B_TRUE if the entry exists */ +boolean_t +fnvlist_lookup_boolean(nvlist_t *nvl, const char *name) +{ + return (nvlist_lookup_boolean(nvl, name) == 0); +} + +boolean_t +fnvlist_lookup_boolean_value(nvlist_t *nvl, const char *name) +{ + boolean_t rv; + VERIFY3U(nvlist_lookup_boolean_value(nvl, name, &rv), ==, 0); + return (rv); +} + +uchar_t +fnvlist_lookup_byte(nvlist_t *nvl, const char *name) +{ + uchar_t rv; + VERIFY3U(nvlist_lookup_byte(nvl, name, &rv), ==, 0); + return (rv); +} + +int8_t +fnvlist_lookup_int8(nvlist_t *nvl, const char *name) +{ + int8_t rv; + VERIFY3U(nvlist_lookup_int8(nvl, name, &rv), ==, 0); + return (rv); +} + +int16_t +fnvlist_lookup_int16(nvlist_t *nvl, const char *name) +{ + int16_t rv; + VERIFY3U(nvlist_lookup_int16(nvl, name, &rv), ==, 0); + return (rv); +} + +int32_t +fnvlist_lookup_int32(nvlist_t *nvl, const char *name) +{ + int32_t rv; + VERIFY3U(nvlist_lookup_int32(nvl, name, &rv), ==, 0); + return (rv); +} + +int64_t +fnvlist_lookup_int64(nvlist_t *nvl, const char *name) +{ + int64_t rv; + VERIFY3U(nvlist_lookup_int64(nvl, name, &rv), ==, 0); + return (rv); +} + +uint8_t +fnvlist_lookup_uint8_t(nvlist_t *nvl, const char *name) +{ + uint8_t rv; + VERIFY3U(nvlist_lookup_uint8(nvl, name, &rv), ==, 0); + return (rv); +} + +uint16_t +fnvlist_lookup_uint16(nvlist_t *nvl, const char *name) +{ + uint16_t rv; + VERIFY3U(nvlist_lookup_uint16(nvl, name, &rv), ==, 0); + return (rv); +} + +uint32_t +fnvlist_lookup_uint32(nvlist_t *nvl, const char *name) +{ + uint32_t rv; + VERIFY3U(nvlist_lookup_uint32(nvl, name, &rv), ==, 0); + return (rv); +} + +uint64_t +fnvlist_lookup_uint64(nvlist_t *nvl, const char *name) +{ + uint64_t rv; + VERIFY3U(nvlist_lookup_uint64(nvl, name, &rv), ==, 0); + return (rv); +} + +char * +fnvlist_lookup_string(nvlist_t *nvl, const char *name) +{ + char *rv; + VERIFY3U(nvlist_lookup_string(nvl, name, &rv), ==, 0); + return (rv); +} + +nvlist_t * +fnvlist_lookup_nvlist(nvlist_t *nvl, const char *name) +{ + nvlist_t *rv; + VERIFY3U(nvlist_lookup_nvlist(nvl, name, &rv), ==, 0); + return (rv); +} + +boolean_t +fnvpair_value_boolean_value(nvpair_t *nvp) +{ + boolean_t rv; + VERIFY3U(nvpair_value_boolean_value(nvp, &rv), ==, 0); + return (rv); +} + +uchar_t +fnvpair_value_byte(nvpair_t *nvp) +{ + uchar_t rv; + VERIFY3U(nvpair_value_byte(nvp, &rv), ==, 0); + return (rv); +} + +int8_t +fnvpair_value_int8(nvpair_t *nvp) +{ + int8_t rv; + VERIFY3U(nvpair_value_int8(nvp, &rv), ==, 0); + return (rv); +} + +int16_t +fnvpair_value_int16(nvpair_t *nvp) +{ + int16_t rv; + VERIFY3U(nvpair_value_int16(nvp, &rv), ==, 0); + return (rv); +} + +int32_t +fnvpair_value_int32(nvpair_t *nvp) +{ + int32_t rv; + VERIFY3U(nvpair_value_int32(nvp, &rv), ==, 0); + return (rv); +} + +int64_t +fnvpair_value_int64(nvpair_t *nvp) +{ + int64_t rv; + VERIFY3U(nvpair_value_int64(nvp, &rv), ==, 0); + return (rv); +} + +uint8_t +fnvpair_value_uint8_t(nvpair_t *nvp) +{ + uint8_t rv; + VERIFY3U(nvpair_value_uint8(nvp, &rv), ==, 0); + return (rv); +} + +uint16_t +fnvpair_value_uint16(nvpair_t *nvp) +{ + uint16_t rv; + VERIFY3U(nvpair_value_uint16(nvp, &rv), ==, 0); + return (rv); +} + +uint32_t +fnvpair_value_uint32(nvpair_t *nvp) +{ + uint32_t rv; + VERIFY3U(nvpair_value_uint32(nvp, &rv), ==, 0); + return (rv); +} + +uint64_t +fnvpair_value_uint64(nvpair_t *nvp) +{ + uint64_t rv; + VERIFY3U(nvpair_value_uint64(nvp, &rv), ==, 0); + return (rv); +} + +char * +fnvpair_value_string(nvpair_t *nvp) +{ + char *rv; + VERIFY3U(nvpair_value_string(nvp, &rv), ==, 0); + return (rv); +} + +nvlist_t * +fnvpair_value_nvlist(nvpair_t *nvp) +{ + nvlist_t *rv; + VERIFY3U(nvpair_value_nvlist(nvp, &rv), ==, 0); + return (rv); +} Added: vendor-sys/illumos/dist/common/zfs/zfeature_common.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/illumos/dist/common/zfs/zfeature_common.c Wed Jul 18 09:10:54 2012 (r238575) @@ -0,0 +1,156 @@ +/* + * CDDL HEADER START + * + * 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] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +#ifdef _KERNEL +#include +#else +#include +#include +#endif +#include +#include +#include +#include +#include "zfeature_common.h" + +/* + * Set to disable all feature checks while opening pools, allowing pools with + * unsupported features to be opened. Set for testing only. + */ +boolean_t zfeature_checks_disable = B_FALSE; + +zfeature_info_t spa_feature_table[SPA_FEATURES]; + +/* + * Valid characters for feature guids. This list is mainly for aesthetic + * purposes and could be expanded in the future. There are different allowed + * characters in the guids reverse dns portion (before the colon) and its + * short name (after the colon). + */ +static int +valid_char(char c, boolean_t after_colon) +{ + return ((c >= 'a' && c <= 'z') || + (c >= '0' && c <= '9') || + c == (after_colon ? '_' : '.')); +} + +/* + * Every feature guid must contain exactly one colon which separates a reverse + * dns organization name from the feature's "short" name (e.g. + * "com.company:feature_name"). + */ +boolean_t +zfeature_is_valid_guid(const char *name) +{ + int i; + boolean_t has_colon = B_FALSE; + + i = 0; + while (name[i] != '\0') { + char c = name[i++]; + if (c == ':') { + if (has_colon) + return (B_FALSE); + has_colon = B_TRUE; + continue; + } + if (!valid_char(c, has_colon)) + return (B_FALSE); + } + + return (has_colon); +} + +boolean_t +zfeature_is_supported(const char *guid) +{ + if (zfeature_checks_disable) + return (B_TRUE); + + return (0 == zfeature_lookup_guid(guid, NULL)); +} + +int +zfeature_lookup_guid(const char *guid, zfeature_info_t **res) +{ + for (int i = 0; i < SPA_FEATURES; i++) { + zfeature_info_t *feature = &spa_feature_table[i]; + if (strcmp(guid, feature->fi_guid) == 0) { + if (res != NULL) + *res = feature; + return (0); + } + } + + return (ENOENT); +} + +int +zfeature_lookup_name(const char *name, zfeature_info_t **res) +{ + for (int i = 0; i < SPA_FEATURES; i++) { + zfeature_info_t *feature = &spa_feature_table[i]; + if (strcmp(name, feature->fi_uname) == 0) { + if (res != NULL) + *res = feature; + return (0); + } + } + + return (ENOENT); +} + +static void +zfeature_register(int fid, const char *guid, const char *name, const char *desc, + boolean_t readonly, boolean_t mos, zfeature_info_t **deps) +{ + zfeature_info_t *feature = &spa_feature_table[fid]; + static zfeature_info_t *nodeps[] = { NULL }; + + ASSERT(name != NULL); + ASSERT(desc != NULL); + ASSERT(!readonly || !mos); + ASSERT3U(fid, <, SPA_FEATURES); + ASSERT(zfeature_is_valid_guid(guid)); + + if (deps == NULL) + deps = nodeps; + + feature->fi_guid = guid; + feature->fi_uname = name; + feature->fi_desc = desc; + feature->fi_can_readonly = readonly; + feature->fi_mos = mos; + feature->fi_depends = deps; +} + +void +zpool_feature_init(void) +{ + zfeature_register(SPA_FEATURE_ASYNC_DESTROY, + "com.delphix:async_destroy", "async_destroy", + "Destroy filesystems asynchronously.", B_TRUE, B_FALSE, NULL); +} Added: vendor-sys/illumos/dist/common/zfs/zfeature_common.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/illumos/dist/common/zfs/zfeature_common.h Wed Jul 18 09:10:54 2012 (r238575) @@ -0,0 +1,71 @@ +/* + * CDDL HEADER START + * + * 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] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +#ifndef _ZFEATURE_COMMON_H +#define _ZFEATURE_COMMON_H + +#include +#include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 09:15:59 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74F8A1065673; Wed, 18 Jul 2012 09:15:59 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 474C08FC0A; Wed, 18 Jul 2012 09:15:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I9FxKS049612; Wed, 18 Jul 2012 09:15:59 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I9FxeZ049611; Wed, 18 Jul 2012 09:15:59 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207180915.q6I9FxeZ049611@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 09:15:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238576 - vendor/illumos/dist X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 09:15:59 -0000 Author: mm Date: Wed Jul 18 09:15:58 2012 New Revision: 238576 URL: http://svn.freebsd.org/changeset/base/238576 Log: Remove vendor/illumos/dist for repopulation from latest vendor/opensolaris Deleted: vendor/illumos/dist/ From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 09:16:47 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DADF1065672; Wed, 18 Jul 2012 09:16:47 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70B528FC1D; Wed, 18 Jul 2012 09:16:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I9Glla049736; Wed, 18 Jul 2012 09:16:47 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I9GlfO049735; Wed, 18 Jul 2012 09:16:47 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207180916.q6I9GlfO049735@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 09:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238577 - vendor/illumos/dist X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 09:16:47 -0000 Author: mm Date: Wed Jul 18 09:16:47 2012 New Revision: 238577 URL: http://svn.freebsd.org/changeset/base/238577 Log: Copy vendor/opensolaris/dist to vendor/illumos/dist Added: vendor/illumos/dist/ - copied from r238566, vendor/opensolaris/dist/ From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 09:37:59 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE4E7106566B; Wed, 18 Jul 2012 09:37:59 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B05A28FC15; Wed, 18 Jul 2012 09:37:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I9bxLU051453; Wed, 18 Jul 2012 09:37:59 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I9bxfW051451; Wed, 18 Jul 2012 09:37:59 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207180937.q6I9bxfW051451@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 09:37:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238579 - vendor/illumos/20100818 X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 09:38:00 -0000 Author: mm Date: Wed Jul 18 09:37:59 2012 New Revision: 238579 URL: http://svn.freebsd.org/changeset/base/238579 Log: Tag initial vendor/illumos/dist as 20100818 Added: vendor/illumos/20100818/ - copied from r238578, vendor/illumos/dist/ From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 09:47:48 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8CBB5106566B; Wed, 18 Jul 2012 09:47:48 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 74E1F8FC0A; Wed, 18 Jul 2012 09:47:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I9lmtJ052201; Wed, 18 Jul 2012 09:47:48 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I9lmU9052199; Wed, 18 Jul 2012 09:47:48 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207180947.q6I9lmU9052199@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 09:47:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238580 - in vendor/illumos/dist: cmd/dtrace man man/man1m X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 09:47:48 -0000 Author: mm Date: Wed Jul 18 09:47:48 2012 New Revision: 238580 URL: http://svn.freebsd.org/changeset/base/238580 Log: Move dtrace manual page to new vendor location Added: vendor/illumos/dist/man/ vendor/illumos/dist/man/man1m/ vendor/illumos/dist/man/man1m/dtrace.1m - copied unchanged from r238578, vendor/illumos/dist/cmd/dtrace/dtrace.1 Deleted: vendor/illumos/dist/cmd/dtrace/dtrace.1 Copied: vendor/illumos/dist/man/man1m/dtrace.1m (from r238578, vendor/illumos/dist/cmd/dtrace/dtrace.1) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/man/man1m/dtrace.1m Wed Jul 18 09:47:48 2012 (r238580, copy of r238578, vendor/illumos/dist/cmd/dtrace/dtrace.1) @@ -0,0 +1,670 @@ +'\" te +.\" CDDL HEADER START +.\" +.\" 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] +.\" +.\" CDDL HEADER END +.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved. +.TH dtrace 1M "5 Sep 2006" "SunOS 5.11" "System Administration Commands" +.SH NAME +dtrace \- DTrace dynamic tracing compiler and tracing utility +.SH SYNOPSIS +.LP +.nf +\fBdtrace\fR [\fB-32\fR | \fB-64\fR] [\fB-aACeFGHhlqSvVwZ\fR] [\fB-b\fR \fIbufsz\fR] [\fB-c\fR \fIcmd\fR] + [\fB-D\fR \fIname\fR [\fI=value\fR]] [\fB-I\fR \fIpath\fR] [\fB-L\fR \fIpath\fR] [\fB-o\fR \fIoutput\fR] + [\fB-s\fR \fIscript\fR] [\fB-U\fR \fIname\fR] [\fB-x\fR \fIarg\fR [\fI=val\fR]] + [\fB-X\fR a | c | s | t] [\fB-p\fR \fIpid\fR] + [\fB-P\fR \fIprovider\fR [[\fIpredicate\fR] \fIaction\fR]] + [\fB-m\fR [\fIprovider:\fR] \fImodule\fR [[\fIpredicate\fR] \fIaction\fR]] + [\fB-f\fR [[\fIprovider:\fR] \fImodule:\fR] \fIfunction\fR [[\fIpredicate\fR] \fIaction\fR]] + [\fB-n\fR [[[\fIprovider:\fR] \fImodule:\fR] \fIfunction:\fR] \fIname\fR [[\fIpredicate\fR] \fIaction\fR]] + [\fB-i\fR \fIprobe-id\fR [[\fIpredicate\fR] \fIaction\fR]] +.fi + +.SH DESCRIPTION +.sp +.LP +DTrace is a comprehensive dynamic tracing framework for the Solaris Operating System. DTrace provides a powerful infrastructure that permits administrators, developers, and service personnel to concisely answer arbitrary questions about the behavior of the operating system and user programs. +.sp +.LP +The \fISolaris Dynamic Tracing Guide\fR describes how to use DTrace to observe, debug, and tune system behavior. Refer to this book for a detailed description of DTrace features, including the bundled DTrace observability +tools, instrumentation providers, and the D programming language. +.sp +.LP +The \fBdtrace\fR command provides a generic interface to the essential services provided by the DTrace facility, including: +.RS +4 +.TP +.ie t \(bu +.el o +Options that list the set of probes and providers currently published by DTrace +.RE +.RS +4 +.TP +.ie t \(bu +.el o +Options that enable probes directly using any of the probe description specifiers (provider, module, function, name) +.RE +.RS +4 +.TP +.ie t \(bu +.el o +Options that run the D compiler and compile one or more D program files or programs written directly on the command line +.RE +.RS +4 +.TP +.ie t \(bu +.el o +Options that generate anonymous tracing programs +.RE +.RS +4 +.TP +.ie t \(bu +.el o +Options that generate program stability reports +.RE +.RS +4 +.TP +.ie t \(bu +.el o +Options that modify DTrace tracing and buffering behavior and enable additional D compiler features +.RE +.sp +.LP +You can use \fBdtrace\fR to create D scripts by using it in a \fB#!\fR declaration to create an interpreter file. You can also use \fBdtrace\fR to attempt to compile D programs and determine their properties without actually enabling tracing using the \fB-e\fR option. See \fBOPTIONS\fR. See the \fISolaris Dynamic Tracing Guide\fR for detailed examples of how to use the \fBdtrace\fR utility to perform these tasks. +.SH OPTIONS +.sp +.LP +The arguments accepted by the \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, and \fB-i\fR options can include an optional D language \fIpredicate\fR enclosed in slashes \fB//\fR and optional D language \fIaction\fR statement list enclosed in braces \fB{}\fR. D program code specified on the command line must be appropriately quoted to avoid intepretation of meta-characters by the shell. +.sp +.LP +The following options are supported: +.sp +.ne 2 +.mk +.na +\fB\fB-32\fR | \fB-64\fR\fR +.ad +.sp .6 +.RS 4n +The D compiler produces programs using the native data model of the operating system kernel. You can use the \fBisainfo\fR \fB-b\fR command to determine the current operating system data model. If the \fB-32\fR option is specified, \fBdtrace\fR forces +the D compiler to compile a D program using the 32-bit data model. If the \fB-64\fR option is specified, \fBdtrace\fR forces the D compiler to compile a D program using the 64-bit data model. These options are typically not required as \fBdtrace\fR selects the +native data model as the default. The data model affects the sizes of integer types and other language properties. D programs compiled for either data model can be executed on both 32-bit and 64-bit kernels. The \fB-32\fR and \fB-64\fR options also determine the ELF file format +(ELF32 or ELF64) produced by the \fB-G\fR option. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-a\fR\fR +.ad +.sp .6 +.RS 4n +Claim anonymous tracing state and display the traced data. You can combine the \fB-a\fR option with the \fB-e\fR option to force \fBdtrace\fR to exit immediately after consuming the anonymous tracing state rather than continuing to wait for new +data. See the \fISolaris Dynamic Tracing Guide\fR for more information about anonymous tracing. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-A\fR\fR +.ad +.sp .6 +.RS 4n +Generate \fBdriver.conf\fR(4) directives for anonymous tracing. This option constructs a set of \fBdtrace\fR(7D) configuration file directives to enable the specified probes for anonymous tracing and then exits. By default, \fBdtrace\fR attempts to store the directives to the file \fB/kernel/drv/dtrace.conf\fR. You can modify this behavior if you use the \fB-o\fR option to specify an alternate output file. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-b\fR \fIbufsz\fR\fR +.ad +.sp .6 +.RS 4n +Set principal trace buffer size (\fIbufsz\fR). The trace buffer size can include any of the size suffixes \fBk\fR, \fBm\fR, \fBg\fR, or \fBt\fR. If the buffer space cannot be allocated, \fBdtrace\fR attempts +to reduce the buffer size or exit depending on the setting of the \fBbufresize\fR property. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-c\fR \fIcmd\fR\fR +.ad +.sp .6 +.RS 4n +Run the specified command \fIcmd\fR and exit upon its completion. If more than one \fB-c\fR option is present on the command line, \fBdtrace\fR exits when all commands have exited, reporting the exit status for each child process as it +terminates. The process-ID of the first command is made available to any D programs specified on the command line or using the \fB-s\fR option through the \fB$target\fR macro variable. Refer to the \fISolaris Dynamic Tracing Guide\fR for more information +on macro variables. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-C\fR\fR +.ad +.sp .6 +.RS 4n +Run the C preprocessor \fBcpp\fR(1) over D programs before compiling them. You can pass options to the C preprocessor using the \fB-D\fR, \fB-U\fR, \fB-I\fR, and \fB-H\fR options. You can select the degree of C standard conformance if you use the \fB-X\fR option. For a description of the set of tokens defined by the D compiler when invoking the C preprocessor, see \fB-X\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-D\fR \fIname\fR \fB[=\fR\fIvalue\fR\fB]\fR\fR +.ad +.sp .6 +.RS 4n +Define \fIname\fR when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). If you specify the equals sign (\fB=\fR) +and additional \fIvalue\fR, the name is assigned the corresponding value. This option passes the \fB-D\fR option to each \fBcpp\fR invocation. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-e\fR\fR +.ad +.sp .6 +.RS 4n +Exit after compiling any requests and consuming anonymous tracing state (\fB-a\fR option) but prior to enabling any probes. You can combine this option with the \fB-a\fR option to print anonymous tracing data and exit. You can also combine this option with D +compiler options. This combination verifies that the programs compile without actually executing them and enabling the corresponding instrumentation. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-f\fR\fB[[\fR\fIprovider\fR\fB:]\fR\fImodule\fR\fB:]\fR\fIfunction\fR\fB[[\fR\fIpredicate\fR\fB]\fR\fIaction\fR\fB]]\fR\fR +.ad +.sp .6 +.RS 4n +Specify function name to trace or list (\fB-l\fR option). The corresponding argument can include any of the probe description forms \fIprovider:module:function\fR, \fImodule:function\fR, or \fIfunction\fR. +Unspecified probe description fields are left blank and match any probes regardless of the values in those fields. If no qualifiers other than \fIfunction\fR are specified in the description, all probes with the corresponding \fIfunction\fR are matched. +The \fB-f\fR argument can be suffixed with an optional D probe clause. You can specify more than one \fB-f\fR option on the command line at a time. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-F\fR\fR +.ad +.sp .6 +.RS 4n +Coalesce trace output by identifying function entry and return. Function entry probe reports are indented and their output is prefixed with \fB->\fR. Function return probe reports are unindented and their output is prefixed with \fB<-\fR\&. System call +entry probe reports are indented and their output is prefixed with \fB=>\fR. System call return probe reports are unindented and their output is prefixed with \fB<=\fR\&. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-G\fR\fR +.ad +.sp .6 +.RS 4n +Generate an ELF file containing an embedded DTrace program. The DTrace probes specified in the program are saved inside of a relocatable ELF object which can be linked into another program. If the \fB-o\fR option is present, the ELF file is saved using the pathname specified +as the argument for this operand. If the \fB-o\fR option is not present and the DTrace program is contained with a file whose name is \fB\fIfilename\fR.d\fR, then the ELF file is saved using the name \fB\fIfilename\fR.o\fR. +Otherwise the ELF file is saved using the name \fBd.out\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-H\fR\fR +.ad +.sp .6 +.RS 4n +Print the pathnames of included files when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). This option passes the \fB-H\fR option +to each \fBcpp\fR invocation, causing it to display the list of pathnames, one for each line, to \fBstderr\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-h\fR\fR +.ad +.sp .6 +.RS 4n +Generate a header file containing macros that correspond to probes in the specified provider definitions. This option should be used to generate a header file that is included by other source files for later use with the \fB-G\fR option. If the \fB-o\fR option +is present, the header file is saved using the pathname specified as the argument for that option. If the \fB-o\fR option is not present and the DTrace program is contained with a file whose name is \fIfilename\fR\fB\&.d\fR, then the header file is saved +using the name \fIfilename\fR\fB\&.h\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-i\fR \fIprobe-id\fR\fB[[\fR\fIpredicate\fR] \fIaction\fR\fB]\fR\fR +.ad +.sp .6 +.RS 4n +Specify probe identifier (\fIprobe-id\fR) to trace or list (\fB-l\fR option). You can specify probe IDs using decimal integers as shown by \fBdtrace\fR \fB-l\fR. The \fB-i\fR argument can be suffixed with an optional +D probe clause. You can specify more than one \fB-i\fR option at a time. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-I\fR \fIpath\fR\fR +.ad +.sp .6 +.RS 4n +Add the specified directory \fIpath\fR to the search path for \fB#include\fR files when invoking \fBcpp\fR(1) (enabled +using the \fB-C\fR option). This option passes the \fB-I\fR option to each \fBcpp\fR invocation. The specified \fIpath\fR is inserted into the search path ahead of the default directory list. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-L\fR \fIpath\fR\fR +.ad +.sp .6 +.RS 4n +Add the specified directory \fIpath\fR to the search path for DTrace libraries. DTrace libraries are used to contain common definitions that can be used when writing D programs. The specified \fIpath\fR is added after the default library +search path. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-l\fR\fR +.ad +.sp .6 +.RS 4n +List probes instead of enabling them. If the \fB-l\fR option is specified, \fBdtrace\fR produces a report of the probes matching the descriptions given using the \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, \fB-i\fR, +and \fB-s\fR options. If none of these options are specified, this option lists all probes. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-m\fR [[\fIprovider:\fR] \fImodule:\fR [[\fIpredicate\fR] \fIaction\fR]]\fR +.ad +.sp .6 +.RS 4n +Specify module name to trace or list (\fB-l\fR option). The corresponding argument can include any of the probe description forms \fIprovider:module\fR or \fImodule\fR. Unspecified probe description fields are left blank and match +any probes regardless of the values in those fields. If no qualifiers other than \fImodule\fR are specified in the description, all probes with a corresponding \fImodule\fR are matched. The \fB-m\fR argument can be suffixed with an optional D +probe clause. More than one \fB-m\fR option can be specified on the command line at a time. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-n\fR [[[\fIprovider:\fR] \fImodule:\fR] \fIfunction:\fR] \fIname\fR [[\fIpredicate\fR] \fIaction\fR]\fR +.ad +.sp .6 +.RS 4n +Specify probe name to trace or list (\fB-l\fR option). The corresponding argument can include any of the probe description forms \fIprovider:module:function:name\fR, \fImodule:function:name\fR, \fIfunction:name\fR, +or \fIname\fR. Unspecified probe description fields are left blank and match any probes regardless of the values in those fields. If no qualifiers other than \fIname\fR are specified in the description, all probes with a corresponding \fIname\fR are +matched. The \fB-n\fR argument can be suffixed with an optional D probe clause. More than one \fB-n\fR option can be specified on the command line at a time. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-o\fR \fIoutput\fR\fR +.ad +.sp .6 +.RS 4n +Specify the \fIoutput\fR file for the \fB-A\fR , \fB-G\fR, and \fB-l\fR options, or for the traced data itself. If the \fB-A\fR option is present and \fB-o\fR is not present, the default output file is \fB/kernel/drv/dtrace.conf\fR. If the \fB-G\fR option is present and the \fB-s\fR option's argument is of the form \fB\fIfilename\fR.d\fR and \fB-o\fR is not present, the default output file is \fB\fIfilename\fR.o\fR. +Otherwise the default output file is \fBd.out\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-p\fR \fIpid\fR\fR +.ad +.sp .6 +.RS 4n +Grab the specified process-ID \fIpid\fR, cache its symbol tables, and exit upon its completion. If more than one \fB-p\fR option is present on the command line, \fBdtrace\fR exits when all commands have exited, reporting the exit status +for each process as it terminates. The first process-ID is made available to any D programs specified on the command line or using the \fB-s\fR option through the \fB$target\fR macro variable. Refer to the \fISolaris Dynamic Tracing Guide\fR for +more information on macro variables. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-P\fR \fIprovider\fR \fB[[\fR\fIpredicate\fR\fB]\fR \fIaction\fR]\fR +.ad +.sp .6 +.RS 4n +Specify provider name to trace or list (\fB-l\fR option). The remaining probe description fields module, function, and name are left blank and match any probes regardless of the values in those fields. The \fB-P\fR argument can be suffixed with an optional D +probe clause. You can specify more than one \fB-P\fR option on the command line at a time. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-q\fR\fR +.ad +.sp .6 +.RS 4n +Set quiet mode. \fBdtrace\fR suppresses messages such as the number of probes matched by the specified options and D programs and does not print column headers, the CPU ID, the probe ID, or insert newlines into the output. Only data traced and formatted by D program +statements such as \fBtrace()\fR and \fBprintf()\fR is displayed to \fBstdout\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-s\fR\fR +.ad +.sp .6 +.RS 4n +Compile the specified D program source file. If the \fB-e\fR option is present, the program is compiled but instrumentation is not enabled. If the \fB-l\fR option is present, the program is compiled and the set of probes matched by it is listed, but instrumentation +is not enabled. If none of \fB-e\fR, \fB-l\fR, \fB-G\fR, or \fB-A\fR are present, the instrumentation specified by the D program is enabled and tracing begins. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-S\fR\fR +.ad +.sp .6 +.RS 4n +Show D compiler intermediate code. The D compiler produces a report of the intermediate code generated for each D program to \fBstderr\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-U\fR \fIname\fR\fR +.ad +.sp .6 +.RS 4n +Undefine the specified \fIname\fR when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). This option passes the \fB-U\fR option to each \fBcpp\fR invocation. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-v\fR\fR +.ad +.sp .6 +.RS 4n +Set verbose mode. If the \fB-v\fR option is specified, \fBdtrace\fR produces a program stability report showing the minimum interface stability and dependency level for the specified D programs. DTrace stability levels are explained in further detail in the \fISolaris Dynamic Tracing Guide\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-V\fR\fR +.ad +.sp .6 +.RS 4n +Report the highest D programming interface version supported by \fBdtrace\fR. The version information is printed to \fBstdout\fR and the \fBdtrace\fR command exits. Refer to the \fISolaris Dynamic Tracing Guide\fR for +more information about DTrace versioning features. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-w\fR\fR +.ad +.sp .6 +.RS 4n +Permit destructive actions in D programs specified using the \fB-s\fR, \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, or \fB-i\fR options. If the \fB-w\fR option is not specified, \fBdtrace\fR does not +permit the compilation or enabling of a D program that contains destructive actions. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-x\fR \fIarg\fR [\fI=val\fR]\fR +.ad +.sp .6 +.RS 4n +Enable or modify a DTrace runtime option or D compiler option. The list of options is found in the \fISolaris Dynamic Tracing Guide\fR. Boolean options are enabled by specifying their name. Options with values are set by separating the option name and +value with an equals sign (\fB=\fR). +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-X\fR \fBa | c | s | t\fR\fR +.ad +.sp .6 +.RS 4n +Specify the degree of conformance to the ISO C standard that should be selected when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). +The \fB-X\fR option argument affects the value and presence of the \fB__STDC__\fR macro depending upon the value of the argument letter. +.sp +The \fB-X\fR option supports the following arguments: +.sp +.ne 2 +.mk +.na +\fB\fBa\fR\fR +.ad +.RS 5n +.rt +Default. ISO C plus K&R compatibility extensions, with semantic changes required by ISO C. This is the default mode if \fB-X\fR is not specified. The predefined macro \fB__STDC__\fR has a value of 0 when \fBcpp\fR is invoked in conjunction +with the \fB-Xa\fR option. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBc\fR\fR +.ad +.RS 5n +.rt +Conformance. Strictly conformant ISO C, without K&R C compatibility extensions. The predefined macro \fB__STDC__\fR has a value of 1 when \fBcpp\fR is invoked in conjunction with the \fB-Xc\fR option. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBs\fR\fR +.ad +.RS 5n +.rt +K&R C only. The macro \fB__STDC__\fR is not defined when \fBcpp\fR is invoked in conjunction with the \fB-Xs\fR option. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBt\fR\fR +.ad +.RS 5n +.rt +Transition. ISO C plus K&R C compatibility extensions, without semantic changes required by ISO C. The predefined macro \fB__STDC__\fR has a value of 0 when \fBcpp\fR is invoked in conjunction with the \fB-Xt\fR option. +.RE + +As the \fB-X\fR option only affects how the D compiler invokes the C preprocessor, the \fB-Xa\fR and \fB-Xt\fR options are equivalent from the perspective of D and both are provided only to ease re-use of settings from a C build environment. +.sp +Regardless of the \fB-X\fR mode, the following additional C preprocessor definitions are always specified and valid in all modes: +.RS +4 +.TP +.ie t \(bu +.el o +\fB__sun\fR +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__unix\fR +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__SVR4\fR +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__sparc\fR (on SPARC systems only) +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__sparcv9\fR (on SPARC systems only when 64-bit programs are compiled) +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__i386\fR (on x86 systems only when 32-bit programs are compiled) +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__amd64\fR (on x86 systems only when 64-bit programs are compiled) +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__\fI`uname -s`\fR_\fI`uname -r`\fR\fR (for example, \fB__SunOS_5_10\fR) +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__SUNW_D=1\fR +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__SUNW_D_VERSION=0x\fIMMmmmuuu\fR\fR +.sp +Where \fIMM\fR is the major release value in hexadecimal, \fImmm\fR is the minor release value in hexadecimal, and \fIuuu\fR is the +micro release value in hexadecimal. Refer to the \fISolaris Dynamic Tracing Guide\fR for more information about DTrace versioning. +.RE +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-Z\fR\fR +.ad +.sp .6 +.RS 4n +Permit probe descriptions that match zero probes. If the \fB-Z\fR option is not specified, \fBdtrace\fR reports an error and exits if any probe descriptions specified in D program files (\fB-s\fR option) or on the command line (\fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, or \fB-i\fR options) contain descriptions that do not match any known probes. +.RE + +.SH OPERANDS +.sp +.LP +You can specify zero or more additional arguments on the \fBdtrace\fR command line to define a set of macro variables (\fB$1\fR, \fB$2\fR, and so forth). The additional arguments can be used in D programs specified using the \fB-s\fR option +or on the command line. The use of macro variables is described further in the \fISolaris Dynamic Tracing Guide\fR. +.SH EXIT STATUS +.sp +.LP +The following exit values are returned: +.sp +.ne 2 +.mk +.na +\fB0\fR +.ad +.RS 5n +.rt +Successful completion. +.sp +For D program requests, an exit status of \fB0\fR indicates that programs were successfully compiled, probes were successfully enabled, or anonymous state was successfully retrieved. \fBdtrace\fR returns \fB0\fR even if the specified tracing requests +encountered errors or drops. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB1\fR\fR +.ad +.RS 5n +.rt +An error occurred. +.sp +For D program requests, an exit status of \fB1\fR indicates that program compilation failed or that the specified request could not be satisfied. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB2\fR\fR +.ad +.RS 5n +.rt +Invalid command line options or arguments were specified. +.RE + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +AvailabilitySUNWdtrc +_ +Interface StabilitySee below. +.TE + +.sp +.LP +The command-line syntax is Committed. The human-readable output is Uncommitted. +.SH SEE ALSO +.sp +.LP +\fBcpp\fR(1), \fBisainfo\fR(1), \fBlibdtrace\fR(3LIB), \fBdriver.conf\fR(4), \fBattributes\fR(5), \fBdtrace\fR(7D) +.sp +.LP +\fISolaris Dynamic Tracing Guide\fR From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 09:53:21 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEE981065673; Wed, 18 Jul 2012 09:53:21 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97AF68FC12; Wed, 18 Jul 2012 09:53:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6I9rL0p052612; Wed, 18 Jul 2012 09:53:21 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6I9rLQF052608; Wed, 18 Jul 2012 09:53:21 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207180953.q6I9rLQF052608@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 09:53:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238581 - vendor/illumos/dist/man/man1m X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 09:53:21 -0000 Author: mm Date: Wed Jul 18 09:53:20 2012 New Revision: 238581 URL: http://svn.freebsd.org/changeset/base/238581 Log: Import relevant vendor manual pages from illumos-gate revision 13304:b54231762cfa Obtained from: ssh://anonhg@hg.illumos.org/illumos-gate Added: vendor/illumos/dist/man/man1m/lockstat.1m vendor/illumos/dist/man/man1m/plockstat.1m vendor/illumos/dist/man/man1m/zdb.1m vendor/illumos/dist/man/man1m/zfs.1m vendor/illumos/dist/man/man1m/zpool.1m vendor/illumos/dist/man/man1m/zstreamdump.1m Modified: vendor/illumos/dist/man/man1m/dtrace.1m Modified: vendor/illumos/dist/man/man1m/dtrace.1m ============================================================================== --- vendor/illumos/dist/man/man1m/dtrace.1m Wed Jul 18 09:47:48 2012 (r238580) +++ vendor/illumos/dist/man/man1m/dtrace.1m Wed Jul 18 09:53:20 2012 (r238581) @@ -1,51 +1,42 @@ '\" te -.\" CDDL HEADER START -.\" -.\" 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] -.\" -.\" CDDL HEADER END -.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved. -.TH dtrace 1M "5 Sep 2006" "SunOS 5.11" "System Administration Commands" +.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved. +.\" 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 dtrace 1M "4 Aug 2009" "SunOS 5.11" "System Administration Commands" .SH NAME dtrace \- DTrace dynamic tracing compiler and tracing utility .SH SYNOPSIS .LP .nf \fBdtrace\fR [\fB-32\fR | \fB-64\fR] [\fB-aACeFGHhlqSvVwZ\fR] [\fB-b\fR \fIbufsz\fR] [\fB-c\fR \fIcmd\fR] - [\fB-D\fR \fIname\fR [\fI=value\fR]] [\fB-I\fR \fIpath\fR] [\fB-L\fR \fIpath\fR] [\fB-o\fR \fIoutput\fR] - [\fB-s\fR \fIscript\fR] [\fB-U\fR \fIname\fR] [\fB-x\fR \fIarg\fR [\fI=val\fR]] - [\fB-X\fR a | c | s | t] [\fB-p\fR \fIpid\fR] - [\fB-P\fR \fIprovider\fR [[\fIpredicate\fR] \fIaction\fR]] - [\fB-m\fR [\fIprovider:\fR] \fImodule\fR [[\fIpredicate\fR] \fIaction\fR]] - [\fB-f\fR [[\fIprovider:\fR] \fImodule:\fR] \fIfunction\fR [[\fIpredicate\fR] \fIaction\fR]] - [\fB-n\fR [[[\fIprovider:\fR] \fImodule:\fR] \fIfunction:\fR] \fIname\fR [[\fIpredicate\fR] \fIaction\fR]] - [\fB-i\fR \fIprobe-id\fR [[\fIpredicate\fR] \fIaction\fR]] + [\fB-D\fR \fIname\fR [\fI=value\fR]] [\fB-I\fR \fIpath\fR] [\fB-L\fR \fIpath\fR] [\fB-o\fR \fIoutput\fR] + [\fB-s\fR \fIscript\fR] [\fB-U\fR \fIname\fR] [\fB-x\fR \fIarg\fR [\fI=val\fR]] + [\fB-X\fR a | c | s | t] [\fB-p\fR \fIpid\fR] + [\fB-P\fR \fIprovider\fR [[\fIpredicate\fR] \fIaction\fR]] + [\fB-m\fR [\fIprovider:\fR] \fImodule\fR [[\fIpredicate\fR] \fIaction\fR]] + [\fB-f\fR [[\fIprovider:\fR] \fImodule:\fR] \fIfunction\fR [[\fIpredicate\fR] \fIaction\fR]] + [\fB-n\fR [[[\fIprovider:\fR] \fImodule:\fR] \fIfunction:\fR] \fIname\fR [[\fIpredicate\fR] \fIaction\fR]] + [\fB-i\fR \fIprobe-id\fR [[\fIpredicate\fR] \fIaction\fR]] .fi .SH DESCRIPTION .sp .LP -DTrace is a comprehensive dynamic tracing framework for the Solaris Operating System. DTrace provides a powerful infrastructure that permits administrators, developers, and service personnel to concisely answer arbitrary questions about the behavior of the operating system and user programs. +DTrace is a comprehensive dynamic tracing framework for the Solaris Operating +System. DTrace provides a powerful infrastructure that permits administrators, +developers, and service personnel to concisely answer arbitrary questions about +the behavior of the operating system and user programs. .sp .LP -The \fISolaris Dynamic Tracing Guide\fR describes how to use DTrace to observe, debug, and tune system behavior. Refer to this book for a detailed description of DTrace features, including the bundled DTrace observability -tools, instrumentation providers, and the D programming language. +The \fISolaris Dynamic Tracing Guide\fR describes how to use DTrace to observe, +debug, and tune system behavior. Refer to this book for a detailed description +of DTrace features, including the bundled DTrace observability tools, +instrumentation providers, and the D programming language. .sp .LP -The \fBdtrace\fR command provides a generic interface to the essential services provided by the DTrace facility, including: +The \fBdtrace\fR command provides a generic interface to the essential services +provided by the DTrace facility, including: .RS +4 .TP .ie t \(bu @@ -56,13 +47,15 @@ Options that list the set of probes and .TP .ie t \(bu .el o -Options that enable probes directly using any of the probe description specifiers (provider, module, function, name) +Options that enable probes directly using any of the probe description +specifiers (provider, module, function, name) .RE .RS +4 .TP .ie t \(bu .el o -Options that run the D compiler and compile one or more D program files or programs written directly on the command line +Options that run the D compiler and compile one or more D program files or +programs written directly on the command line .RE .RS +4 .TP @@ -80,15 +73,25 @@ Options that generate program stability .TP .ie t \(bu .el o -Options that modify DTrace tracing and buffering behavior and enable additional D compiler features +Options that modify DTrace tracing and buffering behavior and enable additional +D compiler features .RE .sp .LP -You can use \fBdtrace\fR to create D scripts by using it in a \fB#!\fR declaration to create an interpreter file. You can also use \fBdtrace\fR to attempt to compile D programs and determine their properties without actually enabling tracing using the \fB-e\fR option. See \fBOPTIONS\fR. See the \fISolaris Dynamic Tracing Guide\fR for detailed examples of how to use the \fBdtrace\fR utility to perform these tasks. +You can use \fBdtrace\fR to create D scripts by using it in a \fB#!\fR +declaration to create an interpreter file. You can also use \fBdtrace\fR to +attempt to compile D programs and determine their properties without actually +enabling tracing using the \fB-e\fR option. See \fBOPTIONS\fR. See the +\fISolaris Dynamic Tracing Guide\fR for detailed examples of how to use the +\fBdtrace\fR utility to perform these tasks. .SH OPTIONS .sp .LP -The arguments accepted by the \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, and \fB-i\fR options can include an optional D language \fIpredicate\fR enclosed in slashes \fB//\fR and optional D language \fIaction\fR statement list enclosed in braces \fB{}\fR. D program code specified on the command line must be appropriately quoted to avoid intepretation of meta-characters by the shell. +The arguments accepted by the \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, and +\fB-i\fR options can include an optional D language \fIpredicate\fR enclosed in +slashes \fB//\fR and optional D language \fIaction\fR statement list enclosed +in braces \fB{}\fR. D program code specified on the command line must be +appropriately quoted to avoid interpretation of meta-characters by the shell. .sp .LP The following options are supported: @@ -100,10 +103,17 @@ The following options are supported: .ad .sp .6 .RS 4n -The D compiler produces programs using the native data model of the operating system kernel. You can use the \fBisainfo\fR \fB-b\fR command to determine the current operating system data model. If the \fB-32\fR option is specified, \fBdtrace\fR forces -the D compiler to compile a D program using the 32-bit data model. If the \fB-64\fR option is specified, \fBdtrace\fR forces the D compiler to compile a D program using the 64-bit data model. These options are typically not required as \fBdtrace\fR selects the -native data model as the default. The data model affects the sizes of integer types and other language properties. D programs compiled for either data model can be executed on both 32-bit and 64-bit kernels. The \fB-32\fR and \fB-64\fR options also determine the ELF file format -(ELF32 or ELF64) produced by the \fB-G\fR option. +The D compiler produces programs using the native data model of the operating +system kernel. You can use the \fBisainfo\fR \fB-b\fR command to determine the +current operating system data model. If the \fB-32\fR option is specified, +\fBdtrace\fR forces the D compiler to compile a D program using the 32-bit data +model. If the \fB-64\fR option is specified, \fBdtrace\fR forces the D compiler +to compile a D program using the 64-bit data model. These options are typically +not required as \fBdtrace\fR selects the native data model as the default. The +data model affects the sizes of integer types and other language properties. D +programs compiled for either data model can be executed on both 32-bit and +64-bit kernels. The \fB-32\fR and \fB-64\fR options also determine the ELF file +format (ELF32 or ELF64) produced by the \fB-G\fR option. .RE .sp @@ -114,8 +124,11 @@ native data model as the default. The da .ad .sp .6 .RS 4n -Claim anonymous tracing state and display the traced data. You can combine the \fB-a\fR option with the \fB-e\fR option to force \fBdtrace\fR to exit immediately after consuming the anonymous tracing state rather than continuing to wait for new -data. See the \fISolaris Dynamic Tracing Guide\fR for more information about anonymous tracing. +Claim anonymous tracing state and display the traced data. You can combine the +\fB-a\fR option with the \fB-e\fR option to force \fBdtrace\fR to exit +immediately after consuming the anonymous tracing state rather than continuing +to wait for new data. See the \fISolaris Dynamic Tracing Guide\fR for more +information about anonymous tracing. .RE .sp @@ -126,7 +139,12 @@ data. See the \fISolaris Dynamic Tracing .ad .sp .6 .RS 4n -Generate \fBdriver.conf\fR(4) directives for anonymous tracing. This option constructs a set of \fBdtrace\fR(7D) configuration file directives to enable the specified probes for anonymous tracing and then exits. By default, \fBdtrace\fR attempts to store the directives to the file \fB/kernel/drv/dtrace.conf\fR. You can modify this behavior if you use the \fB-o\fR option to specify an alternate output file. +Generate \fBdriver.conf\fR(4) directives for anonymous tracing. This option +constructs a set of \fBdtrace\fR(7D) configuration file directives to enable +the specified probes for anonymous tracing and then exits. By default, +\fBdtrace\fR attempts to store the directives to the file +\fB/kernel/drv/dtrace.conf\fR. You can modify this behavior if you use the +\fB-o\fR option to specify an alternate output file. .RE .sp @@ -137,8 +155,10 @@ Generate \fBdriver.conf\fR(4) directives .ad .sp .6 .RS 4n -Set principal trace buffer size (\fIbufsz\fR). The trace buffer size can include any of the size suffixes \fBk\fR, \fBm\fR, \fBg\fR, or \fBt\fR. If the buffer space cannot be allocated, \fBdtrace\fR attempts -to reduce the buffer size or exit depending on the setting of the \fBbufresize\fR property. +Set principal trace buffer size (\fIbufsz\fR). The trace buffer size can +include any of the size suffixes \fBk\fR, \fBm\fR, \fBg\fR, or \fBt\fR. If the +buffer space cannot be allocated, \fBdtrace\fR attempts to reduce the buffer +size or exit depending on the setting of the \fBbufresize\fR property. .RE .sp @@ -149,9 +169,13 @@ to reduce the buffer size or exit depend .ad .sp .6 .RS 4n -Run the specified command \fIcmd\fR and exit upon its completion. If more than one \fB-c\fR option is present on the command line, \fBdtrace\fR exits when all commands have exited, reporting the exit status for each child process as it -terminates. The process-ID of the first command is made available to any D programs specified on the command line or using the \fB-s\fR option through the \fB$target\fR macro variable. Refer to the \fISolaris Dynamic Tracing Guide\fR for more information -on macro variables. +Run the specified command \fIcmd\fR and exit upon its completion. If more than +one \fB-c\fR option is present on the command line, \fBdtrace\fR exits when all +commands have exited, reporting the exit status for each child process as it +terminates. The process-ID of the first command is made available to any D +programs specified on the command line or using the \fB-s\fR option through the +\fB$target\fR macro variable. Refer to the \fISolaris Dynamic Tracing Guide\fR +for more information on macro variables. .RE .sp @@ -162,7 +186,11 @@ on macro variables. .ad .sp .6 .RS 4n -Run the C preprocessor \fBcpp\fR(1) over D programs before compiling them. You can pass options to the C preprocessor using the \fB-D\fR, \fB-U\fR, \fB-I\fR, and \fB-H\fR options. You can select the degree of C standard conformance if you use the \fB-X\fR option. For a description of the set of tokens defined by the D compiler when invoking the C preprocessor, see \fB-X\fR. +Run the C preprocessor \fBcpp\fR(1) over D programs before compiling them. You +can pass options to the C preprocessor using the \fB-D\fR, \fB-U\fR, \fB-I\fR, +and \fB-H\fR options. You can select the degree of C standard conformance if +you use the \fB-X\fR option. For a description of the set of tokens defined by +the D compiler when invoking the C preprocessor, see \fB-X\fR. .RE .sp @@ -173,8 +201,10 @@ Run the C preprocessor \fBcpp\fR(1) over .ad .sp .6 .RS 4n -Define \fIname\fR when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). If you specify the equals sign (\fB=\fR) -and additional \fIvalue\fR, the name is assigned the corresponding value. This option passes the \fB-D\fR option to each \fBcpp\fR invocation. +Define \fIname\fR when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR +option). If you specify the equals sign (\fB=\fR) and additional \fIvalue\fR, +the name is assigned the corresponding value. This option passes the \fB-D\fR +option to each \fBcpp\fR invocation. .RE .sp @@ -185,21 +215,32 @@ and additional \fIvalue\fR, the name is .ad .sp .6 .RS 4n -Exit after compiling any requests and consuming anonymous tracing state (\fB-a\fR option) but prior to enabling any probes. You can combine this option with the \fB-a\fR option to print anonymous tracing data and exit. You can also combine this option with D -compiler options. This combination verifies that the programs compile without actually executing them and enabling the corresponding instrumentation. +Exit after compiling any requests and consuming anonymous tracing state +(\fB-a\fR option) but prior to enabling any probes. You can combine this option +with the \fB-a\fR option to print anonymous tracing data and exit. You can also +combine this option with D compiler options. This combination verifies that the +programs compile without actually executing them and enabling the corresponding +instrumentation. .RE .sp .ne 2 .mk .na -\fB\fB-f\fR\fB[[\fR\fIprovider\fR\fB:]\fR\fImodule\fR\fB:]\fR\fIfunction\fR\fB[[\fR\fIpredicate\fR\fB]\fR\fIaction\fR\fB]]\fR\fR +\fB\fB-f\fR\fB[[\fR\fIprovider\fR\fB:]\fR\fImodule\fR\fB:]\fR\fIfunction\fR\fB[ +[\fR\fIpredicate\fR\fB]\fR\fIaction\fR\fB]]\fR\fR .ad .sp .6 .RS 4n -Specify function name to trace or list (\fB-l\fR option). The corresponding argument can include any of the probe description forms \fIprovider:module:function\fR, \fImodule:function\fR, or \fIfunction\fR. -Unspecified probe description fields are left blank and match any probes regardless of the values in those fields. If no qualifiers other than \fIfunction\fR are specified in the description, all probes with the corresponding \fIfunction\fR are matched. -The \fB-f\fR argument can be suffixed with an optional D probe clause. You can specify more than one \fB-f\fR option on the command line at a time. +Specify function name to trace or list (\fB-l\fR option). The corresponding +argument can include any of the probe description forms +\fIprovider:module:function\fR, \fImodule:function\fR, or \fIfunction\fR. +Unspecified probe description fields are left blank and match any probes +regardless of the values in those fields. If no qualifiers other than +\fIfunction\fR are specified in the description, all probes with the +corresponding \fIfunction\fR are matched. The \fB-f\fR argument can be suffixed +with an optional D probe clause. You can specify more than one \fB-f\fR option +on the command line at a time. .RE .sp @@ -210,8 +251,12 @@ The \fB-f\fR argument can be suffixed wi .ad .sp .6 .RS 4n -Coalesce trace output by identifying function entry and return. Function entry probe reports are indented and their output is prefixed with \fB->\fR. Function return probe reports are unindented and their output is prefixed with \fB<-\fR\&. System call -entry probe reports are indented and their output is prefixed with \fB=>\fR. System call return probe reports are unindented and their output is prefixed with \fB<=\fR\&. +Coalesce trace output by identifying function entry and return. Function entry +probe reports are indented and their output is prefixed with \fB->\fR. Function +return probe reports are unindented and their output is prefixed with +\fB<-\fR\&. System call entry probe reports are indented and their output is +prefixed with \fB=>\fR. System call return probe reports are unindented and +their output is prefixed with \fB<=\fR\&. .RE .sp @@ -222,9 +267,14 @@ entry probe reports are indented and the .ad .sp .6 .RS 4n -Generate an ELF file containing an embedded DTrace program. The DTrace probes specified in the program are saved inside of a relocatable ELF object which can be linked into another program. If the \fB-o\fR option is present, the ELF file is saved using the pathname specified -as the argument for this operand. If the \fB-o\fR option is not present and the DTrace program is contained with a file whose name is \fB\fIfilename\fR.d\fR, then the ELF file is saved using the name \fB\fIfilename\fR.o\fR. -Otherwise the ELF file is saved using the name \fBd.out\fR. +Generate an ELF file containing an embedded DTrace program. The DTrace probes +specified in the program are saved inside of a relocatable ELF object which can +be linked into another program. If the \fB-o\fR option is present, the ELF file +is saved using the pathname specified as the argument for this operand. If the +\fB-o\fR option is not present and the DTrace program is contained with a file +whose name is \fB\fIfilename\fR.d\fR, then the ELF file is saved using the name +\fB\fIfilename\fR.o\fR. Otherwise the ELF file is saved using the name +\fBd.out\fR. .RE .sp @@ -235,8 +285,10 @@ Otherwise the ELF file is saved using th .ad .sp .6 .RS 4n -Print the pathnames of included files when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). This option passes the \fB-H\fR option -to each \fBcpp\fR invocation, causing it to display the list of pathnames, one for each line, to \fBstderr\fR. +Print the pathnames of included files when invoking \fBcpp\fR(1) (enabled using +the \fB-C\fR option). This option passes the \fB-H\fR option to each \fBcpp\fR +invocation, causing it to display the list of pathnames, one for each line, to +\fBstderr\fR. .RE .sp @@ -247,9 +299,14 @@ to each \fBcpp\fR invocation, causing it .ad .sp .6 .RS 4n -Generate a header file containing macros that correspond to probes in the specified provider definitions. This option should be used to generate a header file that is included by other source files for later use with the \fB-G\fR option. If the \fB-o\fR option -is present, the header file is saved using the pathname specified as the argument for that option. If the \fB-o\fR option is not present and the DTrace program is contained with a file whose name is \fIfilename\fR\fB\&.d\fR, then the header file is saved -using the name \fIfilename\fR\fB\&.h\fR. +Generate a header file containing macros that correspond to probes in the +specified provider definitions. This option should be used to generate a header +file that is included by other source files for later use with the \fB-G\fR +option. If the \fB-o\fR option is present, the header file is saved using the +pathname specified as the argument for that option. If the \fB-o\fR option is +not present and the DTrace program is contained with a file whose name is +\fIfilename\fR\fB\&.d\fR, then the header file is saved using the name +\fIfilename\fR\fB\&.h\fR. .RE .sp @@ -260,8 +317,10 @@ using the name \fIfilename\fR\fB\&.h\fR. .ad .sp .6 .RS 4n -Specify probe identifier (\fIprobe-id\fR) to trace or list (\fB-l\fR option). You can specify probe IDs using decimal integers as shown by \fBdtrace\fR \fB-l\fR. The \fB-i\fR argument can be suffixed with an optional -D probe clause. You can specify more than one \fB-i\fR option at a time. +Specify probe identifier (\fIprobe-id\fR) to trace or list (\fB-l\fR option). +You can specify probe IDs using decimal integers as shown by \fBdtrace\fR +\fB-l\fR. The \fB-i\fR argument can be suffixed with an optional D probe +clause. You can specify more than one \fB-i\fR option at a time. .RE .sp @@ -272,8 +331,11 @@ D probe clause. You can specify more tha .ad .sp .6 .RS 4n -Add the specified directory \fIpath\fR to the search path for \fB#include\fR files when invoking \fBcpp\fR(1) (enabled -using the \fB-C\fR option). This option passes the \fB-I\fR option to each \fBcpp\fR invocation. The specified \fIpath\fR is inserted into the search path ahead of the default directory list. +Add the specified directory \fIpath\fR to the search path for \fB#include\fR +files when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). This +option passes the \fB-I\fR option to each \fBcpp\fR invocation. The specified +\fIpath\fR is inserted into the search path ahead of the default directory +list. .RE .sp @@ -284,7 +346,9 @@ using the \fB-C\fR option). This option .ad .sp .6 .RS 4n -Add the specified directory \fIpath\fR to the search path for DTrace libraries. DTrace libraries are used to contain common definitions that can be used when writing D programs. The specified \fIpath\fR is added after the default library +Add the specified directory \fIpath\fR to the search path for DTrace libraries. +DTrace libraries are used to contain common definitions that can be used when +writing D programs. The specified \fIpath\fR is added after the default library search path. .RE @@ -296,34 +360,49 @@ search path. .ad .sp .6 .RS 4n -List probes instead of enabling them. If the \fB-l\fR option is specified, \fBdtrace\fR produces a report of the probes matching the descriptions given using the \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, \fB-i\fR, -and \fB-s\fR options. If none of these options are specified, this option lists all probes. +List probes instead of enabling them. If the \fB-l\fR option is specified, +\fBdtrace\fR produces a report of the probes matching the descriptions given +using the \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, \fB-i\fR, and \fB-s\fR +options. If none of these options are specified, this option lists all probes. .RE .sp .ne 2 .mk .na -\fB\fB-m\fR [[\fIprovider:\fR] \fImodule:\fR [[\fIpredicate\fR] \fIaction\fR]]\fR +\fB\fB-m\fR [[\fIprovider:\fR] \fImodule:\fR [[\fIpredicate\fR] +\fIaction\fR]]\fR .ad .sp .6 .RS 4n -Specify module name to trace or list (\fB-l\fR option). The corresponding argument can include any of the probe description forms \fIprovider:module\fR or \fImodule\fR. Unspecified probe description fields are left blank and match -any probes regardless of the values in those fields. If no qualifiers other than \fImodule\fR are specified in the description, all probes with a corresponding \fImodule\fR are matched. The \fB-m\fR argument can be suffixed with an optional D -probe clause. More than one \fB-m\fR option can be specified on the command line at a time. +Specify module name to trace or list (\fB-l\fR option). The corresponding +argument can include any of the probe description forms \fIprovider:module\fR +or \fImodule\fR. Unspecified probe description fields are left blank and match +any probes regardless of the values in those fields. If no qualifiers other +than \fImodule\fR are specified in the description, all probes with a +corresponding \fImodule\fR are matched. The \fB-m\fR argument can be suffixed +with an optional D probe clause. More than one \fB-m\fR option can be specified +on the command line at a time. .RE .sp .ne 2 .mk .na -\fB\fB-n\fR [[[\fIprovider:\fR] \fImodule:\fR] \fIfunction:\fR] \fIname\fR [[\fIpredicate\fR] \fIaction\fR]\fR +\fB\fB-n\fR [[[\fIprovider:\fR] \fImodule:\fR] \fIfunction:\fR] \fIname\fR +[[\fIpredicate\fR] \fIaction\fR]\fR .ad .sp .6 .RS 4n -Specify probe name to trace or list (\fB-l\fR option). The corresponding argument can include any of the probe description forms \fIprovider:module:function:name\fR, \fImodule:function:name\fR, \fIfunction:name\fR, -or \fIname\fR. Unspecified probe description fields are left blank and match any probes regardless of the values in those fields. If no qualifiers other than \fIname\fR are specified in the description, all probes with a corresponding \fIname\fR are -matched. The \fB-n\fR argument can be suffixed with an optional D probe clause. More than one \fB-n\fR option can be specified on the command line at a time. +Specify probe name to trace or list (\fB-l\fR option). The corresponding +argument can include any of the probe description forms +\fIprovider:module:function:name\fR, \fImodule:function:name\fR, +\fIfunction:name\fR, or \fIname\fR. Unspecified probe description fields are +left blank and match any probes regardless of the values in those fields. If no +qualifiers other than \fIname\fR are specified in the description, all probes +with a corresponding \fIname\fR are matched. The \fB-n\fR argument can be +suffixed with an optional D probe clause. More than one \fB-n\fR option can be +specified on the command line at a time. .RE .sp @@ -334,8 +413,13 @@ matched. The \fB-n\fR argument can be su .ad .sp .6 .RS 4n -Specify the \fIoutput\fR file for the \fB-A\fR , \fB-G\fR, and \fB-l\fR options, or for the traced data itself. If the \fB-A\fR option is present and \fB-o\fR is not present, the default output file is \fB/kernel/drv/dtrace.conf\fR. If the \fB-G\fR option is present and the \fB-s\fR option's argument is of the form \fB\fIfilename\fR.d\fR and \fB-o\fR is not present, the default output file is \fB\fIfilename\fR.o\fR. -Otherwise the default output file is \fBd.out\fR. +Specify the \fIoutput\fR file for the \fB-A\fR , \fB-G\fR, \fB-h\fR, and +\fB-l\fR options, or for the traced data itself. If the \fB-A\fR option is +present and \fB-o\fR is not present, the default output file is +\fB/kernel/drv/dtrace.conf\fR. If the \fB-G\fR option is present and the +\fB-s\fR option's argument is of the form \fB\fIfilename\fR.d\fR and \fB-o\fR +is not present, the default output file is \fB\fIfilename\fR.o\fR. Otherwise +the default output file is \fBd.out\fR. .RE .sp @@ -346,9 +430,13 @@ Otherwise the default output file is \fB .ad .sp .6 .RS 4n -Grab the specified process-ID \fIpid\fR, cache its symbol tables, and exit upon its completion. If more than one \fB-p\fR option is present on the command line, \fBdtrace\fR exits when all commands have exited, reporting the exit status -for each process as it terminates. The first process-ID is made available to any D programs specified on the command line or using the \fB-s\fR option through the \fB$target\fR macro variable. Refer to the \fISolaris Dynamic Tracing Guide\fR for -more information on macro variables. +Grab the specified process-ID \fIpid\fR, cache its symbol tables, and exit upon +its completion. If more than one \fB-p\fR option is present on the command +line, \fBdtrace\fR exits when all commands have exited, reporting the exit +status for each process as it terminates. The first process-ID is made +available to any D programs specified on the command line or using the \fB-s\fR +option through the \fB$target\fR macro variable. Refer to the \fISolaris +Dynamic Tracing Guide\fR for more information on macro variables. .RE .sp @@ -359,8 +447,11 @@ more information on macro variables. .ad .sp .6 .RS 4n -Specify provider name to trace or list (\fB-l\fR option). The remaining probe description fields module, function, and name are left blank and match any probes regardless of the values in those fields. The \fB-P\fR argument can be suffixed with an optional D -probe clause. You can specify more than one \fB-P\fR option on the command line at a time. +Specify provider name to trace or list (\fB-l\fR option). The remaining probe +description fields module, function, and name are left blank and match any +probes regardless of the values in those fields. The \fB-P\fR argument can be +suffixed with an optional D probe clause. You can specify more than one +\fB-P\fR option on the command line at a time. .RE .sp @@ -371,8 +462,11 @@ probe clause. You can specify more than .ad .sp .6 .RS 4n -Set quiet mode. \fBdtrace\fR suppresses messages such as the number of probes matched by the specified options and D programs and does not print column headers, the CPU ID, the probe ID, or insert newlines into the output. Only data traced and formatted by D program -statements such as \fBtrace()\fR and \fBprintf()\fR is displayed to \fBstdout\fR. +Set quiet mode. \fBdtrace\fR suppresses messages such as the number of probes +matched by the specified options and D programs and does not print column +headers, the CPU ID, the probe ID, or insert newlines into the output. Only +data traced and formatted by D program statements such as \fBtrace()\fR and +\fBprintf()\fR is displayed to \fBstdout\fR. .RE .sp @@ -383,8 +477,12 @@ statements such as \fBtrace()\fR and \fB .ad .sp .6 .RS 4n -Compile the specified D program source file. If the \fB-e\fR option is present, the program is compiled but instrumentation is not enabled. If the \fB-l\fR option is present, the program is compiled and the set of probes matched by it is listed, but instrumentation -is not enabled. If none of \fB-e\fR, \fB-l\fR, \fB-G\fR, or \fB-A\fR are present, the instrumentation specified by the D program is enabled and tracing begins. +Compile the specified D program source file. If the \fB-e\fR option is present, +the program is compiled but instrumentation is not enabled. If the \fB-l\fR +option is present, the program is compiled and the set of probes matched by it +is listed, but instrumentation is not enabled. If none of \fB-e\fR, \fB-l\fR, +\fB-G\fR, or \fB-A\fR are present, the instrumentation specified by the D +program is enabled and tracing begins. .RE .sp @@ -395,7 +493,8 @@ is not enabled. If none of \fB-e\fR, \fB .ad .sp .6 .RS 4n -Show D compiler intermediate code. The D compiler produces a report of the intermediate code generated for each D program to \fBstderr\fR. +Show D compiler intermediate code. The D compiler produces a report of the +intermediate code generated for each D program to \fBstderr\fR. .RE .sp @@ -406,7 +505,9 @@ Show D compiler intermediate code. The D .ad .sp .6 .RS 4n -Undefine the specified \fIname\fR when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). This option passes the \fB-U\fR option to each \fBcpp\fR invocation. +Undefine the specified \fIname\fR when invoking \fBcpp\fR(1) (enabled using the +\fB-C\fR option). This option passes the \fB-U\fR option to each \fBcpp\fR +invocation. .RE .sp @@ -417,7 +518,10 @@ Undefine the specified \fIname\fR when i .ad .sp .6 .RS 4n -Set verbose mode. If the \fB-v\fR option is specified, \fBdtrace\fR produces a program stability report showing the minimum interface stability and dependency level for the specified D programs. DTrace stability levels are explained in further detail in the \fISolaris Dynamic Tracing Guide\fR. +Set verbose mode. If the \fB-v\fR option is specified, \fBdtrace\fR produces a +program stability report showing the minimum interface stability and dependency +level for the specified D programs. DTrace stability levels are explained in +further detail in the \fISolaris Dynamic Tracing Guide\fR. .RE .sp @@ -428,8 +532,10 @@ Set verbose mode. If the \fB-v\fR option .ad .sp .6 .RS 4n -Report the highest D programming interface version supported by \fBdtrace\fR. The version information is printed to \fBstdout\fR and the \fBdtrace\fR command exits. Refer to the \fISolaris Dynamic Tracing Guide\fR for -more information about DTrace versioning features. +Report the highest D programming interface version supported by \fBdtrace\fR. +The version information is printed to \fBstdout\fR and the \fBdtrace\fR command +exits. Refer to the \fISolaris Dynamic Tracing Guide\fR for more information +about DTrace versioning features. .RE .sp @@ -440,8 +546,10 @@ more information about DTrace versioning .ad .sp .6 .RS 4n -Permit destructive actions in D programs specified using the \fB-s\fR, \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, or \fB-i\fR options. If the \fB-w\fR option is not specified, \fBdtrace\fR does not -permit the compilation or enabling of a D program that contains destructive actions. +Permit destructive actions in D programs specified using the \fB-s\fR, +\fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, or \fB-i\fR options. If the \fB-w\fR +option is not specified, \fBdtrace\fR does not permit the compilation or +enabling of a D program that contains destructive actions. .RE .sp @@ -452,8 +560,10 @@ permit the compilation or enabling of a .ad .sp .6 .RS 4n -Enable or modify a DTrace runtime option or D compiler option. The list of options is found in the \fISolaris Dynamic Tracing Guide\fR. Boolean options are enabled by specifying their name. Options with values are set by separating the option name and -value with an equals sign (\fB=\fR). +Enable or modify a DTrace runtime option or D compiler option. The list of +options is found in the \fISolaris Dynamic Tracing Guide\fR. Boolean options +are enabled by specifying their name. Options with values are set by separating +the option name and value with an equals sign (\fB=\fR). .RE .sp @@ -464,8 +574,10 @@ value with an equals sign (\fB=\fR). .ad .sp .6 .RS 4n -Specify the degree of conformance to the ISO C standard that should be selected when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). -The \fB-X\fR option argument affects the value and presence of the \fB__STDC__\fR macro depending upon the value of the argument letter. +Specify the degree of conformance to the ISO C standard that should be selected +when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). The \fB-X\fR +option argument affects the value and presence of the \fB__STDC__\fR macro +depending upon the value of the argument letter. .sp The \fB-X\fR option supports the following arguments: .sp @@ -476,8 +588,10 @@ The \fB-X\fR option supports the followi .ad .RS 5n .rt -Default. ISO C plus K&R compatibility extensions, with semantic changes required by ISO C. This is the default mode if \fB-X\fR is not specified. The predefined macro \fB__STDC__\fR has a value of 0 when \fBcpp\fR is invoked in conjunction -with the \fB-Xa\fR option. +Default. ISO C plus K&R compatibility extensions, with semantic changes +required by ISO C. This is the default mode if \fB-X\fR is not specified. The +predefined macro \fB__STDC__\fR has a value of 0 when \fBcpp\fR is invoked in +conjunction with the \fB-Xa\fR option. .RE .sp @@ -488,7 +602,9 @@ with the \fB-Xa\fR option. .ad .RS 5n .rt -Conformance. Strictly conformant ISO C, without K&R C compatibility extensions. The predefined macro \fB__STDC__\fR has a value of 1 when \fBcpp\fR is invoked in conjunction with the \fB-Xc\fR option. +Conformance. Strictly conformant ISO C, without K&R C compatibility extensions. +The predefined macro \fB__STDC__\fR has a value of 1 when \fBcpp\fR is invoked +in conjunction with the \fB-Xc\fR option. .RE .sp @@ -499,7 +615,8 @@ Conformance. Strictly conformant ISO C, .ad .RS 5n .rt -K&R C only. The macro \fB__STDC__\fR is not defined when \fBcpp\fR is invoked in conjunction with the \fB-Xs\fR option. +K&R C only. The macro \fB__STDC__\fR is not defined when \fBcpp\fR is invoked +in conjunction with the \fB-Xs\fR option. .RE .sp @@ -510,12 +627,18 @@ K&R C only. The macro \fB__STDC__\fR is .ad .RS 5n .rt -Transition. ISO C plus K&R C compatibility extensions, without semantic changes required by ISO C. The predefined macro \fB__STDC__\fR has a value of 0 when \fBcpp\fR is invoked in conjunction with the \fB-Xt\fR option. +Transition. ISO C plus K&R C compatibility extensions, without semantic changes +required by ISO C. The predefined macro \fB__STDC__\fR has a value of 0 when +\fBcpp\fR is invoked in conjunction with the \fB-Xt\fR option. .RE -As the \fB-X\fR option only affects how the D compiler invokes the C preprocessor, the \fB-Xa\fR and \fB-Xt\fR options are equivalent from the perspective of D and both are provided only to ease re-use of settings from a C build environment. +As the \fB-X\fR option only affects how the D compiler invokes the C +preprocessor, the \fB-Xa\fR and \fB-Xt\fR options are equivalent from the +perspective of D and both are provided only to ease re-use of settings from a C +build environment. .sp -Regardless of the \fB-X\fR mode, the following additional C preprocessor definitions are always specified and valid in all modes: +Regardless of the \fB-X\fR mode, the following additional C preprocessor +definitions are always specified and valid in all modes: .RS +4 .TP .ie t \(bu @@ -576,8 +699,10 @@ Regardless of the \fB-X\fR mode, the fol .el o \fB__SUNW_D_VERSION=0x\fIMMmmmuuu\fR\fR .sp -Where \fIMM\fR is the major release value in hexadecimal, \fImmm\fR is the minor release value in hexadecimal, and \fIuuu\fR is the -micro release value in hexadecimal. Refer to the \fISolaris Dynamic Tracing Guide\fR for more information about DTrace versioning. +Where \fIMM\fR is the major release value in hexadecimal, \fImmm\fR is the +minor release value in hexadecimal, and \fIuuu\fR is the micro release value in +hexadecimal. Refer to the \fISolaris Dynamic Tracing Guide\fR for more +information about DTrace versioning. .RE .RE @@ -589,14 +714,21 @@ micro release value in hexadecimal. Refe .ad .sp .6 .RS 4n -Permit probe descriptions that match zero probes. If the \fB-Z\fR option is not specified, \fBdtrace\fR reports an error and exits if any probe descriptions specified in D program files (\fB-s\fR option) or on the command line (\fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, or \fB-i\fR options) contain descriptions that do not match any known probes. +Permit probe descriptions that match zero probes. If the \fB-Z\fR option is not +specified, \fBdtrace\fR reports an error and exits if any probe descriptions +specified in D program files (\fB-s\fR option) or on the command line +(\fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, or \fB-i\fR options) contain +descriptions that do not match any known probes. .RE .SH OPERANDS .sp .LP -You can specify zero or more additional arguments on the \fBdtrace\fR command line to define a set of macro variables (\fB$1\fR, \fB$2\fR, and so forth). The additional arguments can be used in D programs specified using the \fB-s\fR option -or on the command line. The use of macro variables is described further in the \fISolaris Dynamic Tracing Guide\fR. +You can specify zero or more additional arguments on the \fBdtrace\fR command +line to define a set of macro variables (\fB$1\fR, \fB$2\fR, and so forth). The +additional arguments can be used in D programs specified using the \fB-s\fR +option or on the command line. The use of macro variables is described further +in the \fISolaris Dynamic Tracing Guide\fR. .SH EXIT STATUS .sp .LP @@ -609,10 +741,12 @@ The following exit values are returned: .ad .RS 5n .rt -Successful completion. +Successful completion. .sp -For D program requests, an exit status of \fB0\fR indicates that programs were successfully compiled, probes were successfully enabled, or anonymous state was successfully retrieved. \fBdtrace\fR returns \fB0\fR even if the specified tracing requests -encountered errors or drops. +For D program requests, an exit status of \fB0\fR indicates that programs were +successfully compiled, probes were successfully enabled, or anonymous state was +successfully retrieved. \fBdtrace\fR returns \fB0\fR even if the specified +tracing requests encountered errors or drops. .RE .sp @@ -625,7 +759,8 @@ encountered errors or drops. .rt An error occurred. .sp -For D program requests, an exit status of \fB1\fR indicates that program compilation failed or that the specified request could not be satisfied. +For D program requests, an exit status of \fB1\fR indicates that program +compilation failed or that the specified request could not be satisfied. .RE .sp @@ -653,8 +788,6 @@ lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ -AvailabilitySUNWdtrc -_ Interface StabilitySee below. .TE @@ -664,7 +797,19 @@ The command-line syntax is Committed. Th .SH SEE ALSO .sp .LP -\fBcpp\fR(1), \fBisainfo\fR(1), \fBlibdtrace\fR(3LIB), \fBdriver.conf\fR(4), \fBattributes\fR(5), \fBdtrace\fR(7D) +\fBcpp\fR(1), \fBisainfo\fR(1), \fBssh\fR(1), \fBlibdtrace\fR(3LIB), +\fBdriver.conf\fR(4), \fBattributes\fR(5), \fBdtrace\fR(7D) .sp .LP \fISolaris Dynamic Tracing Guide\fR +.SH USAGE +.sp +.LP +When using the \fB-p\fR flag, \fBdtrace\fR stops the target processes while it +is inspecting them and reporting results. A process can do nothing while it is +stopped. This means that, if , for example, the X server is inspected by +\fBdtrace\fR running in a window under the X server's control, the whole window +system can become deadlocked, because the \fBproc\fR tool would be attempting +to display its results to a window that cannot be refreshed. In such a case, +logging in from another system using \fBssh\fR(1) and killing the offending +\fBproc\fR tool clears the deadlock. Added: vendor/illumos/dist/man/man1m/lockstat.1m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/man/man1m/lockstat.1m Wed Jul 18 09:53:20 2012 (r238581) @@ -0,0 +1,909 @@ +'\" te +.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. +.\" 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 lockstat 1M "28 Feb 2008" "SunOS 5.11" "System Administration Commands" +.SH NAME +lockstat \- report kernel lock and profiling statistics +.SH SYNOPSIS +.LP +.nf +\fBlockstat\fR [\fB-ACEHI\fR] [\fB-e\fR \fIevent_list\fR] [\fB-i\fR \fIrate\fR] + [\fB-b\fR | \fB-t\fR | \fB-h\fR | \fB-s\fR \fIdepth\fR] [\fB-n\fR \fInrecords\fR] + [\fB-l\fR \fIlock\fR [, \fIsize\fR]] [\fB-d\fR \fIduration\fR] + [\fB-f\fR \fIfunction\fR [, \fIsize\fR]] [\fB-T\fR] [\fB-ckgwWRpP\fR] [\fB-D\fR \fIcount\fR] + [\fB-o\fR \fIfilename\fR] [\fB-x\fR \fIopt\fR [=val]] \fIcommand\fR [\fIargs\fR] +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBlockstat\fR utility gathers and displays kernel locking and profiling +statistics. \fBlockstat\fR allows you to specify which events to watch (for +example, spin on adaptive mutex, block on read access to rwlock due to waiting +writers, and so forth) how much data to gather for each event, and how to +display the data. By default, \fBlockstat\fR monitors all lock contention +events, gathers frequency and timing data about those events, and displays the +data in decreasing frequency order, so that the most common events appear +first. +.sp +.LP +\fBlockstat\fR gathers data until the specified command completes. For example, +to gather statistics for a fixed-time interval, use \fBsleep\fR(1) as the +command, as follows: +.sp +.LP +\fBexample#\fR \fBlockstat\fR \fBsleep\fR \fB5\fR +.sp +.LP +When the \fB-I\fR option is specified, \fBlockstat\fR establishes a +per-processor high-level periodic interrupt source to gather profiling data. +The interrupt handler simply generates a \fBlockstat\fR event whose caller is +the interrupted PC (program counter). The profiling event is just like any +other \fBlockstat\fR event, so all of the normal \fBlockstat\fR options are +applicable. +.sp +.LP +\fBlockstat\fR relies on DTrace to modify the running kernel's text to +intercept events of interest. This imposes a small but measurable overhead on +all system activity, so access to \fBlockstat\fR is restricted to super-user by +default. The system administrator can permit other users to use \fBlockstat\fR +by granting them additional DTrace privileges. Refer to the \fISolaris Dynamic +Tracing Guide\fR for more information about DTrace security features. +.SH OPTIONS +.sp +.LP +The following options are supported: +.SS "Event Selection" +.sp +.LP +If no event selection options are specified, the default is \fB-C\fR. +.sp +.ne 2 +.mk +.na +\fB\fB-A\fR\fR +.ad +.sp .6 +.RS 4n +Watch all lock events. \fB-A\fR is equivalent to \fB-CH\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-C\fR\fR +.ad +.sp .6 +.RS 4n +Watch contention events. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-E\fR\fR +.ad +.sp .6 +.RS 4n +Watch error events. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-e\fR \fIevent_list\fR\fR +.ad +.sp .6 +.RS 4n +Only watch the specified events. \fIevent\fR \fIlist\fR is a comma-separated +list of events or ranges of events such as 1,4-7,35. Run \fBlockstat\fR with no +arguments to get a brief description of all events. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-H\fR\fR +.ad +.sp .6 +.RS 4n +Watch hold events. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-I\fR\fR +.ad +.sp .6 +.RS 4n +Watch profiling interrupt events. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-i\fR \fIrate\fR\fR +.ad +.sp .6 +.RS 4n +Interrupt rate (per second) for \fB-I\fR. The default is 97 Hz, so that +profiling doesn't run in lockstep with the clock interrupt (which runs at 100 +Hz). +.RE + +.SS "Data Gathering" +.sp +.ne 2 +.mk +.na +\fB\fB-x\fR \fIarg\fR[=\fIval\fR]\fR +.ad +.sp .6 +.RS 4n +Enable or modify a DTrace runtime option or D compiler option. The list of +options is found in the \fI\fR. Boolean options are enabled by specifying their +name. Options with values are set by separating the option name and value with +an equals sign (=). +.RE + +.SS "Data Gathering (Mutually Exclusive)" +.sp +.ne 2 +.mk +.na +\fB\fB-b\fR\fR +.ad +.sp .6 +.RS 4n +Basic statistics: lock, caller, number of events. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-h\fR\fR +.ad +.sp .6 +.RS 4n +Histogram: Timing plus time-distribution histograms. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-s\fR \fIdepth\fR\fR +.ad +.sp .6 +.RS 4n +Stack trace: Histogram plus stack traces up to \fIdepth\fR frames deep. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-t\fR\fR +.ad +.sp .6 +.RS 4n +Timing: Basic plus timing for all events [default]. +.RE + +.SS "Data Filtering" +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-d\fR \fIduration\fR\fR +.ad +.sp .6 +.RS 4n +Only watch events longer than \fIduration\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-f\fR \fIfunc[,size]\fR\fR +.ad +.sp .6 +.RS 4n +Only watch events generated by \fIfunc\fR, which can be specified as a symbolic +name or hex address. \fIsize\fR defaults to the \fBELF\fR symbol size if +available, or \fB1\fR if not. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-l\fR \fIlock[,size]\fR\fR +.ad +.sp .6 +.RS 4n +Only watch \fIlock\fR, which can be specified as a symbolic name or hex +address. \fBsize\fR defaults to the \fBELF\fR symbol size or \fB1\fR if the +symbol size is not available. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-n\fR \fInrecords\fR\fR +.ad +.sp .6 +.RS 4n +Maximum number of data records. +.RE + +.sp +.ne 2 +.mk +.na *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 10:19:07 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 06EB3106566C; Wed, 18 Jul 2012 10:19:07 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E14958FC15; Wed, 18 Jul 2012 10:19:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IAJ6q8054556; Wed, 18 Jul 2012 10:19:06 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IAJ6EN054536; Wed, 18 Jul 2012 10:19:06 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207181019.q6IAJ6EN054536@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 10:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238582 - in vendor/illumos/dist: cmd/dtrace/test/cmd/jdtrace cmd/dtrace/test/cmd/scripts cmd/dtrace/test/tst/common/aggs cmd/dtrace/test/tst/common/buffering cmd/dtrace/test/tst/common... X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 10:19:07 -0000 Author: mm Date: Wed Jul 18 10:19:06 2012 New Revision: 238582 URL: http://svn.freebsd.org/changeset/base/238582 Log: Update vendor/illumos/dist to pre libzfs_core state (dtrace and ctf part) illumos-gate revision 13742:b6bbdd77139c Obtained from: ssh://anonhg@hg.illumos.org/illumos-gate Added: vendor/illumos/dist/cmd/dtrace/test/cmd/scripts/dtfailures.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.tolower.d vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.toupper.d vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.tolower.d vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.tolowertoomany.d vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.toupper.d vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.touppertoomany.d vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/tst.lltostrbase.d vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/tst.lltostrbase.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/tst.tolower.d vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/tst.toupper.d vendor/illumos/dist/cmd/dtrace/test/tst/common/include/ vendor/illumos/dist/cmd/dtrace/test/tst/common/include/tst.includefirst.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/ vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_FACTOREVEN.nodivide.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_FACTOREVEN.notfactor.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_FACTORMATCH.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_FACTORNSTEPS.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_FACTORSMALL.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_FACTORTYPE.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_FACTORVAL.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_HIGHMATCH.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_HIGHTYPE.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_HIGHVAL.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_LOWMATCH.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_LOWTYPE.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_LOWVAL.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGRANGE.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_NSTEPMATCH.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_NSTEPTYPE.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_NSTEPVAL.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.bases.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.bases.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.basic.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.basic.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.negorder.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.negorder.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.negvalue.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.negvalue.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.normal.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.normal.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.range.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.range.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.steps.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.steps.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.trunc.d vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.trunc.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/pragma/tst.libdepsepdir.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/print/ vendor/illumos/dist/cmd/dtrace/test/tst/common/print/err.D_PRINT_DYN.bad.d vendor/illumos/dist/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d vendor/illumos/dist/cmd/dtrace/test/tst/common/print/err.D_PROTO_LEN.bad.d vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.array.d vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.array.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.bitfield.d vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.bitfield.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.primitive.d vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.primitive.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.struct.d vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.struct.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.noprivdrop.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.noprivrestrict.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.tick.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/sizeof/err.D_SIZEOF_TYPE.badstruct.d vendor/illumos/dist/cmd/dtrace/test/tst/common/trace/err.D_TRACE_DYN.bad.d vendor/illumos/dist/cmd/dtrace/test/tst/common/tracemem/err.D_TRACEMEM_ARGS.d vendor/illumos/dist/cmd/dtrace/test/tst/common/tracemem/err.D_TRACEMEM_DYNSIZE.d vendor/illumos/dist/cmd/dtrace/test/tst/common/tracemem/tst.dynsize.d vendor/illumos/dist/cmd/dtrace/test/tst/common/tracemem/tst.dynsize.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/tracemem/tst.smallsize.d vendor/illumos/dist/cmd/dtrace/test/tst/common/tracemem/tst.smallsize.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh vendor/illumos/dist/lib/libdtrace/common/dt_print.c Modified: vendor/illumos/dist/cmd/dtrace/test/cmd/jdtrace/JDTrace.java vendor/illumos/dist/cmd/dtrace/test/cmd/jdtrace/exception.lst vendor/illumos/dist/cmd/dtrace/test/cmd/jdtrace/jdtrace.c vendor/illumos/dist/cmd/dtrace/test/cmd/scripts/dtest.pl vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs/tst.subr.d vendor/illumos/dist/cmd/dtrace/test/tst/common/buffering/tst.resize1.d vendor/illumos/dist/cmd/dtrace/test/tst/common/buffering/tst.resize2.d vendor/illumos/dist/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl vendor/illumos/dist/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl vendor/illumos/dist/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/java_api/src/TestBean.java vendor/illumos/dist/cmd/dtrace/test/tst/common/java_api/tst.Bean.ksh.out vendor/illumos/dist/cmd/dtrace/test/tst/common/mdb/tst.dtracedcmd.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/misc/tst.include.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh.out vendor/illumos/dist/cmd/dtrace/test/tst/common/misc/tst.schrock.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/profile-n/tst.ufunc.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/profile-n/tst.umod.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/profile-n/tst.usym.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/safety/tst.violentdeath.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.eliminate.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.header.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.include.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.linkunpriv.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.onlyenabled.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.static.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.user.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/ustack/tst.spin.ksh vendor/illumos/dist/cmd/dtrace/test/tst/sparc/usdt/tst.tailcall.ksh vendor/illumos/dist/lib/libctf/common/ctf_lib.c vendor/illumos/dist/lib/libdtrace/common/dt_aggregate.c vendor/illumos/dist/lib/libdtrace/common/dt_cc.c vendor/illumos/dist/lib/libdtrace/common/dt_consume.c vendor/illumos/dist/lib/libdtrace/common/dt_dof.c vendor/illumos/dist/lib/libdtrace/common/dt_errtags.h vendor/illumos/dist/lib/libdtrace/common/dt_impl.h vendor/illumos/dist/lib/libdtrace/common/dt_map.c vendor/illumos/dist/lib/libdtrace/common/dt_open.c vendor/illumos/dist/lib/libdtrace/common/dt_options.c vendor/illumos/dist/lib/libdtrace/common/dt_parser.c vendor/illumos/dist/lib/libdtrace/common/dt_pragma.c vendor/illumos/dist/lib/libdtrace/common/dt_printf.c vendor/illumos/dist/lib/libdtrace/common/dt_program.c vendor/illumos/dist/lib/libdtrace/common/dtrace.h vendor/illumos/dist/lib/libdtrace/i386/regs.d.in vendor/illumos/dist/man/man1m/dtrace.1m vendor/illumos/dist/man/man1m/lockstat.1m vendor/illumos/dist/man/man1m/plockstat.1m vendor/illumos/dist/tools/ctf/cvt/dwarf.c Modified: vendor/illumos/dist/cmd/dtrace/test/cmd/jdtrace/JDTrace.java ============================================================================== --- vendor/illumos/dist/cmd/dtrace/test/cmd/jdtrace/JDTrace.java Wed Jul 18 09:53:20 2012 (r238581) +++ vendor/illumos/dist/cmd/dtrace/test/cmd/jdtrace/JDTrace.java Wed Jul 18 10:19:06 2012 (r238582) @@ -23,7 +23,6 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * - * ident "%Z%%M% %I% %E% SMI" */ import org.opensolaris.os.dtrace.*; import java.io.*; @@ -303,6 +302,7 @@ public class JDTrace { Distribution.Bucket bucket; int b1 = 0; // first displayed bucket int b2 = d.size() - 1; // last displayed bucket + for (; (b1 <= b2) && (d.get(b1).getFrequency() == 0); ++b1); // If possible, get one bucket before the first non-zero // bucket and one bucket after the last. @@ -337,9 +337,14 @@ public class JDTrace { v = bucket.getFrequency(); b = bucket.getMin(); - if (d instanceof LinearDistribution) { + if ((d instanceof LinearDistribution) || + (d instanceof LogLinearDistribution)) { if (b == Long.MIN_VALUE) { - String lt = "< " + ((LinearDistribution)d).getBase(); + String lt; + if (d instanceof LinearDistribution) + lt = "< " + ((LinearDistribution)d).getBase(); + else + lt = "< " + ((LogLinearDistribution)d).getBase(); out.printf("%16s ", lt); } else if (bucket.getMax() == Long.MAX_VALUE) { String ge = ">= " + b; Modified: vendor/illumos/dist/cmd/dtrace/test/cmd/jdtrace/exception.lst ============================================================================== --- vendor/illumos/dist/cmd/dtrace/test/cmd/jdtrace/exception.lst Wed Jul 18 09:53:20 2012 (r238581) +++ vendor/illumos/dist/cmd/dtrace/test/cmd/jdtrace/exception.lst Wed Jul 18 10:19:06 2012 (r238582) @@ -23,7 +23,6 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" # Exception list: names tests that are bypassed when running in Java # mode (relative to /opt/SUNWdtrt/tst) @@ -52,14 +51,17 @@ common/usdt/tst.enabled.ksh common/usdt/tst.enabled2.ksh common/usdt/tst.entryreturn.ksh common/usdt/tst.fork.ksh -common/usdt/tst.header.ksh common/usdt/tst.guess32.ksh common/usdt/tst.guess64.ksh +common/usdt/tst.header.ksh common/usdt/tst.linkpriv.ksh common/usdt/tst.linkunpriv.ksh common/usdt/tst.multiple.ksh common/usdt/tst.nodtrace.ksh +common/usdt/tst.noreap.ksh +common/usdt/tst.noreapring.ksh common/usdt/tst.onlyenabled.ksh +common/usdt/tst.reap.ksh common/usdt/tst.reeval.ksh common/usdt/tst.static.ksh common/usdt/tst.static2.ksh Modified: vendor/illumos/dist/cmd/dtrace/test/cmd/jdtrace/jdtrace.c ============================================================================== --- vendor/illumos/dist/cmd/dtrace/test/cmd/jdtrace/jdtrace.c Wed Jul 18 09:53:20 2012 (r238581) +++ vendor/illumos/dist/cmd/dtrace/test/cmd/jdtrace/jdtrace.c Wed Jul 18 10:19:06 2012 (r238582) @@ -22,25 +22,27 @@ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2011, Richard Lowe */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include +#include #include int main(int argc, char **argv) { - int i, ac, has64; + int i, ac; char **av, **p; + char isaname[16]; ac = argc + 3; av = p = alloca(sizeof (char *) * ac); - *p++ = "java"; + *p++ = "/usr/java/bin/java"; *p++ = "-jar"; *p++ = "/opt/SUNWdtrt/lib/java/jdtrace.jar"; @@ -52,9 +54,9 @@ main(int argc, char **argv) } p[i] = NULL; - (void) execvp(av[0], av); - - perror("exec failed"); + if (sysinfo(SI_ARCHITECTURE_64, isaname, sizeof (isaname)) != -1) + asprintf(av, "/usr/java/bin/%s/java", isaname); - return (0); + (void) execv(av[0], av); + err(1, "exec failed"); } Modified: vendor/illumos/dist/cmd/dtrace/test/cmd/scripts/dtest.pl ============================================================================== --- vendor/illumos/dist/cmd/dtrace/test/cmd/scripts/dtest.pl Wed Jul 18 09:53:20 2012 (r238581) +++ vendor/illumos/dist/cmd/dtrace/test/cmd/scripts/dtest.pl Wed Jul 18 10:19:06 2012 (r238582) @@ -25,6 +25,9 @@ # Use is subject to license terms. # +# +# Copyright (c) 2011, Joyent, Inc. All rights reserved. +# require 5.8.4; use File::Find; @@ -35,8 +38,8 @@ use Cwd 'abs_path'; $PNAME = $0; $PNAME =~ s:.*/::; -$OPTSTR = 'abd:fghi:jlnqsx:'; -$USAGE = "Usage: $PNAME [-abfghjlnqs] [-d dir] [-i isa] " +$OPTSTR = 'abd:fFghi:jlnqsx:'; +$USAGE = "Usage: $PNAME [-abfFghjlnqs] [-d dir] [-i isa] " . "[-x opt[=arg]] [file | dir ...]\n"; ($MACH = `uname -p`) =~ s/\W*\n//; ($PLATFORM = `uname -i`) =~ s/\W*\n//; @@ -69,6 +72,20 @@ sub dirname { return $i == -1 ? '.' : $i == 0 ? '/' : $s; } +sub inpath +{ + my ($exec) = (@_); + my @path = File::Spec->path(); + + for my $dir (@path) { + if (-x $dir . "/" . $exec) { + return 1; + } + } + + return 0; +} + sub usage { print $USAGE; @@ -77,6 +94,7 @@ sub usage print "\t -d specify directory for test results files and cores\n"; print "\t -g enable libumem debugging when running tests\n"; print "\t -f force bypassed tests to run\n"; + print "\t -F force tests to be run, even if missing dependencies\n"; print "\t -h display verbose usage message\n"; print "\t -i specify ISA to test instead of isaexec(3C) default\n"; print "\t -j execute test suite using jdtrace (Java API) only\n"; @@ -240,8 +258,8 @@ sub run_tests { my($failed) = $errs; my($total) = 0; - die "$PNAME: $dtrace not found\n" unless (-x "$dtrace"); - logmsg($dtrace . "\n"); + die "$PNAME: $dtrace not found; aborting\n" unless (-x "$dtrace"); + logmsg("executing tests using $dtrace ...\n"); load_exceptions($exceptions_path); @@ -546,9 +564,20 @@ $dt_bin = '/opt/SUNWdtrt/bin'; $defdir = -d $dt_tst ? $dt_tst : '.'; $bindir = -d $dt_bin ? $dt_bin : '.'; +if (!$opt_F) { + my @dependencies = ("gcc", "make", "java", "perl"); + + for my $dep (@dependencies) { + if (!inpath($dep)) { + die "$PNAME: '$dep' not found (use -F to force run)\n"; + } + } +} + find(\&wanted, "$defdir/common") if (scalar(@ARGV) == 0); find(\&wanted, "$defdir/$MACH") if (scalar(@ARGV) == 0); find(\&wanted, "$defdir/$PLATFORM") if (scalar(@ARGV) == 0); + die $USAGE if (scalar(@files) == 0); $dtrace_path = '/usr/sbin/dtrace'; @@ -562,7 +591,7 @@ if ($opt_j || $opt_n || $opt_i) { push(@dtrace_cmds, $jdtrace_path) if ($opt_j); push(@dtrace_cmds, "/usr/sbin/$opt_i/dtrace") if ($opt_i); } else { - @dtrace_cmds = ($dtrace_path, $jdtrace_path); + @dtrace_cmds = ($dtrace_path); } if ($opt_d) { @@ -589,12 +618,6 @@ if ($opt_g) { $ENV{'LD_PRELOAD'} = 'libumem.so'; } -# -# Ensure that $PATH contains a cc(1) so that we can execute the -# test programs that require compilation of C code. -# -$ENV{'PATH'} = $ENV{'PATH'} . ':/ws/onnv-tools/SUNWspro/SS11/bin'; - if ($opt_b) { logmsg("badioctl'ing ... "); Added: vendor/illumos/dist/cmd/dtrace/test/cmd/scripts/dtfailures.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/cmd/scripts/dtfailures.ksh Wed Jul 18 10:19:06 2012 (r238582) @@ -0,0 +1,42 @@ +#!/usr/bin/ksh -p +# +# CDDL HEADER START +# +# 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] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2011, Joyent, Inc. All rights reserved. +# + +let failure=0 + +printf "%-3s %-10s %-31s %s\n" "#" "KIND" "TEST" "DETAILS" + +while [[ -d failure.$failure ]]; do + dir=failure.$failure + tst=`cat $dir/README | head -1 | nawk '{ print $2 }'` + kind=`basename $(dirname $tst)` + name=`basename $tst` + cols=$(expr `tput cols` - 47) + details=`tail -1 $dir/*.err | cut -c1-$cols` + printf "%-3d %-10s %-31s " $failure $kind $name + echo $details + let failure=failure+1 +done + Modified: vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs/tst.subr.d ============================================================================== --- vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs/tst.subr.d Wed Jul 18 09:53:20 2012 (r238581) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs/tst.subr.d Wed Jul 18 10:19:06 2012 (r238582) @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #define INTFUNC(x) \ @@ -98,6 +96,8 @@ INTFUNC(ntohll(0x1234567890abcdefL)) STRFUNC(inet_ntoa((ipaddr_t *)alloca(sizeof (ipaddr_t)))) STRFUNC(inet_ntoa6((in6_addr_t *)alloca(sizeof (in6_addr_t)))) STRFUNC(inet_ntop(AF_INET, (void *)alloca(sizeof (ipaddr_t)))) +STRFUNC(toupper("foo")) +STRFUNC(tolower("BAR")) BEGIN /subr == DIF_SUBR_MAX + 1/ Modified: vendor/illumos/dist/cmd/dtrace/test/tst/common/buffering/tst.resize1.d ============================================================================== --- vendor/illumos/dist/cmd/dtrace/test/tst/common/buffering/tst.resize1.d Wed Jul 18 09:53:20 2012 (r238581) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/buffering/tst.resize1.d Wed Jul 18 10:19:06 2012 (r238582) @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * ASSERTION: * Checks that setting "bufresize" to "auto" will cause buffer @@ -34,14 +32,8 @@ * SECTION: Buffers and Buffering/Buffer Resizing Policy; * Options and Tunables/bufsize; * Options and Tunables/bufresize - * - * NOTES: - * We use the undocumented "preallocate" option to make sure dtrace(1M) - * has enough space in its heap to allocate a buffer as large as the - * kernel's trace buffer. */ -#pragma D option preallocate=100t #pragma D option bufresize=auto #pragma D option bufsize=100t Modified: vendor/illumos/dist/cmd/dtrace/test/tst/common/buffering/tst.resize2.d ============================================================================== --- vendor/illumos/dist/cmd/dtrace/test/tst/common/buffering/tst.resize2.d Wed Jul 18 09:53:20 2012 (r238581) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/buffering/tst.resize2.d Wed Jul 18 10:19:06 2012 (r238582) @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * ASSERTION: * Checks that setting "bufresize" to "auto" will cause buffer @@ -34,14 +32,8 @@ * SECTION: Buffers and Buffering/Buffer Resizing Policy; * Options and Tunables/aggsize; * Options and Tunables/bufresize - * - * NOTES: - * We use the undocumented "preallocate" option to make sure dtrace(1M) - * has enough space in its heap to allocate a buffer as large as the - * kernel's trace buffer. */ -#pragma D option preallocate=100t #pragma D option bufresize=auto #pragma D option aggsize=100t Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.tolower.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.tolower.d Wed Jul 18 10:19:06 2012 (r238582) @@ -0,0 +1,30 @@ +/* + * CDDL HEADER START + * + * 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] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2011, Joyent, Inc. All rights reserved. + */ + +BEGIN +{ + trace(tolower(2152006)); + exit(1); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.toupper.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.toupper.d Wed Jul 18 10:19:06 2012 (r238582) @@ -0,0 +1,30 @@ +/* + * CDDL HEADER START + * + * 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] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2011, Joyent, Inc. All rights reserved. + */ + +BEGIN +{ + trace(toupper(timestamp)); + exit(1); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.tolower.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.tolower.d Wed Jul 18 10:19:06 2012 (r238582) @@ -0,0 +1,30 @@ +/* + * CDDL HEADER START + * + * 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] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2011, Joyent, Inc. All rights reserved. + */ + +BEGIN +{ + trace(tolower()); + exit(1); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.tolowertoomany.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.tolowertoomany.d Wed Jul 18 10:19:06 2012 (r238582) @@ -0,0 +1,30 @@ +/* + * CDDL HEADER START + * + * 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] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2011, Joyent, Inc. All rights reserved. + */ + +BEGIN +{ + trace(tolower("dory", "eel", "roughy")); + exit(1); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.toupper.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.toupper.d Wed Jul 18 10:19:06 2012 (r238582) @@ -0,0 +1,30 @@ +/* + * CDDL HEADER START + * + * 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] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2011, Joyent, Inc. All rights reserved. + */ + +BEGIN +{ + trace(toupper()); + exit(1); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.touppertoomany.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.touppertoomany.d Wed Jul 18 10:19:06 2012 (r238582) @@ -0,0 +1,30 @@ +/* + * CDDL HEADER START + * + * 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] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2011, Joyent, Inc. All rights reserved. + */ + +BEGIN +{ + trace(tolower("haino", "tylo")); + exit(1); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/tst.lltostrbase.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/tst.lltostrbase.d Wed Jul 18 10:19:06 2012 (r238582) @@ -0,0 +1,80 @@ +/* + * CDDL HEADER START + * + * 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] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2011, Joyent, Inc. All rights reserved. + */ + +#pragma D option quiet + +int64_t val[int]; + +BEGIN +{ + base = -2; + i = 0; + val[i++] = -10; + val[i++] = -1; + val[i++] = 0; + val[i++] = 10; + val[i++] = 100; + val[i++] = 1000; + val[i++] = (1LL << 62); + maxval = i; + i = 0; +} + +tick-1ms +/i < maxval/ +{ + printf("base %2d of %20d: ", base, val[i]); +} + +tick-1ms +/i < maxval/ +{ + printf(" %s\n", lltostr(val[i], base)); +} + +ERROR +{ + printf(" \n"); +} + +tick-1ms +/i < maxval/ +{ + i++; +} + +tick-1ms +/i == maxval/ +{ + i = 0; + base++; +} + +tick-1ms +/base > 40/ +{ + exit(0); +} + Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/tst.lltostrbase.d.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/tst.lltostrbase.d.out Wed Jul 18 10:19:06 2012 (r238582) @@ -0,0 +1,302 @@ +base -2 of -10: +base -2 of -1: +base -2 of 0: +base -2 of 10: +base -2 of 100: +base -2 of 1000: +base -2 of 4611686018427387904: +base -1 of -10: +base -1 of -1: +base -1 of 0: +base -1 of 10: +base -1 of 100: +base -1 of 1000: +base -1 of 4611686018427387904: +base 0 of -10: +base 0 of -1: +base 0 of 0: +base 0 of 10: +base 0 of 100: +base 0 of 1000: +base 0 of 4611686018427387904: +base 1 of -10: +base 1 of -1: +base 1 of 0: +base 1 of 10: +base 1 of 100: +base 1 of 1000: +base 1 of 4611686018427387904: +base 2 of -10: 1111111111111111111111111111111111111111111111111111111111110110 +base 2 of -1: 1111111111111111111111111111111111111111111111111111111111111111 +base 2 of 0: 0 +base 2 of 10: 1010 +base 2 of 100: 1100100 +base 2 of 1000: 1111101000 +base 2 of 4611686018427387904: 100000000000000000000000000000000000000000000000000000000000000 +base 3 of -10: 11112220022122120101211020120210210211120 +base 3 of -1: 11112220022122120101211020120210210211220 +base 3 of 0: 0 +base 3 of 10: 101 +base 3 of 100: 10201 +base 3 of 1000: 1101001 +base 3 of 4611686018427387904: 1010201120122220002201001122110012110111 +base 4 of -10: 33333333333333333333333333333312 +base 4 of -1: 33333333333333333333333333333333 +base 4 of 0: 0 +base 4 of 10: 22 +base 4 of 100: 1210 +base 4 of 1000: 33220 +base 4 of 4611686018427387904: 10000000000000000000000000000000 +base 5 of -10: 2214220303114400424121122411 +base 5 of -1: 2214220303114400424121122430 +base 5 of 0: 0 +base 5 of 10: 20 +base 5 of 100: 400 +base 5 of 1000: 13000 +base 5 of 4611686018427387904: 302141200402211214402403104 +base 6 of -10: 3520522010102100444244410 +base 6 of -1: 3520522010102100444244423 +base 6 of 0: 0 +base 6 of 10: 14 +base 6 of 100: 244 +base 6 of 1000: 4344 +base 6 of 4611686018427387904: 550120301313313111041104 +base 7 of -10: 45012021522523134134556 +base 7 of -1: 45012021522523134134601 +base 7 of 0: 0 +base 7 of 10: 13 +base 7 of 100: 202 +base 7 of 1000: 2626 +base 7 of 4611686018427387904: 11154003640456024361134 +base 8 of -10: 01777777777777777777766 +base 8 of -1: 01777777777777777777777 +base 8 of 0: 0 +base 8 of 10: 012 +base 8 of 100: 0144 +base 8 of 1000: 01750 +base 8 of 4611686018427387904: 0400000000000000000000 +base 9 of -10: 145808576354216723746 +base 9 of -1: 145808576354216723756 +base 9 of 0: 0 +base 9 of 10: 11 +base 9 of 100: 121 +base 9 of 1000: 1331 +base 9 of 4611686018427387904: 33646586081048405414 +base 10 of -10: -10 +base 10 of -1: -1 +base 10 of 0: 0 +base 10 of 10: 10 +base 10 of 100: 100 +base 10 of 1000: 1000 +base 10 of 4611686018427387904: 4611686018427387904 +base 11 of -10: 335500516a429071276 +base 11 of -1: 335500516a429071284 +base 11 of 0: 0 +base 11 of 10: a +base 11 of 100: 91 +base 11 of 1000: 82a +base 11 of 4611686018427387904: 9140013181078458a4 +base 12 of -10: 839365134a2a240706 +base 12 of -1: 839365134a2a240713 +base 12 of 0: 0 +base 12 of 10: a +base 12 of 100: 84 +base 12 of 1000: 6b4 +base 12 of 4611686018427387904: 20b3a733a268670194 +base 13 of -10: 219505a9511a867b66 +base 13 of -1: 219505a9511a867b72 +base 13 of 0: 0 +base 13 of 10: a +base 13 of 100: 79 +base 13 of 1000: 5bc +base 13 of 4611686018427387904: 6c1349246a2881c84 +base 14 of -10: 8681049adb03db166 +base 14 of -1: 8681049adb03db171 +base 14 of 0: 0 +base 14 of 10: a +base 14 of 100: 72 +base 14 of 1000: 516 +base 14 of 4611686018427387904: 219038263637dd3c4 +base 15 of -10: 2c1d56b648c6cd106 +base 15 of -1: 2c1d56b648c6cd110 +base 15 of 0: 0 +base 15 of 10: a +base 15 of 100: 6a +base 15 of 1000: 46a +base 15 of 4611686018427387904: a7e8ce189a933404 +base 16 of -10: 0xfffffffffffffff6 +base 16 of -1: 0xffffffffffffffff +base 16 of 0: 0x0 +base 16 of 10: 0xa +base 16 of 100: 0x64 +base 16 of 1000: 0x3e8 +base 16 of 4611686018427387904: 0x4000000000000000 +base 17 of -10: 67979g60f5428008 +base 17 of -1: 67979g60f5428010 +base 17 of 0: 0 +base 17 of 10: a +base 17 of 100: 5f +base 17 of 1000: 37e +base 17 of 4611686018427387904: 1a6a6ca03e10a88d +base 18 of -10: 2d3fgb0b9cg4bd26 +base 18 of -1: 2d3fgb0b9cg4bd2f +base 18 of 0: 0 +base 18 of 10: a +base 18 of 100: 5a +base 18 of 1000: 31a +base 18 of 4611686018427387904: c588bdbfgd12ge4 +base 19 of -10: 141c8786h1ccaag7 +base 19 of -1: 141c8786h1ccaagg +base 19 of 0: 0 +base 19 of 10: a +base 19 of 100: 55 +base 19 of 1000: 2ec +base 19 of 4611686018427387904: 5ecbb6fi9h7ggi9 +base 20 of -10: b53bjh07be4dj06 +base 20 of -1: b53bjh07be4dj0f +base 20 of 0: 0 +base 20 of 10: a +base 20 of 100: 50 +base 20 of 1000: 2a0 +base 20 of 4611686018427387904: 2g5hjj51hib39f4 +base 21 of -10: 5e8g4ggg7g56di6 +base 21 of -1: 5e8g4ggg7g56dif +base 21 of 0: 0 +base 21 of 10: a +base 21 of 100: 4g +base 21 of 1000: 25d +base 21 of 4611686018427387904: 18hjgjjjhebh8f4 +base 22 of -10: 2l4lf104353j8k6 +base 22 of -1: 2l4lf104353j8kf +base 22 of 0: 0 +base 22 of 10: a +base 22 of 100: 4c +base 22 of 1000: 21a +base 22 of 4611686018427387904: g6g95gc0hha7g4 +base 23 of -10: 1ddh88h2782i50j +base 23 of -1: 1ddh88h2782i515 +base 23 of 0: 0 +base 23 of 10: a +base 23 of 100: 48 +base 23 of 1000: 1kb +base 23 of 4611686018427387904: 93a22467dc4chd +base 24 of -10: l12ee5fn0ji1i6 +base 24 of -1: l12ee5fn0ji1if +base 24 of 0: 0 +base 24 of 10: a +base 24 of 100: 44 +base 24 of 1000: 1hg +base 24 of 4611686018427387904: 566ffd9ni4mcag +base 25 of -10: c9c336o0mlb7e6 +base 25 of -1: c9c336o0mlb7ef +base 25 of 0: 0 +base 25 of 10: a +base 25 of 100: 40 +base 25 of 1000: 1f0 +base 25 of 4611686018427387904: 32970kc6bo2kg4 +base 26 of -10: 7b7n2pcniokcg6 +base 26 of -1: 7b7n2pcniokcgf +base 26 of 0: 0 +base 26 of 10: a +base 26 of 100: 3m +base 26 of 1000: 1cc +base 26 of 4611686018427387904: 1m8c769io65344 +base 27 of -10: 4eo8hfam6fllmf +base 27 of -1: 4eo8hfam6fllmo +base 27 of 0: 0 +base 27 of 10: a +base 27 of 100: 3j +base 27 of 1000: 1a1 +base 27 of 4611686018427387904: 13jfho2j1hc5cd +base 28 of -10: 2nc6j26l66rho6 +base 28 of -1: 2nc6j26l66rhof +base 28 of 0: 0 +base 28 of 10: a +base 28 of 100: 3g +base 28 of 1000: 17k +base 28 of 4611686018427387904: jo1ilfj8fkpd4 +base 29 of -10: 1n3rsh11f098re +base 29 of -1: 1n3rsh11f098rn +base 29 of 0: 0 +base 29 of 10: a +base 29 of 100: 3d +base 29 of 1000: 15e +base 29 of 4611686018427387904: d0slim0b029e6 +base 30 of -10: 14l9lkmo30o406 +base 30 of -1: 14l9lkmo30o40f +base 30 of 0: 0 +base 30 of 10: a +base 30 of 100: 3a +base 30 of 1000: 13a +base 30 of 4611686018427387904: 8k9rrkl0ml104 +base 31 of -10: nd075ib45k866 +base 31 of -1: nd075ib45k86f +base 31 of 0: 0 +base 31 of 10: a +base 31 of 100: 37 +base 31 of 1000: 118 +base 31 of 4611686018427387904: 5qfh94i8okhh4 +base 32 of -10: fvvvvvvvvvvvm +base 32 of -1: fvvvvvvvvvvvv +base 32 of 0: 0 +base 32 of 10: a +base 32 of 100: 34 +base 32 of 1000: v8 +base 32 of 4611686018427387904: 4000000000000 +base 33 of -10: b1w8p7j5q9r66 +base 33 of -1: b1w8p7j5q9r6f +base 33 of 0: 0 +base 33 of 10: a +base 33 of 100: 31 +base 33 of 1000: ua +base 33 of 4611686018427387904: 2p826a4q6ivi4 +base 34 of -10: 7orp63sh4dph8 +base 34 of -1: 7orp63sh4dphh +base 34 of 0: 0 +base 34 of 10: a +base 34 of 100: 2w +base 34 of 1000: te +base 34 of 4611686018427387904: 1vnvr0wl9ketu +base 35 of -10: 5g24a25twkwf6 +base 35 of -1: 5g24a25twkwff +base 35 of 0: 0 +base 35 of 10: a +base 35 of 100: 2u +base 35 of 1000: sk +base 35 of 4611686018427387904: 1cqrb9a7gvgu4 +base 36 of -10: 3w5e11264sgs6 +base 36 of -1: 3w5e11264sgsf +base 36 of 0: 0 +base 36 of 10: a +base 36 of 100: 2s +base 36 of 1000: rs +base 36 of 4611686018427387904: z1ci99jj7474 +base 37 of -10: +base 37 of -1: +base 37 of 0: +base 37 of 10: +base 37 of 100: +base 37 of 1000: +base 37 of 4611686018427387904: +base 38 of -10: +base 38 of -1: +base 38 of 0: +base 38 of 10: +base 38 of 100: +base 38 of 1000: +base 38 of 4611686018427387904: +base 39 of -10: +base 39 of -1: +base 39 of 0: +base 39 of 10: +base 39 of 100: +base 39 of 1000: +base 39 of 4611686018427387904: +base 40 of -10: +base 40 of -1: +base 40 of 0: +base 40 of 10: +base 40 of 100: +base 40 of 1000: +base 40 of 4611686018427387904: + Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/tst.tolower.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/tst.tolower.d Wed Jul 18 10:19:06 2012 (r238582) @@ -0,0 +1,66 @@ +/* + * CDDL HEADER START + * + * 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] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2011, Joyent, Inc. All rights reserved. + */ + +#pragma D option quiet + +BEGIN +{ + i = 0; + + input[i] = "ahi"; + expected[i++] = "ahi"; + + input[i] = "MaHi!"; + expected[i++] = "mahi!"; + + input[i] = " Nase-5"; + expected[i++] = " nase-5"; + + input[i] = "!@#$%"; + expected[i++] = "!@#$%"; + + i = 0; +} + +tick-1ms +/input[i] != NULL && (this->out = tolower(input[i])) != expected[i]/ +{ + printf("expected tolower(\"%s\") to be \"%s\"; found \"%s\"\n", + input[i], expected[i], this->out); + exit(1); +} + +tick-1ms +/input[i] != NULL/ +{ + printf("tolower(\"%s\") is \"%s\", as expected\n", + input[i], expected[i]); +} + +tick-1ms +/input[i++] == NULL/ +{ + exit(0); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/tst.toupper.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/funcs/tst.toupper.d Wed Jul 18 10:19:06 2012 (r238582) @@ -0,0 +1,66 @@ +/* + * CDDL HEADER START + * + * 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. + * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 10:19:51 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9A2FB10656A7; Wed, 18 Jul 2012 10:19:51 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81A828FC14; Wed, 18 Jul 2012 10:19:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IAJpH4054643; Wed, 18 Jul 2012 10:19:51 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IAJpp0054639; Wed, 18 Jul 2012 10:19:51 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207181019.q6IAJpp0054639@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 10:19:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238583 - in vendor/illumos/dist: cmd/zdb cmd/zfs cmd/zpool cmd/ztest lib/libnvpair lib/libuutil/common lib/libzfs/common lib/libzpool/common lib/libzpool/common/sys man/man1m X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 10:19:51 -0000 Author: mm Date: Wed Jul 18 10:19:51 2012 New Revision: 238583 URL: http://svn.freebsd.org/changeset/base/238583 Log: Update vendor/illumos/dist to pre libzfs_core state (zfs part) illumos-gate revision 13742:b6bbdd77139c Obtained from: ssh://anonhg@hg.illumos.org/illumos-gate Added: vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c Deleted: vendor/illumos/dist/lib/libzfs/common/libzfs_graph.c Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/zfs/zfs_main.c vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/cmd/ztest/ztest.c vendor/illumos/dist/lib/libnvpair/libnvpair.c vendor/illumos/dist/lib/libuutil/common/uu_list.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_config.c vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs/common/libzfs_impl.h vendor/illumos/dist/lib/libzfs/common/libzfs_import.c vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c vendor/illumos/dist/lib/libzfs/common/libzfs_status.c vendor/illumos/dist/lib/libzfs/common/libzfs_util.c vendor/illumos/dist/lib/libzpool/common/kernel.c vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h vendor/illumos/dist/lib/libzpool/common/taskq.c vendor/illumos/dist/man/man1m/zdb.1m vendor/illumos/dist/man/man1m/zfs.1m vendor/illumos/dist/man/man1m/zpool.1m vendor/illumos/dist/man/man1m/zstreamdump.1m Modified: vendor/illumos/dist/cmd/zdb/zdb.c ============================================================================== --- vendor/illumos/dist/cmd/zdb/zdb.c Wed Jul 18 10:19:06 2012 (r238582) +++ vendor/illumos/dist/cmd/zdb/zdb.c Wed Jul 18 10:19:51 2012 (r238583) @@ -18,8 +18,10 @@ * * CDDL HEADER END */ + /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -54,6 +56,7 @@ #include #include #include +#include #undef ZFS_MAXNAMELEN #undef verify #include @@ -63,7 +66,8 @@ #define ZDB_CHECKSUM_NAME(idx) ((idx) < ZIO_CHECKSUM_FUNCTIONS ? \ zio_checksum_table[(idx)].ci_name : "UNKNOWN") #define ZDB_OT_NAME(idx) ((idx) < DMU_OT_NUMTYPES ? \ - dmu_ot[(idx)].ot_name : "UNKNOWN") + dmu_ot[(idx)].ot_name : DMU_OT_IS_VALID(idx) ? \ + dmu_ot_byteswap[DMU_OT_BYTESWAP(idx)].ob_name : "UNKNOWN") #define ZDB_OT_TYPE(idx) ((idx) < DMU_OT_NUMTYPES ? (idx) : DMU_OT_NUMTYPES) #ifndef lint @@ -102,13 +106,16 @@ static void usage(void) { (void) fprintf(stderr, - "Usage: %s [-CumdibcsDvhL] poolname [object...]\n" - " %s [-div] dataset [object...]\n" - " %s -m [-L] poolname [vdev [metaslab...]]\n" - " %s -R poolname vdev:offset:size[:flags]\n" - " %s -S poolname\n" - " %s -l [-u] device\n" - " %s -C\n\n", + "Usage: %s [-CumdibcsDvhLXFPA] [-t txg] [-e [-p path...]] " + "poolname [object...]\n" + " %s [-divPA] [-e -p path...] dataset [object...]\n" + " %s -m [-LXFPA] [-t txg] [-e [-p path...]] " + "poolname [vdev [metaslab...]]\n" + " %s -R [-A] [-e [-p path...]] poolname " + "vdev:offset:size[:flags]\n" + " %s -S [-PA] [-e [-p path...]] poolname\n" + " %s -l [-uA] device\n" + " %s -C [-A] [-U config]\n\n", cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname); (void) fprintf(stderr, " Dataset name must include at least one " @@ -150,7 +157,7 @@ usage(void) "has altroot/not in a cachefile\n"); (void) fprintf(stderr, " -p -- use one or more with " "-e to specify path to vdev dir\n"); - (void) fprintf(stderr, " -P print numbers parsable\n"); + (void) fprintf(stderr, " -P print numbers in parseable form\n"); (void) fprintf(stderr, " -t -- highest txg to use when " "searching for uberblocks\n"); (void) fprintf(stderr, "Specify an option more than once (e.g. -bb) " @@ -1085,7 +1092,7 @@ dump_dsl_dataset(objset_t *os, uint64_t ASSERT(size == sizeof (*ds)); crtime = ds->ds_creation_time; - zdb_nicenum(ds->ds_used_bytes, used); + zdb_nicenum(ds->ds_referenced_bytes, used); zdb_nicenum(ds->ds_compressed_bytes, compressed); zdb_nicenum(ds->ds_uncompressed_bytes, uncompressed); zdb_nicenum(ds->ds_unique_bytes, unique); @@ -1129,6 +1136,44 @@ dump_dsl_dataset(objset_t *os, uint64_t /* ARGSUSED */ static int +dump_bptree_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) +{ + char blkbuf[BP_SPRINTF_LEN]; + + if (bp->blk_birth != 0) { + sprintf_blkptr(blkbuf, bp); + (void) printf("\t%s\n", blkbuf); + } + return (0); +} + +static void +dump_bptree(objset_t *os, uint64_t obj, char *name) +{ + char bytes[32]; + bptree_phys_t *bt; + dmu_buf_t *db; + + if (dump_opt['d'] < 3) + return; + + VERIFY3U(0, ==, dmu_bonus_hold(os, obj, FTAG, &db)); + bt = db->db_data; + zdb_nicenum(bt->bt_bytes, bytes); + (void) printf("\n %s: %llu datasets, %s\n", + name, (unsigned long long)(bt->bt_end - bt->bt_begin), bytes); + dmu_buf_rele(db, FTAG); + + if (dump_opt['d'] < 5) + return; + + (void) printf("\n"); + + (void) bptree_iterate(os, obj, B_FALSE, dump_bptree_cb, NULL, NULL); +} + +/* ARGSUSED */ +static int dump_bpobj_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) { char blkbuf[BP_SPRINTF_LEN]; @@ -1880,11 +1925,13 @@ typedef struct zdb_blkstats { */ #define ZDB_OT_DEFERRED (DMU_OT_NUMTYPES + 0) #define ZDB_OT_DITTO (DMU_OT_NUMTYPES + 1) -#define ZDB_OT_TOTAL (DMU_OT_NUMTYPES + 2) +#define ZDB_OT_OTHER (DMU_OT_NUMTYPES + 2) +#define ZDB_OT_TOTAL (DMU_OT_NUMTYPES + 3) static char *zdb_ot_extname[] = { "deferred free", "dedup ditto", + "other", "Total", }; @@ -1965,9 +2012,10 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog type = BP_GET_TYPE(bp); - zdb_count_block(zcb, zilog, bp, type); + zdb_count_block(zcb, zilog, bp, + (type & DMU_OT_NEWTYPE) ? ZDB_OT_OTHER : type); - is_metadata = (BP_GET_LEVEL(bp) != 0 || dmu_ot[type].ot_metadata); + is_metadata = (BP_GET_LEVEL(bp) != 0 || DMU_OT_IS_METADATA(type)); if (dump_opt['c'] > 1 || (dump_opt['c'] && is_metadata)) { int ioerr; @@ -2192,6 +2240,12 @@ dump_block_stats(spa_t *spa) count_block_cb, &zcb, NULL); (void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj, count_block_cb, &zcb, NULL); + if (spa_feature_is_active(spa, + &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) { + VERIFY3U(0, ==, bptree_iterate(spa->spa_meta_objset, + spa->spa_dsl_pool->dp_bptree_obj, B_FALSE, count_block_cb, + &zcb, NULL)); + } if (dump_opt['c'] > 1) flags |= TRAVERSE_PREFETCH_DATA; @@ -2368,7 +2422,7 @@ zdb_ddt_add_cb(spa_t *spa, zilog_t *zilo } if (BP_IS_HOLE(bp) || BP_GET_CHECKSUM(bp) == ZIO_CHECKSUM_OFF || - BP_GET_LEVEL(bp) > 0 || dmu_ot[BP_GET_TYPE(bp)].ot_metadata) + BP_GET_LEVEL(bp) > 0 || DMU_OT_IS_METADATA(BP_GET_TYPE(bp))) return (0); ddt_key_fill(&zdde_search.zdde_key, bp); @@ -2473,7 +2527,14 @@ dump_zpool(spa_t *spa) dump_bpobj(&spa->spa_deferred_bpobj, "Deferred frees"); if (spa_version(spa) >= SPA_VERSION_DEADLISTS) { dump_bpobj(&spa->spa_dsl_pool->dp_free_bpobj, - "Pool frees"); + "Pool snapshot frees"); + } + + if (spa_feature_is_active(spa, + &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) { + dump_bptree(spa->spa_meta_objset, + spa->spa_dsl_pool->dp_bptree_obj, + "Pool dataset frees"); } dump_dtl(spa->spa_root_vdev, 0); } Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c ============================================================================== --- vendor/illumos/dist/cmd/zfs/zfs_main.c Wed Jul 18 10:19:06 2012 (r238582) +++ vendor/illumos/dist/cmd/zfs/zfs_main.c Wed Jul 18 10:19:51 2012 (r238583) @@ -21,6 +21,10 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright 2012 Milan Jurik. All rights reserved. + * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ #include @@ -41,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -51,7 +56,11 @@ #include #include +#include +#include #include +#include +#include #include "zfs_iter.h" #include "zfs_util.h" @@ -61,7 +70,6 @@ libzfs_handle_t *g_zfs; static FILE *mnttab_file; static char history_str[HIS_MAX_RECORD_LEN]; -const char *pypath = "/usr/lib/zfs/pyzfs.py"; static int zfs_do_clone(int argc, char **argv); static int zfs_do_create(int argc, char **argv); @@ -82,8 +90,10 @@ static int zfs_do_send(int argc, char ** static int zfs_do_receive(int argc, char **argv); static int zfs_do_promote(int argc, char **argv); static int zfs_do_userspace(int argc, char **argv); -static int zfs_do_python(int argc, char **argv); +static int zfs_do_allow(int argc, char **argv); +static int zfs_do_unallow(int argc, char **argv); static int zfs_do_hold(int argc, char **argv); +static int zfs_do_holds(int argc, char **argv); static int zfs_do_release(int argc, char **argv); static int zfs_do_diff(int argc, char **argv); @@ -131,7 +141,7 @@ typedef enum { HELP_HOLD, HELP_HOLDS, HELP_RELEASE, - HELP_DIFF + HELP_DIFF, } zfs_help_t; typedef struct zfs_command { @@ -176,12 +186,12 @@ static zfs_command_t command_table[] = { { "send", zfs_do_send, HELP_SEND }, { "receive", zfs_do_receive, HELP_RECEIVE }, { NULL }, - { "allow", zfs_do_python, HELP_ALLOW }, + { "allow", zfs_do_allow, HELP_ALLOW }, { NULL }, - { "unallow", zfs_do_python, HELP_UNALLOW }, + { "unallow", zfs_do_unallow, HELP_UNALLOW }, { NULL }, { "hold", zfs_do_hold, HELP_HOLD }, - { "holds", zfs_do_python, HELP_HOLDS }, + { "holds", zfs_do_holds, HELP_HOLDS }, { "release", zfs_do_release, HELP_RELEASE }, { "diff", zfs_do_diff, HELP_DIFF }, }; @@ -203,11 +213,13 @@ get_usage(zfs_help_t idx) "\tcreate [-ps] [-b blocksize] [-o property=value] ... " "-V \n")); case HELP_DESTROY: - return (gettext("\tdestroy [-rRf] \n" - "\tdestroy [-rRd] \n")); + return (gettext("\tdestroy [-fnpRrv] \n" + "\tdestroy [-dnpRrv] " + "@[%][,...]\n")); case HELP_GET: return (gettext("\tget [-rHp] [-d max] " - "[-o \"all\" | field[,...]] [-s source[,...]]\n" + "[-o \"all\" | field[,...]] [-t type[,...]] " + "[-s source[,...]]\n" "\t <\"all\" | property[,...]> " "[filesystem|volume|snapshot] ...\n")); case HELP_INHERIT: @@ -231,14 +243,15 @@ get_usage(zfs_help_t idx) "snapshot>\n" "\treceive [-vnFu] [-d | -e] \n")); case HELP_RENAME: - return (gettext("\trename " + return (gettext("\trename [-f] " "\n" - "\trename -p \n" + "\trename [-f] -p \n" "\trename -r ")); case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: - return (gettext("\tsend [-RDp] [-[iI] snapshot] \n")); + return (gettext("\tsend [-DnPpRrv] [-[iI] snapshot] " + "\n")); case HELP_SET: return (gettext("\tset " " ...\n")); @@ -417,6 +430,8 @@ usage(boolean_t requested) (void) fprintf(fp, "YES NO | none\n"); (void) fprintf(fp, "\t%-15s ", "groupquota@..."); (void) fprintf(fp, "YES NO | none\n"); + (void) fprintf(fp, "\t%-15s ", "written@"); + (void) fprintf(fp, " NO NO \n"); (void) fprintf(fp, gettext("\nSizes are specified in bytes " "with standard units such as K, M, G, etc.\n")); @@ -562,7 +577,7 @@ zfs_do_clone(int argc, char **argv) zfs_handle_t *zhp = NULL; boolean_t parents = B_FALSE; nvlist_t *props; - int ret; + int ret = 0; int c; if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0) @@ -729,7 +744,6 @@ zfs_do_create(int argc, char **argv) (void) fprintf(stderr, gettext("missing size " "argument\n")); goto badusage; - break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); @@ -862,15 +876,23 @@ badusage: */ typedef struct destroy_cbdata { boolean_t cb_first; - int cb_force; - int cb_recurse; - int cb_error; - int cb_needforce; - int cb_doclones; - boolean_t cb_closezhp; + boolean_t cb_force; + boolean_t cb_recurse; + boolean_t cb_error; + boolean_t cb_doclones; zfs_handle_t *cb_target; - char *cb_snapname; boolean_t cb_defer_destroy; + boolean_t cb_verbose; + boolean_t cb_parsable; + boolean_t cb_dryrun; + nvlist_t *cb_nvl; + + /* first snap in contiguous run */ + zfs_handle_t *cb_firstsnap; + /* previous snap in contiguous run */ + zfs_handle_t *cb_prevsnap; + int64_t cb_snapused; + char *cb_snapspec; } destroy_cbdata_t; /* @@ -900,7 +922,7 @@ destroy_check_dependent(zfs_handle_t *zh (void) fprintf(stderr, gettext("use '-r' to destroy " "the following datasets:\n")); cbp->cb_first = B_FALSE; - cbp->cb_error = 1; + cbp->cb_error = B_TRUE; } (void) fprintf(stderr, "%s\n", zfs_get_name(zhp)); @@ -921,7 +943,8 @@ destroy_check_dependent(zfs_handle_t *zh (void) fprintf(stderr, gettext("use '-R' to destroy " "the following datasets:\n")); cbp->cb_first = B_FALSE; - cbp->cb_error = 1; + cbp->cb_error = B_TRUE; + cbp->cb_dryrun = B_TRUE; } (void) fprintf(stderr, "%s\n", zfs_get_name(zhp)); @@ -935,7 +958,20 @@ out: static int destroy_callback(zfs_handle_t *zhp, void *data) { - destroy_cbdata_t *cbp = data; + destroy_cbdata_t *cb = data; + const char *name = zfs_get_name(zhp); + + if (cb->cb_verbose) { + if (cb->cb_parsable) { + (void) printf("destroy\t%s\n", name); + } else if (cb->cb_dryrun) { + (void) printf(gettext("would destroy %s\n"), + name); + } else { + (void) printf(gettext("will destroy %s\n"), + name); + } + } /* * Ignore pools (which we've already flagged as an error before getting @@ -947,13 +983,12 @@ destroy_callback(zfs_handle_t *zhp, void return (0); } - /* - * Bail out on the first error. - */ - if (zfs_unmount(zhp, NULL, cbp->cb_force ? MS_FORCE : 0) != 0 || - zfs_destroy(zhp, cbp->cb_defer_destroy) != 0) { - zfs_close(zhp); - return (-1); + if (!cb->cb_dryrun) { + if (zfs_unmount(zhp, NULL, cb->cb_force ? MS_FORCE : 0) != 0 || + zfs_destroy(zhp, cb->cb_defer_destroy) != 0) { + zfs_close(zhp); + return (-1); + } } zfs_close(zhp); @@ -961,39 +996,142 @@ destroy_callback(zfs_handle_t *zhp, void } static int -destroy_snap_clones(zfs_handle_t *zhp, void *arg) +destroy_print_cb(zfs_handle_t *zhp, void *arg) { - destroy_cbdata_t *cbp = arg; - char thissnap[MAXPATHLEN]; - zfs_handle_t *szhp; - boolean_t closezhp = cbp->cb_closezhp; - int rv; + destroy_cbdata_t *cb = arg; + const char *name = zfs_get_name(zhp); + int err = 0; - (void) snprintf(thissnap, sizeof (thissnap), - "%s@%s", zfs_get_name(zhp), cbp->cb_snapname); + if (nvlist_exists(cb->cb_nvl, name)) { + if (cb->cb_firstsnap == NULL) + cb->cb_firstsnap = zfs_handle_dup(zhp); + if (cb->cb_prevsnap != NULL) + zfs_close(cb->cb_prevsnap); + /* this snap continues the current range */ + cb->cb_prevsnap = zfs_handle_dup(zhp); + if (cb->cb_verbose) { + if (cb->cb_parsable) { + (void) printf("destroy\t%s\n", name); + } else if (cb->cb_dryrun) { + (void) printf(gettext("would destroy %s\n"), + name); + } else { + (void) printf(gettext("will destroy %s\n"), + name); + } + } + } else if (cb->cb_firstsnap != NULL) { + /* end of this range */ + uint64_t used = 0; + err = zfs_get_snapused_int(cb->cb_firstsnap, + cb->cb_prevsnap, &used); + cb->cb_snapused += used; + zfs_close(cb->cb_firstsnap); + cb->cb_firstsnap = NULL; + zfs_close(cb->cb_prevsnap); + cb->cb_prevsnap = NULL; + } + zfs_close(zhp); + return (err); +} - libzfs_print_on_error(g_zfs, B_FALSE); - szhp = zfs_open(g_zfs, thissnap, ZFS_TYPE_SNAPSHOT); - libzfs_print_on_error(g_zfs, B_TRUE); - if (szhp) { - /* - * Destroy any clones of this snapshot - */ - if (zfs_iter_dependents(szhp, B_FALSE, destroy_callback, - cbp) != 0) { - zfs_close(szhp); - if (closezhp) - zfs_close(zhp); - return (-1); +static int +destroy_print_snapshots(zfs_handle_t *fs_zhp, destroy_cbdata_t *cb) +{ + int err = 0; + assert(cb->cb_firstsnap == NULL); + assert(cb->cb_prevsnap == NULL); + err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb); + if (cb->cb_firstsnap != NULL) { + uint64_t used = 0; + if (err == 0) { + err = zfs_get_snapused_int(cb->cb_firstsnap, + cb->cb_prevsnap, &used); } - zfs_close(szhp); + cb->cb_snapused += used; + zfs_close(cb->cb_firstsnap); + cb->cb_firstsnap = NULL; + zfs_close(cb->cb_prevsnap); + cb->cb_prevsnap = NULL; } + return (err); +} - cbp->cb_closezhp = B_TRUE; - rv = zfs_iter_filesystems(zhp, destroy_snap_clones, arg); - if (closezhp) - zfs_close(zhp); - return (rv); +static int +snapshot_to_nvl_cb(zfs_handle_t *zhp, void *arg) +{ + destroy_cbdata_t *cb = arg; + int err = 0; + + /* Check for clones. */ + if (!cb->cb_doclones) { + cb->cb_target = zhp; + cb->cb_first = B_TRUE; + err = zfs_iter_dependents(zhp, B_TRUE, + destroy_check_dependent, cb); + } + + if (err == 0) { + if (nvlist_add_boolean(cb->cb_nvl, zfs_get_name(zhp))) + nomem(); + } + zfs_close(zhp); + return (err); +} + +static int +gather_snapshots(zfs_handle_t *zhp, void *arg) +{ + destroy_cbdata_t *cb = arg; + int err = 0; + + err = zfs_iter_snapspec(zhp, cb->cb_snapspec, snapshot_to_nvl_cb, cb); + if (err == ENOENT) + err = 0; + if (err != 0) + goto out; + + if (cb->cb_verbose) { + err = destroy_print_snapshots(zhp, cb); + if (err != 0) + goto out; + } + + if (cb->cb_recurse) + err = zfs_iter_filesystems(zhp, gather_snapshots, cb); + +out: + zfs_close(zhp); + return (err); +} + +static int +destroy_clones(destroy_cbdata_t *cb) +{ + nvpair_t *pair; + for (pair = nvlist_next_nvpair(cb->cb_nvl, NULL); + pair != NULL; + pair = nvlist_next_nvpair(cb->cb_nvl, pair)) { + zfs_handle_t *zhp = zfs_open(g_zfs, nvpair_name(pair), + ZFS_TYPE_SNAPSHOT); + if (zhp != NULL) { + boolean_t defer = cb->cb_defer_destroy; + int err = 0; + + /* + * We can't defer destroy non-snapshots, so set it to + * false while destroying the clones. + */ + cb->cb_defer_destroy = B_FALSE; + err = zfs_iter_dependents(zhp, B_FALSE, + destroy_callback, cb); + cb->cb_defer_destroy = defer; + zfs_close(zhp); + if (err != 0) + return (err); + } + } + return (0); } static int @@ -1002,25 +1140,35 @@ zfs_do_destroy(int argc, char **argv) destroy_cbdata_t cb = { 0 }; int c; zfs_handle_t *zhp; - char *cp; + char *at; zfs_type_t type = ZFS_TYPE_DATASET; /* check options */ - while ((c = getopt(argc, argv, "dfrR")) != -1) { + while ((c = getopt(argc, argv, "vpndfrR")) != -1) { switch (c) { + case 'v': + cb.cb_verbose = B_TRUE; + break; + case 'p': + cb.cb_verbose = B_TRUE; + cb.cb_parsable = B_TRUE; + break; + case 'n': + cb.cb_dryrun = B_TRUE; + break; case 'd': cb.cb_defer_destroy = B_TRUE; type = ZFS_TYPE_SNAPSHOT; break; case 'f': - cb.cb_force = 1; + cb.cb_force = B_TRUE; break; case 'r': - cb.cb_recurse = 1; + cb.cb_recurse = B_TRUE; break; case 'R': - cb.cb_recurse = 1; - cb.cb_doclones = 1; + cb.cb_recurse = B_TRUE; + cb.cb_doclones = B_TRUE; break; case '?': default: @@ -1035,7 +1183,7 @@ zfs_do_destroy(int argc, char **argv) /* check number of arguments */ if (argc == 0) { - (void) fprintf(stderr, gettext("missing path argument\n")); + (void) fprintf(stderr, gettext("missing dataset argument\n")); usage(B_FALSE); } if (argc > 1) { @@ -1043,91 +1191,117 @@ zfs_do_destroy(int argc, char **argv) usage(B_FALSE); } - /* - * If we are doing recursive destroy of a snapshot, then the - * named snapshot may not exist. Go straight to libzfs. - */ - if (cb.cb_recurse && (cp = strchr(argv[0], '@'))) { - int ret; + at = strchr(argv[0], '@'); + if (at != NULL) { + int err = 0; + + /* Build the list of snaps to destroy in cb_nvl. */ + if (nvlist_alloc(&cb.cb_nvl, NV_UNIQUE_NAME, 0) != 0) + nomem(); - *cp = '\0'; - if ((zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_DATASET)) == NULL) + *at = '\0'; + zhp = zfs_open(g_zfs, argv[0], + ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); + if (zhp == NULL) return (1); - *cp = '@'; - cp++; - if (cb.cb_doclones) { - boolean_t defer = cb.cb_defer_destroy; + cb.cb_snapspec = at + 1; + if (gather_snapshots(zfs_handle_dup(zhp), &cb) != 0 || + cb.cb_error) { + zfs_close(zhp); + nvlist_free(cb.cb_nvl); + return (1); + } - /* - * Temporarily ignore the defer_destroy setting since - * it's not supported for clones. - */ - cb.cb_defer_destroy = B_FALSE; - cb.cb_snapname = cp; - if (destroy_snap_clones(zhp, &cb) != 0) { - zfs_close(zhp); - return (1); + if (nvlist_empty(cb.cb_nvl)) { + (void) fprintf(stderr, gettext("could not find any " + "snapshots to destroy; check snapshot names.\n")); + zfs_close(zhp); + nvlist_free(cb.cb_nvl); + return (1); + } + + if (cb.cb_verbose) { + char buf[16]; + zfs_nicenum(cb.cb_snapused, buf, sizeof (buf)); + if (cb.cb_parsable) { + (void) printf("reclaim\t%llu\n", + cb.cb_snapused); + } else if (cb.cb_dryrun) { + (void) printf(gettext("would reclaim %s\n"), + buf); + } else { + (void) printf(gettext("will reclaim %s\n"), + buf); } - cb.cb_defer_destroy = defer; } - ret = zfs_destroy_snaps(zhp, cp, cb.cb_defer_destroy); - zfs_close(zhp); - if (ret) { - (void) fprintf(stderr, - gettext("no snapshots destroyed\n")); + if (!cb.cb_dryrun) { + if (cb.cb_doclones) + err = destroy_clones(&cb); + if (err == 0) { + err = zfs_destroy_snaps_nvl(zhp, cb.cb_nvl, + cb.cb_defer_destroy); + } } - return (ret != 0); - } - /* Open the given dataset */ - if ((zhp = zfs_open(g_zfs, argv[0], type)) == NULL) - return (1); + zfs_close(zhp); + nvlist_free(cb.cb_nvl); + if (err != 0) + return (1); + } else { + /* Open the given dataset */ + if ((zhp = zfs_open(g_zfs, argv[0], type)) == NULL) + return (1); - cb.cb_target = zhp; + cb.cb_target = zhp; - /* - * Perform an explicit check for pools before going any further. - */ - if (!cb.cb_recurse && strchr(zfs_get_name(zhp), '/') == NULL && - zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) { - (void) fprintf(stderr, gettext("cannot destroy '%s': " - "operation does not apply to pools\n"), - zfs_get_name(zhp)); - (void) fprintf(stderr, gettext("use 'zfs destroy -r " - "%s' to destroy all datasets in the pool\n"), - zfs_get_name(zhp)); - (void) fprintf(stderr, gettext("use 'zpool destroy %s' " - "to destroy the pool itself\n"), zfs_get_name(zhp)); - zfs_close(zhp); - return (1); - } + /* + * Perform an explicit check for pools before going any further. + */ + if (!cb.cb_recurse && strchr(zfs_get_name(zhp), '/') == NULL && + zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) { + (void) fprintf(stderr, gettext("cannot destroy '%s': " + "operation does not apply to pools\n"), + zfs_get_name(zhp)); + (void) fprintf(stderr, gettext("use 'zfs destroy -r " + "%s' to destroy all datasets in the pool\n"), + zfs_get_name(zhp)); + (void) fprintf(stderr, gettext("use 'zpool destroy %s' " + "to destroy the pool itself\n"), zfs_get_name(zhp)); + zfs_close(zhp); + return (1); + } - /* - * Check for any dependents and/or clones. - */ - cb.cb_first = B_TRUE; - if (!cb.cb_doclones && !cb.cb_defer_destroy && - zfs_iter_dependents(zhp, B_TRUE, destroy_check_dependent, - &cb) != 0) { - zfs_close(zhp); - return (1); - } + /* + * Check for any dependents and/or clones. + */ + cb.cb_first = B_TRUE; + if (!cb.cb_doclones && + zfs_iter_dependents(zhp, B_TRUE, destroy_check_dependent, + &cb) != 0) { + zfs_close(zhp); + return (1); + } - if (cb.cb_error || (!cb.cb_defer_destroy && - (zfs_iter_dependents(zhp, B_FALSE, destroy_callback, &cb) != 0))) { - zfs_close(zhp); - return (1); - } + if (cb.cb_error) { + zfs_close(zhp); + return (1); + } - /* - * Do the real thing. The callback will close the handle regardless of - * whether it succeeds or not. - */ + if (zfs_iter_dependents(zhp, B_FALSE, destroy_callback, + &cb) != 0) { + zfs_close(zhp); + return (1); + } - if (destroy_callback(zhp, &cb) != 0) - return (1); + /* + * Do the real thing. The callback will close the + * handle regardless of whether it succeeds or not. + */ + if (destroy_callback(zhp, &cb) != 0) + return (1); + } return (0); } @@ -1229,6 +1403,17 @@ get_callback(zfs_handle_t *zhp, void *da zprop_print_one_property(zfs_get_name(zhp), cbp, pl->pl_user_prop, buf, sourcetype, source, NULL); + } else if (zfs_prop_written(pl->pl_user_prop)) { + sourcetype = ZPROP_SRC_LOCAL; + + if (zfs_prop_get_written(zhp, pl->pl_user_prop, + buf, sizeof (buf), cbp->cb_literal) != 0) { + sourcetype = ZPROP_SRC_NONE; + (void) strlcpy(buf, "-", sizeof (buf)); + } + + zprop_print_one_property(zfs_get_name(zhp), cbp, + pl->pl_user_prop, buf, sourcetype, source, NULL); } else { if (nvlist_lookup_nvlist(user_props, pl->pl_user_prop, &propval) != 0) { @@ -1273,9 +1458,10 @@ static int zfs_do_get(int argc, char **argv) { zprop_get_cbdata_t cb = { 0 }; - int i, c, flags = 0; + int i, c, flags = ZFS_ITER_ARGS_CAN_BE_PATHS; + int types = ZFS_TYPE_DATASET; char *value, *fields; - int ret; + int ret = 0; int limit = 0; zprop_list_t fake_name = { 0 }; @@ -1290,7 +1476,7 @@ zfs_do_get(int argc, char **argv) cb.cb_type = ZFS_TYPE_DATASET; /* check options */ - while ((c = getopt(argc, argv, ":d:o:s:rHp")) != -1) { + while ((c = getopt(argc, argv, ":d:o:s:rt:Hp")) != -1) { switch (c) { case 'p': cb.cb_literal = B_TRUE; @@ -1408,6 +1594,37 @@ zfs_do_get(int argc, char **argv) } break; + case 't': + types = 0; + flags &= ~ZFS_ITER_PROP_LISTSNAPS; + while (*optarg != '\0') { + static char *type_subopts[] = { "filesystem", + "volume", "snapshot", "all", NULL }; + + switch (getsubopt(&optarg, type_subopts, + &value)) { + case 0: + types |= ZFS_TYPE_FILESYSTEM; + break; + case 1: + types |= ZFS_TYPE_VOLUME; + break; + case 2: + types |= ZFS_TYPE_SNAPSHOT; + break; + case 3: + types = ZFS_TYPE_DATASET; + break; + + default: + (void) fprintf(stderr, + gettext("invalid type '%s'\n"), + value); + usage(B_FALSE); + } + } + break; + case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); @@ -1451,7 +1668,7 @@ zfs_do_get(int argc, char **argv) cb.cb_first = B_TRUE; /* run for each object */ - ret = zfs_for_each(argc, argv, flags, ZFS_TYPE_DATASET, NULL, + ret = zfs_for_each(argc, argv, flags, types, NULL, &cb.cb_proplist, limit, get_callback, &cb); if (cb.cb_proplist == &fake_name) @@ -1512,7 +1729,7 @@ zfs_do_inherit(int argc, char **argv) zfs_prop_t prop; inherit_cbdata_t cb = { 0 }; char *propname; - int ret; + int ret = 0; int flags = 0; boolean_t received = B_FALSE; @@ -1718,7 +1935,7 @@ zfs_do_upgrade(int argc, char **argv) { boolean_t all = B_FALSE; boolean_t showversions = B_FALSE; - int ret; + int ret = 0; upgrade_cbdata_t cb = { 0 }; char c; int flags = ZFS_ITER_ARGS_CAN_BE_PATHS; @@ -1773,8 +1990,8 @@ zfs_do_upgrade(int argc, char **argv) "---------------\n"); (void) printf(gettext(" 1 Initial ZFS filesystem version\n")); (void) printf(gettext(" 2 Enhanced directory entries\n")); - (void) printf(gettext(" 3 Case insensitive and File system " - "unique identifier (FUID)\n")); + (void) printf(gettext(" 3 Case insensitive and filesystem " + "user identifier (FUID)\n")); (void) printf(gettext(" 4 userquota, groupquota " "properties\n")); (void) printf(gettext(" 5 System attributes\n")); @@ -1823,87 +2040,727 @@ zfs_do_upgrade(int argc, char **argv) return (ret); } +#define USTYPE_USR_BIT (0) +#define USTYPE_GRP_BIT (1) +#define USTYPE_PSX_BIT (2) +#define USTYPE_SMB_BIT (3) + +#define USTYPE_USR (1 << USTYPE_USR_BIT) +#define USTYPE_GRP (1 << USTYPE_GRP_BIT) + +#define USTYPE_PSX (1 << USTYPE_PSX_BIT) +#define USTYPE_SMB (1 << USTYPE_SMB_BIT) + +#define USTYPE_PSX_USR (USTYPE_PSX | USTYPE_USR) +#define USTYPE_SMB_USR (USTYPE_SMB | USTYPE_USR) +#define USTYPE_PSX_GRP (USTYPE_PSX | USTYPE_GRP) +#define USTYPE_SMB_GRP (USTYPE_SMB | USTYPE_GRP) +#define USTYPE_ALL (USTYPE_PSX_USR | USTYPE_SMB_USR \ + | USTYPE_PSX_GRP | USTYPE_SMB_GRP) + + +#define USPROP_USED_BIT (0) +#define USPROP_QUOTA_BIT (1) + +#define USPROP_USED (1 << USPROP_USED_BIT) +#define USPROP_QUOTA (1 << USPROP_QUOTA_BIT) + +typedef struct us_node { + nvlist_t *usn_nvl; + uu_avl_node_t usn_avlnode; + uu_list_node_t usn_listnode; +} us_node_t; + +typedef struct us_cbdata { + nvlist_t **cb_nvlp; + uu_avl_pool_t *cb_avl_pool; + uu_avl_t *cb_avl; + boolean_t cb_numname; + boolean_t cb_nicenum; + boolean_t cb_sid2posix; + zfs_userquota_prop_t cb_prop; + zfs_sort_column_t *cb_sortcol; + size_t cb_max_typelen; + size_t cb_max_namelen; + size_t cb_max_usedlen; + size_t cb_max_quotalen; +} us_cbdata_t; + +typedef struct { + zfs_sort_column_t *si_sortcol; + boolean_t si_num_name; + boolean_t si_parsable; +} us_sort_info_t; + +static int +us_compare(const void *larg, const void *rarg, void *unused) +{ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 10:24:48 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BA0B106566B; Wed, 18 Jul 2012 10:24:48 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F18B58FC15; Wed, 18 Jul 2012 10:24:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IAOlPK055070; Wed, 18 Jul 2012 10:24:47 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IAOlUh055069; Wed, 18 Jul 2012 10:24:47 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207181024.q6IAOlUh055069@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 10:24:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238584 - vendor-sys/illumos/20120614 X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 10:24:48 -0000 Author: mm Date: Wed Jul 18 10:24:47 2012 New Revision: 238584 URL: http://svn.freebsd.org/changeset/base/238584 Log: Tag vendor-sys/illumos as 20120614 (illumos-gate 13742:b6bbdd77139c) Added: vendor-sys/illumos/20120614/ - copied from r238580, vendor-sys/illumos/dist/ From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 10:26:51 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5CF141065673; Wed, 18 Jul 2012 10:26:51 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2EF678FC15; Wed, 18 Jul 2012 10:26:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IAQps5055269; Wed, 18 Jul 2012 10:26:51 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IAQo93055268; Wed, 18 Jul 2012 10:26:50 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207181026.q6IAQo93055268@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 10:26:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238585 - vendor/illumos/20120614 X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 10:26:51 -0000 Author: mm Date: Wed Jul 18 10:26:50 2012 New Revision: 238585 URL: http://svn.freebsd.org/changeset/base/238585 Log: Tag vendor/illumos/dist as 20120614 (illumos-gate 13742:b6bbdd77139c) Added: vendor/illumos/20120614/ - copied from r238584, vendor/illumos/dist/ From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 10:42:44 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 230431065680; Wed, 18 Jul 2012 10:42:44 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0CBFF8FC16; Wed, 18 Jul 2012 10:42:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IAghTi056451; Wed, 18 Jul 2012 10:42:43 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IAghYO056450; Wed, 18 Jul 2012 10:42:43 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207181042.q6IAghYO056450@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 10:42:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238587 - vendor/illumos/dist/cmd/zhack X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 10:42:44 -0000 Author: mm Date: Wed Jul 18 10:42:43 2012 New Revision: 238587 URL: http://svn.freebsd.org/changeset/base/238587 Log: Add zhack command missing from vendor import illumos-gate revision 13742:b6bbdd77139c Obtained from: ssh://anonhg@hg.illumos.org/illumos-gate Added: vendor/illumos/dist/cmd/zhack/ vendor/illumos/dist/cmd/zhack/zhack.c Added: vendor/illumos/dist/cmd/zhack/zhack.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/zhack/zhack.c Wed Jul 18 10:42:43 2012 (r238587) @@ -0,0 +1,533 @@ +/* + * CDDL HEADER START + * + * 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] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +/* + * zhack is a debugging tool that can write changes to ZFS pool using libzpool + * for testing purposes. Altering pools with zhack is unsupported and may + * result in corrupted pools. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#undef ZFS_MAXNAMELEN +#undef verify +#include + +extern boolean_t zfeature_checks_disable; + +const char cmdname[] = "zhack"; +libzfs_handle_t *g_zfs; +static importargs_t g_importargs; +static char *g_pool; +static boolean_t g_readonly; + +static void +usage(void) +{ + (void) fprintf(stderr, + "Usage: %s [-c cachefile] [-d dir] ...\n" + "where is one of the following:\n" + "\n", cmdname); + + (void) fprintf(stderr, + " feature stat \n" + " print information about enabled features\n" + " feature enable [-d desc] \n" + " add a new enabled feature to the pool\n" + " -d sets the feature's description\n" + " feature ref [-md] \n" + " change the refcount on the given feature\n" + " -d decrease instead of increase the refcount\n" + " -m add the feature to the label if increasing refcount\n" + "\n" + " : should be a feature guid\n"); + exit(1); +} + + +static void +fatal(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + (void) fprintf(stderr, "%s: ", cmdname); + (void) vfprintf(stderr, fmt, ap); + va_end(ap); + (void) fprintf(stderr, "\n"); + + exit(1); +} + +/* ARGSUSED */ +static int +space_delta_cb(dmu_object_type_t bonustype, void *data, + uint64_t *userp, uint64_t *groupp) +{ + /* + * Is it a valid type of object to track? + */ + if (bonustype != DMU_OT_ZNODE && bonustype != DMU_OT_SA) + return (ENOENT); + (void) fprintf(stderr, "modifying object that needs user accounting"); + abort(); + /* NOTREACHED */ +} + +/* + * Target is the dataset whose pool we want to open. + */ +static void +import_pool(const char *target, boolean_t readonly) +{ + nvlist_t *config; + nvlist_t *pools; + int error; + char *sepp; + spa_t *spa; + nvpair_t *elem; + nvlist_t *props; + const char *name; + + kernel_init(readonly ? FREAD : (FREAD | FWRITE)); + g_zfs = libzfs_init(); + ASSERT(g_zfs != NULL); + + dmu_objset_register_type(DMU_OST_ZFS, space_delta_cb); + + g_readonly = readonly; + + /* + * If we only want readonly access, it's OK if we find + * a potentially-active (ie, imported into the kernel) pool from the + * default cachefile. + */ + if (readonly && spa_open(target, &spa, FTAG) == 0) { + spa_close(spa, FTAG); + return; + } + + g_importargs.unique = B_TRUE; + g_importargs.can_be_active = readonly; + g_pool = strdup(target); + if ((sepp = strpbrk(g_pool, "/@")) != NULL) + *sepp = '\0'; + g_importargs.poolname = g_pool; + pools = zpool_search_import(g_zfs, &g_importargs); + + if (pools == NULL || nvlist_next_nvpair(pools, NULL) == NULL) { + if (!g_importargs.can_be_active) { + g_importargs.can_be_active = B_TRUE; + if (zpool_search_import(g_zfs, &g_importargs) != NULL || + spa_open(target, &spa, FTAG) == 0) { + fatal("cannot import '%s': pool is active; run " + "\"zpool export %s\" first\n", + g_pool, g_pool); + } + } + + fatal("cannot import '%s': no such pool available\n", g_pool); + } + + elem = nvlist_next_nvpair(pools, NULL); + name = nvpair_name(elem); + verify(nvpair_value_nvlist(elem, &config) == 0); + + props = NULL; + if (readonly) { + verify(nvlist_alloc(&props, NV_UNIQUE_NAME, 0) == 0); + verify(nvlist_add_uint64(props, + zpool_prop_to_name(ZPOOL_PROP_READONLY), 1) == 0); + } + + zfeature_checks_disable = B_TRUE; + error = spa_import(name, config, props, ZFS_IMPORT_NORMAL); + zfeature_checks_disable = B_FALSE; + if (error == EEXIST) + error = 0; + + if (error) + fatal("can't import '%s': %s", name, strerror(error)); +} + +static void +zhack_spa_open(const char *target, boolean_t readonly, void *tag, spa_t **spa) +{ + int err; + + import_pool(target, readonly); + + zfeature_checks_disable = B_TRUE; + err = spa_open(target, spa, tag); + zfeature_checks_disable = B_FALSE; + + if (err != 0) + fatal("cannot open '%s': %s", target, strerror(err)); + if (spa_version(*spa) < SPA_VERSION_FEATURES) { + fatal("'%s' has version %d, features not enabled", target, + (int)spa_version(*spa)); + } +} + +static void +dump_obj(objset_t *os, uint64_t obj, const char *name) +{ + zap_cursor_t zc; + zap_attribute_t za; + + (void) printf("%s_obj:\n", name); + + for (zap_cursor_init(&zc, os, obj); + zap_cursor_retrieve(&zc, &za) == 0; + zap_cursor_advance(&zc)) { + if (za.za_integer_length == 8) { + ASSERT(za.za_num_integers == 1); + (void) printf("\t%s = %llu\n", + za.za_name, (u_longlong_t)za.za_first_integer); + } else { + ASSERT(za.za_integer_length == 1); + char val[1024]; + VERIFY(zap_lookup(os, obj, za.za_name, + 1, sizeof (val), val) == 0); + (void) printf("\t%s = %s\n", za.za_name, val); + } + } + zap_cursor_fini(&zc); +} + +static void +dump_mos(spa_t *spa) +{ + nvlist_t *nv = spa->spa_label_features; + + (void) printf("label config:\n"); + for (nvpair_t *pair = nvlist_next_nvpair(nv, NULL); + pair != NULL; + pair = nvlist_next_nvpair(nv, pair)) { + (void) printf("\t%s\n", nvpair_name(pair)); + } +} + +static void +zhack_do_feature_stat(int argc, char **argv) +{ + spa_t *spa; + objset_t *os; + char *target; + + argc--; + argv++; + + if (argc < 1) { + (void) fprintf(stderr, "error: missing pool name\n"); + usage(); + } + target = argv[0]; + + zhack_spa_open(target, B_TRUE, FTAG, &spa); + os = spa->spa_meta_objset; + + dump_obj(os, spa->spa_feat_for_read_obj, "for_read"); + dump_obj(os, spa->spa_feat_for_write_obj, "for_write"); + dump_obj(os, spa->spa_feat_desc_obj, "descriptions"); + dump_mos(spa); + + spa_close(spa, FTAG); +} + +static void +feature_enable_sync(void *arg1, void *arg2, dmu_tx_t *tx) +{ + spa_t *spa = arg1; + zfeature_info_t *feature = arg2; + + spa_feature_enable(spa, feature, tx); +} + +static void +zhack_do_feature_enable(int argc, char **argv) +{ + char c; + char *desc, *target; + spa_t *spa; + objset_t *mos; + zfeature_info_t feature; + zfeature_info_t *nodeps[] = { NULL }; + + /* + * Features are not added to the pool's label until their refcounts + * are incremented, so fi_mos can just be left as false for now. + */ + desc = NULL; + feature.fi_uname = "zhack"; + feature.fi_mos = B_FALSE; + feature.fi_can_readonly = B_FALSE; + feature.fi_depends = nodeps; + + optind = 1; + while ((c = getopt(argc, argv, "rmd:")) != -1) { + switch (c) { + case 'r': + feature.fi_can_readonly = B_TRUE; + break; + case 'd': + desc = strdup(optarg); + break; + default: + usage(); + break; + } + } + + if (desc == NULL) + desc = strdup("zhack injected"); + feature.fi_desc = desc; + + argc -= optind; + argv += optind; + + if (argc < 2) { + (void) fprintf(stderr, "error: missing feature or pool name\n"); + usage(); + } + target = argv[0]; + feature.fi_guid = argv[1]; + + if (!zfeature_is_valid_guid(feature.fi_guid)) + fatal("invalid feature guid: %s", feature.fi_guid); + + zhack_spa_open(target, B_FALSE, FTAG, &spa); + mos = spa->spa_meta_objset; + + if (0 == zfeature_lookup_guid(feature.fi_guid, NULL)) + fatal("'%s' is a real feature, will not enable"); + if (0 == zap_contains(mos, spa->spa_feat_desc_obj, feature.fi_guid)) + fatal("feature already enabled: %s", feature.fi_guid); + + VERIFY3U(0, ==, dsl_sync_task_do(spa->spa_dsl_pool, NULL, + feature_enable_sync, spa, &feature, 5)); + + spa_close(spa, FTAG); + + free(desc); +} + +static void +feature_incr_sync(void *arg1, void *arg2, dmu_tx_t *tx) +{ + spa_t *spa = arg1; + zfeature_info_t *feature = arg2; + + spa_feature_incr(spa, feature, tx); +} + +static void +feature_decr_sync(void *arg1, void *arg2, dmu_tx_t *tx) +{ + spa_t *spa = arg1; + zfeature_info_t *feature = arg2; + + spa_feature_decr(spa, feature, tx); +} + +static void +zhack_do_feature_ref(int argc, char **argv) +{ + char c; + char *target; + boolean_t decr = B_FALSE; + spa_t *spa; + objset_t *mos; + zfeature_info_t feature; + zfeature_info_t *nodeps[] = { NULL }; + + /* + * fi_desc does not matter here because it was written to disk + * when the feature was enabled, but we need to properly set the + * feature for read or write based on the information we read off + * disk later. + */ + feature.fi_uname = "zhack"; + feature.fi_mos = B_FALSE; + feature.fi_desc = NULL; + feature.fi_depends = nodeps; + + optind = 1; + while ((c = getopt(argc, argv, "md")) != -1) { + switch (c) { + case 'm': + feature.fi_mos = B_TRUE; + break; + case 'd': + decr = B_TRUE; + break; + default: + usage(); + break; + } + } + argc -= optind; + argv += optind; + + if (argc < 2) { + (void) fprintf(stderr, "error: missing feature or pool name\n"); + usage(); + } + target = argv[0]; + feature.fi_guid = argv[1]; + + if (!zfeature_is_valid_guid(feature.fi_guid)) + fatal("invalid feature guid: %s", feature.fi_guid); + + zhack_spa_open(target, B_FALSE, FTAG, &spa); + mos = spa->spa_meta_objset; + + if (0 == zfeature_lookup_guid(feature.fi_guid, NULL)) + fatal("'%s' is a real feature, will not change refcount"); + + if (0 == zap_contains(mos, spa->spa_feat_for_read_obj, + feature.fi_guid)) { + feature.fi_can_readonly = B_FALSE; + } else if (0 == zap_contains(mos, spa->spa_feat_for_write_obj, + feature.fi_guid)) { + feature.fi_can_readonly = B_TRUE; + } else { + fatal("feature is not enabled: %s", feature.fi_guid); + } + + if (decr && !spa_feature_is_active(spa, &feature)) + fatal("feature refcount already 0: %s", feature.fi_guid); + + VERIFY3U(0, ==, dsl_sync_task_do(spa->spa_dsl_pool, NULL, + decr ? feature_decr_sync : feature_incr_sync, spa, &feature, 5)); + + spa_close(spa, FTAG); +} + +static int +zhack_do_feature(int argc, char **argv) +{ + char *subcommand; + + argc--; + argv++; + if (argc == 0) { + (void) fprintf(stderr, + "error: no feature operation specified\n"); + usage(); + } + + subcommand = argv[0]; + if (strcmp(subcommand, "stat") == 0) { + zhack_do_feature_stat(argc, argv); + } else if (strcmp(subcommand, "enable") == 0) { + zhack_do_feature_enable(argc, argv); + } else if (strcmp(subcommand, "ref") == 0) { + zhack_do_feature_ref(argc, argv); + } else { + (void) fprintf(stderr, "error: unknown subcommand: %s\n", + subcommand); + usage(); + } + + return (0); +} + +#define MAX_NUM_PATHS 1024 + +int +main(int argc, char **argv) +{ + extern void zfs_prop_init(void); + + char *path[MAX_NUM_PATHS]; + const char *subcommand; + int rv = 0; + char c; + + g_importargs.path = path; + + dprintf_setup(&argc, argv); + zfs_prop_init(); + + while ((c = getopt(argc, argv, "c:d:")) != -1) { + switch (c) { + case 'c': + g_importargs.cachefile = optarg; + break; + case 'd': + assert(g_importargs.paths < MAX_NUM_PATHS); + g_importargs.path[g_importargs.paths++] = optarg; + break; + default: + usage(); + break; + } + } + + argc -= optind; + argv += optind; + optind = 1; + + if (argc == 0) { + (void) fprintf(stderr, "error: no command specified\n"); + usage(); + } + + subcommand = argv[0]; + + if (strcmp(subcommand, "feature") == 0) { + rv = zhack_do_feature(argc, argv); + } else { + (void) fprintf(stderr, "error: unknown subcommand: %s\n", + subcommand); + usage(); + } + + if (!g_readonly && spa_export(g_pool, NULL, B_TRUE, B_TRUE) != 0) { + fatal("pool export failed; " + "changes may not be committed to disk\n"); + } + + libzfs_fini(g_zfs); + kernel_fini(); + + return (rv); +} From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 10:46:32 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7AA16106564A; Wed, 18 Jul 2012 10:46:32 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4CB3D8FC1F; Wed, 18 Jul 2012 10:46:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IAkWAh061899; Wed, 18 Jul 2012 10:46:32 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IAkWCr061898; Wed, 18 Jul 2012 10:46:32 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207181046.q6IAkWCr061898@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 10:46:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238589 - vendor/illumos/20120614/cmd/zhack X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 10:46:32 -0000 Author: mm Date: Wed Jul 18 10:46:31 2012 New Revision: 238589 URL: http://svn.freebsd.org/changeset/base/238589 Log: Merge r238587 into 20120614 tag Added: vendor/illumos/20120614/cmd/zhack/ - copied from r238587, vendor/illumos/dist/cmd/zhack/ Modified: Directory Properties: vendor/illumos/20120614/ (props changed) From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 10:51:12 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 42DFB106566B; Wed, 18 Jul 2012 10:51:12 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29E2C8FC25; Wed, 18 Jul 2012 10:51:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IApCYB062343; Wed, 18 Jul 2012 10:51:12 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IApBGk062334; Wed, 18 Jul 2012 10:51:11 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207181051.q6IApBGk062334@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 10:51:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238590 - in vendor-sys/illumos/dist: common/zfs uts/common/fs/zfs uts/common/fs/zfs/sys uts/common/sys uts/common/sys/fs X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 10:51:12 -0000 Author: mm Date: Wed Jul 18 10:51:11 2012 New Revision: 238590 URL: http://svn.freebsd.org/changeset/base/238590 Log: Update vendor-sys/illumos/dist to illumos-gate 13752:9f5f6c52ba19 Obtained from: ssh://anonhg@hg.illumos.org/illumos-gate Modified: vendor-sys/illumos/dist/common/zfs/zfs_comutil.c vendor-sys/illumos/dist/common/zfs/zfs_comutil.h vendor-sys/illumos/dist/common/zfs/zprop_common.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deleg.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_prop.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_synctask.c vendor-sys/illumos/dist/uts/common/fs/zfs/rrwlock.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_history.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_deleg.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_prop.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/rrwlock.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ctldir.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c vendor-sys/illumos/dist/uts/common/sys/feature_tests.h vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Modified: vendor-sys/illumos/dist/common/zfs/zfs_comutil.c ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfs_comutil.c Wed Jul 18 10:46:31 2012 (r238589) +++ vendor-sys/illumos/dist/common/zfs/zfs_comutil.c Wed Jul 18 10:51:11 2012 (r238590) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ /* @@ -157,7 +158,11 @@ zfs_spa_version_map(int zpl_version) return (version); } -const char *zfs_history_event_names[LOG_END] = { +/* + * This is the table of legacy internal event names; it should not be modified. + * The internal events are now stored in the history log as strings. + */ +const char *zfs_history_event_names[ZFS_NUM_LEGACY_HISTORY_EVENTS] = { "invalid event", "pool create", "vdev add", Modified: vendor-sys/illumos/dist/common/zfs/zfs_comutil.h ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfs_comutil.h Wed Jul 18 10:46:31 2012 (r238589) +++ vendor-sys/illumos/dist/common/zfs/zfs_comutil.h Wed Jul 18 10:51:11 2012 (r238590) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #ifndef _ZFS_COMUTIL_H @@ -37,7 +38,8 @@ extern void zpool_get_rewind_policy(nvli extern int zfs_zpl_version_map(int spa_version); extern int zfs_spa_version_map(int zpl_version); -extern const char *zfs_history_event_names[LOG_END]; +#define ZFS_NUM_LEGACY_HISTORY_EVENTS 41 +extern const char *zfs_history_event_names[ZFS_NUM_LEGACY_HISTORY_EVENTS]; #ifdef __cplusplus } Modified: vendor-sys/illumos/dist/common/zfs/zprop_common.c ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zprop_common.c Wed Jul 18 10:46:31 2012 (r238589) +++ vendor-sys/illumos/dist/common/zfs/zprop_common.c Wed Jul 18 10:51:11 2012 (r238590) @@ -22,6 +22,9 @@ * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ /* * Common routines used by zfs and zpool property management. @@ -129,7 +132,8 @@ zprop_register_hidden(int prop, const ch zprop_attr_t attr, int objset_types, const char *colname) { zprop_register_impl(prop, name, type, 0, NULL, attr, - objset_types, NULL, colname, B_FALSE, B_FALSE, NULL); + objset_types, NULL, colname, + type == PROP_TYPE_NUMBER, B_FALSE, NULL); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Wed Jul 18 10:46:31 2012 (r238589) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Wed Jul 18 10:51:11 2012 (r238590) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -699,30 +700,33 @@ dmu_objset_create_sync(void *arg1, void spa_t *spa = dd->dd_pool->dp_spa; struct oscarg *oa = arg2; uint64_t obj; + dsl_dataset_t *ds; + blkptr_t *bp; ASSERT(dmu_tx_is_syncing(tx)); obj = dsl_dataset_create_sync(dd, oa->lastname, oa->clone_origin, oa->flags, oa->cr, tx); - if (oa->clone_origin == NULL) { - dsl_pool_t *dp = dd->dd_pool; - dsl_dataset_t *ds; - blkptr_t *bp; - objset_t *os; - - VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, obj, FTAG, &ds)); - bp = dsl_dataset_get_blkptr(ds); - ASSERT(BP_IS_HOLE(bp)); - - os = dmu_objset_create_impl(spa, ds, bp, oa->type, tx); + VERIFY3U(0, ==, dsl_dataset_hold_obj(dd->dd_pool, obj, FTAG, &ds)); + bp = dsl_dataset_get_blkptr(ds); + if (BP_IS_HOLE(bp)) { + objset_t *os = + dmu_objset_create_impl(spa, ds, bp, oa->type, tx); if (oa->userfunc) oa->userfunc(os, oa->userarg, oa->cr, tx); - dsl_dataset_rele(ds, FTAG); } - spa_history_log_internal(LOG_DS_CREATE, spa, tx, "dataset = %llu", obj); + if (oa->clone_origin == NULL) { + spa_history_log_internal_ds(ds, "create", tx, ""); + } else { + char namebuf[MAXNAMELEN]; + dsl_dataset_name(oa->clone_origin, namebuf); + spa_history_log_internal_ds(ds, "clone", tx, + "origin=%s (%llu)", namebuf, oa->clone_origin->ds_object); + } + dsl_dataset_rele(ds, FTAG); } int @@ -799,34 +803,40 @@ dmu_objset_destroy(const char *name, boo return (error); } -struct snaparg { - dsl_sync_task_group_t *dstg; - char *snapname; - char *htag; - char failed[MAXPATHLEN]; - boolean_t recursive; - boolean_t needsuspend; - boolean_t temporary; - nvlist_t *props; - struct dsl_ds_holdarg *ha; /* only needed in the temporary case */ - dsl_dataset_t *newds; -}; +typedef struct snapallarg { + dsl_sync_task_group_t *saa_dstg; + boolean_t saa_needsuspend; + nvlist_t *saa_props; + + /* the following are used only if 'temporary' is set: */ + boolean_t saa_temporary; + const char *saa_htag; + struct dsl_ds_holdarg *saa_ha; + dsl_dataset_t *saa_newds; +} snapallarg_t; + +typedef struct snaponearg { + const char *soa_longname; /* long snap name */ + const char *soa_snapname; /* short snap name */ + snapallarg_t *soa_saa; +} snaponearg_t; static int snapshot_check(void *arg1, void *arg2, dmu_tx_t *tx) { objset_t *os = arg1; - struct snaparg *sn = arg2; + snaponearg_t *soa = arg2; + snapallarg_t *saa = soa->soa_saa; int error; /* The props have already been checked by zfs_check_userprops(). */ error = dsl_dataset_snapshot_check(os->os_dsl_dataset, - sn->snapname, tx); + soa->soa_snapname, tx); if (error) return (error); - if (sn->temporary) { + if (saa->saa_temporary) { /* * Ideally we would just call * dsl_dataset_user_hold_check() and @@ -844,12 +854,13 @@ snapshot_check(void *arg1, void *arg2, d * Not checking number of tags because the tag will be * unique, as it will be the only tag. */ - if (strlen(sn->htag) + MAX_TAG_PREFIX_LEN >= MAXNAMELEN) + if (strlen(saa->saa_htag) + MAX_TAG_PREFIX_LEN >= MAXNAMELEN) return (E2BIG); - sn->ha = kmem_alloc(sizeof (struct dsl_ds_holdarg), KM_SLEEP); - sn->ha->temphold = B_TRUE; - sn->ha->htag = sn->htag; + saa->saa_ha = kmem_alloc(sizeof (struct dsl_ds_holdarg), + KM_SLEEP); + saa->saa_ha->temphold = B_TRUE; + saa->saa_ha->htag = saa->saa_htag; } return (error); } @@ -859,24 +870,25 @@ snapshot_sync(void *arg1, void *arg2, dm { objset_t *os = arg1; dsl_dataset_t *ds = os->os_dsl_dataset; - struct snaparg *sn = arg2; + snaponearg_t *soa = arg2; + snapallarg_t *saa = soa->soa_saa; - dsl_dataset_snapshot_sync(ds, sn->snapname, tx); + dsl_dataset_snapshot_sync(ds, soa->soa_snapname, tx); - if (sn->props) { + if (saa->saa_props != NULL) { dsl_props_arg_t pa; - pa.pa_props = sn->props; + pa.pa_props = saa->saa_props; pa.pa_source = ZPROP_SRC_LOCAL; dsl_props_set_sync(ds->ds_prev, &pa, tx); } - if (sn->temporary) { + if (saa->saa_temporary) { struct dsl_ds_destroyarg da; - dsl_dataset_user_hold_sync(ds->ds_prev, sn->ha, tx); - kmem_free(sn->ha, sizeof (struct dsl_ds_holdarg)); - sn->ha = NULL; - sn->newds = ds->ds_prev; + dsl_dataset_user_hold_sync(ds->ds_prev, saa->saa_ha, tx); + kmem_free(saa->saa_ha, sizeof (struct dsl_ds_holdarg)); + saa->saa_ha = NULL; + saa->saa_newds = ds->ds_prev; da.ds = ds->ds_prev; da.defer = B_TRUE; @@ -885,131 +897,180 @@ snapshot_sync(void *arg1, void *arg2, dm } static int -dmu_objset_snapshot_one(const char *name, void *arg) +snapshot_one_impl(const char *snapname, void *arg) { - struct snaparg *sn = arg; + char fsname[MAXPATHLEN]; + snapallarg_t *saa = arg; + snaponearg_t *soa; objset_t *os; int err; - char *cp; - /* - * If the objset starts with a '%', then ignore it unless it was - * explicitly named (ie, not recursive). These hidden datasets - * are always inconsistent, and by not opening them here, we can - * avoid a race with dsl_dir_destroy_check(). - */ - cp = strrchr(name, '/'); - if (cp && cp[1] == '%' && sn->recursive) - return (0); - - (void) strcpy(sn->failed, name); - - /* - * Check permissions if we are doing a recursive snapshot. The - * permission checks for the starting dataset have already been - * performed in zfs_secpolicy_snapshot() - */ - if (sn->recursive && (err = zfs_secpolicy_snapshot_perms(name, CRED()))) - return (err); + (void) strlcpy(fsname, snapname, sizeof (fsname)); + strchr(fsname, '@')[0] = '\0'; - err = dmu_objset_hold(name, sn, &os); + err = dmu_objset_hold(fsname, saa, &os); if (err != 0) return (err); /* * If the objset is in an inconsistent state (eg, in the process - * of being destroyed), don't snapshot it. As with %hidden - * datasets, we return EBUSY if this name was explicitly - * requested (ie, not recursive), and otherwise ignore it. + * of being destroyed), don't snapshot it. */ if (os->os_dsl_dataset->ds_phys->ds_flags & DS_FLAG_INCONSISTENT) { - dmu_objset_rele(os, sn); - return (sn->recursive ? 0 : EBUSY); + dmu_objset_rele(os, saa); + return (EBUSY); } - if (sn->needsuspend) { + if (saa->saa_needsuspend) { err = zil_suspend(dmu_objset_zil(os)); if (err) { - dmu_objset_rele(os, sn); + dmu_objset_rele(os, saa); return (err); } } - dsl_sync_task_create(sn->dstg, snapshot_check, snapshot_sync, - os, sn, 3); + + soa = kmem_zalloc(sizeof (*soa), KM_SLEEP); + soa->soa_saa = saa; + soa->soa_longname = snapname; + soa->soa_snapname = strchr(snapname, '@') + 1; + + dsl_sync_task_create(saa->saa_dstg, snapshot_check, snapshot_sync, + os, soa, 3); return (0); } +/* + * The snapshots must all be in the same pool. + */ int -dmu_objset_snapshot(char *fsname, char *snapname, char *tag, - nvlist_t *props, boolean_t recursive, boolean_t temporary, int cleanup_fd) +dmu_objset_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t *errors) { dsl_sync_task_t *dst; - struct snaparg sn; + snapallarg_t saa = { 0 }; spa_t *spa; - minor_t minor; + int rv = 0; int err; + nvpair_t *pair; - (void) strcpy(sn.failed, fsname); + pair = nvlist_next_nvpair(snaps, NULL); + if (pair == NULL) + return (0); - err = spa_open(fsname, &spa, FTAG); + err = spa_open(nvpair_name(pair), &spa, FTAG); if (err) return (err); - - if (temporary) { - if (cleanup_fd < 0) { - spa_close(spa, FTAG); - return (EINVAL); + saa.saa_dstg = dsl_sync_task_group_create(spa_get_dsl(spa)); + saa.saa_props = props; + saa.saa_needsuspend = (spa_version(spa) < SPA_VERSION_FAST_SNAP); + + for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL; + pair = nvlist_next_nvpair(snaps, pair)) { + err = snapshot_one_impl(nvpair_name(pair), &saa); + if (err != 0) { + if (errors != NULL) { + fnvlist_add_int32(errors, + nvpair_name(pair), err); + } + rv = err; } - if ((err = zfs_onexit_fd_hold(cleanup_fd, &minor)) != 0) { - spa_close(spa, FTAG); - return (err); + } + + /* + * If any call to snapshot_one_impl() failed, don't execute the + * sync task. The error handling code below will clean up the + * snaponearg_t from any successful calls to + * snapshot_one_impl(). + */ + if (rv == 0) + err = dsl_sync_task_group_wait(saa.saa_dstg); + if (err != 0) + rv = err; + + for (dst = list_head(&saa.saa_dstg->dstg_tasks); dst; + dst = list_next(&saa.saa_dstg->dstg_tasks, dst)) { + objset_t *os = dst->dst_arg1; + snaponearg_t *soa = dst->dst_arg2; + if (dst->dst_err != 0) { + if (errors != NULL) { + fnvlist_add_int32(errors, + soa->soa_longname, dst->dst_err); + } + rv = dst->dst_err; } + + if (saa.saa_needsuspend) + zil_resume(dmu_objset_zil(os)); + dmu_objset_rele(os, &saa); + kmem_free(soa, sizeof (*soa)); } - sn.dstg = dsl_sync_task_group_create(spa_get_dsl(spa)); - sn.snapname = snapname; - sn.htag = tag; - sn.props = props; - sn.recursive = recursive; - sn.needsuspend = (spa_version(spa) < SPA_VERSION_FAST_SNAP); - sn.temporary = temporary; - sn.ha = NULL; - sn.newds = NULL; - - if (recursive) { - err = dmu_objset_find(fsname, - dmu_objset_snapshot_one, &sn, DS_FIND_CHILDREN); - } else { - err = dmu_objset_snapshot_one(fsname, &sn); + dsl_sync_task_group_destroy(saa.saa_dstg); + spa_close(spa, FTAG); + return (rv); +} + +int +dmu_objset_snapshot_one(const char *fsname, const char *snapname) +{ + int err; + char *longsnap = kmem_asprintf("%s@%s", fsname, snapname); + nvlist_t *snaps = fnvlist_alloc(); + + fnvlist_add_boolean(snaps, longsnap); + err = dmu_objset_snapshot(snaps, NULL, NULL); + fnvlist_free(snaps); + strfree(longsnap); + return (err); +} + +int +dmu_objset_snapshot_tmp(const char *snapname, const char *tag, int cleanup_fd) +{ + dsl_sync_task_t *dst; + snapallarg_t saa = { 0 }; + spa_t *spa; + minor_t minor; + int err; + + err = spa_open(snapname, &spa, FTAG); + if (err) + return (err); + saa.saa_dstg = dsl_sync_task_group_create(spa_get_dsl(spa)); + saa.saa_htag = tag; + saa.saa_needsuspend = (spa_version(spa) < SPA_VERSION_FAST_SNAP); + saa.saa_temporary = B_TRUE; + + if (cleanup_fd < 0) { + spa_close(spa, FTAG); + return (EINVAL); + } + if ((err = zfs_onexit_fd_hold(cleanup_fd, &minor)) != 0) { + spa_close(spa, FTAG); + return (err); } + err = snapshot_one_impl(snapname, &saa); + if (err == 0) - err = dsl_sync_task_group_wait(sn.dstg); + err = dsl_sync_task_group_wait(saa.saa_dstg); - for (dst = list_head(&sn.dstg->dstg_tasks); dst; - dst = list_next(&sn.dstg->dstg_tasks, dst)) { + for (dst = list_head(&saa.saa_dstg->dstg_tasks); dst; + dst = list_next(&saa.saa_dstg->dstg_tasks, dst)) { objset_t *os = dst->dst_arg1; - dsl_dataset_t *ds = os->os_dsl_dataset; - if (dst->dst_err) { - dsl_dataset_name(ds, sn.failed); - } else if (temporary) { - dsl_register_onexit_hold_cleanup(sn.newds, tag, minor); - } - if (sn.needsuspend) + dsl_register_onexit_hold_cleanup(saa.saa_newds, tag, minor); + if (saa.saa_needsuspend) zil_resume(dmu_objset_zil(os)); - dmu_objset_rele(os, &sn); + dmu_objset_rele(os, &saa); } - if (err) - (void) strcpy(fsname, sn.failed); - if (temporary) - zfs_onexit_fd_rele(cleanup_fd); - dsl_sync_task_group_destroy(sn.dstg); + zfs_onexit_fd_rele(cleanup_fd); + dsl_sync_task_group_destroy(saa.saa_dstg); spa_close(spa, FTAG); return (err); } + static void dmu_objset_sync_dnodes(list_t *list, list_t *newlist, dmu_tx_t *tx) { Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c Wed Jul 18 10:46:31 2012 (r238589) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c Wed Jul 18 10:51:11 2012 (r238590) @@ -387,9 +387,48 @@ backup_cb(spa_t *spa, zilog_t *zilog, co return (err); } +/* + * Return TRUE if 'earlier' is an earlier snapshot in 'later's timeline. + * For example, they could both be snapshots of the same filesystem, and + * 'earlier' is before 'later'. Or 'earlier' could be the origin of + * 'later's filesystem. Or 'earlier' could be an older snapshot in the origin's + * filesystem. Or 'earlier' could be the origin's origin. + */ +static boolean_t +is_before(dsl_dataset_t *later, dsl_dataset_t *earlier) +{ + dsl_pool_t *dp = later->ds_dir->dd_pool; + int error; + boolean_t ret; + dsl_dataset_t *origin; + + if (earlier->ds_phys->ds_creation_txg >= + later->ds_phys->ds_creation_txg) + return (B_FALSE); + + if (later->ds_dir == earlier->ds_dir) + return (B_TRUE); + if (!dsl_dir_is_clone(later->ds_dir)) + return (B_FALSE); + + rw_enter(&dp->dp_config_rwlock, RW_READER); + if (later->ds_dir->dd_phys->dd_origin_obj == earlier->ds_object) { + rw_exit(&dp->dp_config_rwlock); + return (B_TRUE); + } + error = dsl_dataset_hold_obj(dp, + later->ds_dir->dd_phys->dd_origin_obj, FTAG, &origin); + rw_exit(&dp->dp_config_rwlock); + if (error != 0) + return (B_FALSE); + ret = is_before(origin, earlier); + dsl_dataset_rele(origin, FTAG); + return (ret); +} + int -dmu_send(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin, - int outfd, vnode_t *vp, offset_t *off) +dmu_send(objset_t *tosnap, objset_t *fromsnap, int outfd, vnode_t *vp, + offset_t *off) { dsl_dataset_t *ds = tosnap->os_dsl_dataset; dsl_dataset_t *fromds = fromsnap ? fromsnap->os_dsl_dataset : NULL; @@ -402,30 +441,13 @@ dmu_send(objset_t *tosnap, objset_t *fro if (ds->ds_phys->ds_next_snap_obj == 0) return (EINVAL); - /* fromsnap must be an earlier snapshot from the same fs as tosnap */ - if (fromds && (ds->ds_dir != fromds->ds_dir || - fromds->ds_phys->ds_creation_txg >= ds->ds_phys->ds_creation_txg)) + /* + * fromsnap must be an earlier snapshot from the same fs as tosnap, + * or the origin's fs. + */ + if (fromds != NULL && !is_before(ds, fromds)) return (EXDEV); - if (fromorigin) { - dsl_pool_t *dp = ds->ds_dir->dd_pool; - - if (fromsnap) - return (EINVAL); - - if (dsl_dir_is_clone(ds->ds_dir)) { - rw_enter(&dp->dp_config_rwlock, RW_READER); - err = dsl_dataset_hold_obj(dp, - ds->ds_dir->dd_phys->dd_origin_obj, FTAG, &fromds); - rw_exit(&dp->dp_config_rwlock); - if (err) - return (err); - } else { - fromorigin = B_FALSE; - } - } - - drr = kmem_zalloc(sizeof (dmu_replay_record_t), KM_SLEEP); drr->drr_type = DRR_BEGIN; drr->drr_u.drr_begin.drr_magic = DMU_BACKUP_MAGIC; @@ -450,7 +472,7 @@ dmu_send(objset_t *tosnap, objset_t *fro drr->drr_u.drr_begin.drr_creation_time = ds->ds_phys->ds_creation_time; drr->drr_u.drr_begin.drr_type = tosnap->os_phys->os_type; - if (fromorigin) + if (fromds != NULL && ds->ds_dir != fromds->ds_dir) drr->drr_u.drr_begin.drr_flags |= DRR_FLAG_CLONE; drr->drr_u.drr_begin.drr_toguid = ds->ds_phys->ds_guid; if (ds->ds_phys->ds_flags & DS_FLAG_CI_DATASET) @@ -462,8 +484,6 @@ dmu_send(objset_t *tosnap, objset_t *fro if (fromds) fromtxg = fromds->ds_phys->ds_creation_txg; - if (fromorigin) - dsl_dataset_rele(fromds, FTAG); dsp = kmem_zalloc(sizeof (dmu_sendarg_t), KM_SLEEP); @@ -521,8 +541,7 @@ out: } int -dmu_send_estimate(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin, - uint64_t *sizep) +dmu_send_estimate(objset_t *tosnap, objset_t *fromsnap, uint64_t *sizep) { dsl_dataset_t *ds = tosnap->os_dsl_dataset; dsl_dataset_t *fromds = fromsnap ? fromsnap->os_dsl_dataset : NULL; @@ -534,27 +553,13 @@ dmu_send_estimate(objset_t *tosnap, objs if (ds->ds_phys->ds_next_snap_obj == 0) return (EINVAL); - /* fromsnap must be an earlier snapshot from the same fs as tosnap */ - if (fromds && (ds->ds_dir != fromds->ds_dir || - fromds->ds_phys->ds_creation_txg >= ds->ds_phys->ds_creation_txg)) + /* + * fromsnap must be an earlier snapshot from the same fs as tosnap, + * or the origin's fs. + */ + if (fromds != NULL && !is_before(ds, fromds)) return (EXDEV); - if (fromorigin) { - if (fromsnap) - return (EINVAL); - - if (dsl_dir_is_clone(ds->ds_dir)) { - rw_enter(&dp->dp_config_rwlock, RW_READER); - err = dsl_dataset_hold_obj(dp, - ds->ds_dir->dd_phys->dd_origin_obj, FTAG, &fromds); - rw_exit(&dp->dp_config_rwlock); - if (err) - return (err); - } else { - fromorigin = B_FALSE; - } - } - /* Get uncompressed size estimate of changed data. */ if (fromds == NULL) { size = ds->ds_phys->ds_uncompressed_bytes; @@ -562,8 +567,6 @@ dmu_send_estimate(objset_t *tosnap, objs uint64_t used, comp; err = dsl_dataset_space_written(fromds, ds, &used, &comp, &size); - if (fromorigin) - dsl_dataset_rele(fromds, FTAG); if (err) return (err); } @@ -662,8 +665,7 @@ recv_new_sync(void *arg1, void *arg2, dm rbsa->ds, &rbsa->ds->ds_phys->ds_bp, rbsa->type, tx); } - spa_history_log_internal(LOG_DS_REPLAY_FULL_SYNC, - dd->dd_pool->dp_spa, tx, "dataset = %lld", dsobj); + spa_history_log_internal_ds(rbsa->ds, "receive new", tx, ""); } /* ARGSUSED */ @@ -764,8 +766,7 @@ recv_existing_sync(void *arg1, void *arg rbsa->ds = cds; - spa_history_log_internal(LOG_DS_REPLAY_INC_SYNC, - dp->dp_spa, tx, "dataset = %lld", dsobj); + spa_history_log_internal_ds(cds, "receive over existing", tx, ""); } static boolean_t @@ -1573,6 +1574,7 @@ recv_end_sync(void *arg1, void *arg2, dm dmu_buf_will_dirty(ds->ds_dbuf, tx); ds->ds_phys->ds_flags &= ~DS_FLAG_INCONSISTENT; + spa_history_log_internal_ds(ds, "finished receiving", tx, ""); } static int Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c Wed Jul 18 10:46:31 2012 (r238589) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c Wed Jul 18 10:51:11 2012 (r238590) @@ -48,7 +48,7 @@ dmu_tx_create_dd(dsl_dir_t *dd) { dmu_tx_t *tx = kmem_zalloc(sizeof (dmu_tx_t), KM_SLEEP); tx->tx_dir = dd; - if (dd) + if (dd != NULL) tx->tx_pool = dd->dd_pool; list_create(&tx->tx_holds, sizeof (dmu_tx_hold_t), offsetof(dmu_tx_hold_t, txh_node)); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Wed Jul 18 10:46:31 2012 (r238589) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Wed Jul 18 10:51:11 2012 (r238590) @@ -914,7 +914,8 @@ dsl_dataset_create_sync(dsl_dir_t *pdd, * The snapshots must all be in the same pool. */ int -dmu_snapshots_destroy_nvl(nvlist_t *snaps, boolean_t defer, char *failed) +dmu_snapshots_destroy_nvl(nvlist_t *snaps, boolean_t defer, + nvlist_t *errlist) { int err; dsl_sync_task_t *dst; @@ -949,7 +950,7 @@ dmu_snapshots_destroy_nvl(nvlist_t *snap } else if (err == ENOENT) { err = 0; } else { - (void) strcpy(failed, nvpair_name(pair)); + fnvlist_add_int32(errlist, nvpair_name(pair), err); break; } } @@ -963,10 +964,12 @@ dmu_snapshots_destroy_nvl(nvlist_t *snap dsl_dataset_t *ds = dsda->ds; /* - * Return the file system name that triggered the error + * Return the snapshots that triggered the error. */ - if (dst->dst_err) { - dsl_dataset_name(ds, failed); + if (dst->dst_err != 0) { + char name[ZFS_MAXNAMELEN]; + dsl_dataset_name(ds, name); + fnvlist_add_int32(errlist, name, dst->dst_err); } ASSERT3P(dsda->rm_origin, ==, NULL); dsl_dataset_disown(ds, dstg); @@ -1045,7 +1048,6 @@ dsl_dataset_destroy(dsl_dataset_t *ds, v dsl_dir_t *dd; uint64_t obj; struct dsl_ds_destroyarg dsda = { 0 }; - dsl_dataset_t dummy_ds = { 0 }; dsda.ds = ds; @@ -1065,8 +1067,6 @@ dsl_dataset_destroy(dsl_dataset_t *ds, v } dd = ds->ds_dir; - dummy_ds.ds_dir = dd; - dummy_ds.ds_object = ds->ds_object; /* * Check for errors and mark this ds as inconsistent, in @@ -1153,7 +1153,7 @@ dsl_dataset_destroy(dsl_dataset_t *ds, v dsl_sync_task_create(dstg, dsl_dataset_destroy_check, dsl_dataset_destroy_sync, &dsda, tag, 0); dsl_sync_task_create(dstg, dsl_dir_destroy_check, - dsl_dir_destroy_sync, &dummy_ds, FTAG, 0); + dsl_dir_destroy_sync, dd, FTAG, 0); err = dsl_sync_task_group_wait(dstg); dsl_sync_task_group_destroy(dstg); @@ -1328,14 +1328,12 @@ static void dsl_dataset_destroy_begin_sync(void *arg1, void *arg2, dmu_tx_t *tx) { dsl_dataset_t *ds = arg1; - dsl_pool_t *dp = ds->ds_dir->dd_pool; /* Mark it as inconsistent on-disk, in case we crash */ dmu_buf_will_dirty(ds->ds_dbuf, tx); ds->ds_phys->ds_flags |= DS_FLAG_INCONSISTENT; - spa_history_log_internal(LOG_DS_DESTROY_BEGIN, dp->dp_spa, tx, - "dataset = %llu", ds->ds_object); + spa_history_log_internal_ds(ds, "destroy begin", tx, ""); } static int @@ -1660,9 +1658,13 @@ dsl_dataset_destroy_sync(void *arg1, voi ASSERT(spa_version(dp->dp_spa) >= SPA_VERSION_USERREFS); dmu_buf_will_dirty(ds->ds_dbuf, tx); ds->ds_phys->ds_flags |= DS_FLAG_DEFER_DESTROY; + spa_history_log_internal_ds(ds, "defer_destroy", tx, ""); return; } + /* We need to log before removing it from the namespace. */ + spa_history_log_internal_ds(ds, "destroy", tx, ""); + /* signal any waiters that this dataset is going away */ mutex_enter(&ds->ds_lock); ds->ds_owner = dsl_reaper; @@ -1957,8 +1959,6 @@ dsl_dataset_destroy_sync(void *arg1, voi dsl_dataset_rele(ds_prev, FTAG); spa_prop_clear_bootfs(dp->dp_spa, ds->ds_object, tx); - spa_history_log_internal(LOG_DS_DESTROY, dp->dp_spa, tx, - "dataset = %llu", ds->ds_object); if (ds->ds_phys->ds_next_clones_obj != 0) { uint64_t count; @@ -2006,7 +2006,7 @@ dsl_dataset_snapshot_reserve_space(dsl_d return (ENOSPC); /* - * Propogate any reserved space for this snapshot to other + * Propagate any reserved space for this snapshot to other * snapshot checks in this sync group. */ if (asize > 0) @@ -2016,10 +2016,9 @@ dsl_dataset_snapshot_reserve_space(dsl_d } int -dsl_dataset_snapshot_check(void *arg1, void *arg2, dmu_tx_t *tx) +dsl_dataset_snapshot_check(dsl_dataset_t *ds, const char *snapname, + dmu_tx_t *tx) { - dsl_dataset_t *ds = arg1; - const char *snapname = arg2; int err; uint64_t value; @@ -2031,7 +2030,7 @@ dsl_dataset_snapshot_check(void *arg1, v return (EAGAIN); /* - * Check for conflicting name snapshot name. + * Check for conflicting snapshot name. */ err = dsl_dataset_snap_lookup(ds, snapname, &value); if (err == 0) @@ -2055,10 +2054,9 @@ dsl_dataset_snapshot_check(void *arg1, v } void -dsl_dataset_snapshot_sync(void *arg1, void *arg2, dmu_tx_t *tx) +dsl_dataset_snapshot_sync(dsl_dataset_t *ds, const char *snapname, + dmu_tx_t *tx) { - dsl_dataset_t *ds = arg1; - const char *snapname = arg2; dsl_pool_t *dp = ds->ds_dir->dd_pool; dmu_buf_t *dbuf; dsl_dataset_phys_t *dsphys; @@ -2164,8 +2162,7 @@ dsl_dataset_snapshot_sync(void *arg1, vo dsl_dir_snap_cmtime_update(ds->ds_dir); - spa_history_log_internal(LOG_DS_SNAPSHOT, dp->dp_spa, tx, - "dataset = %llu", dsobj); + spa_history_log_internal_ds(ds->ds_prev, "snapshot", tx, ""); } void @@ -2252,7 +2249,20 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvl { uint64_t refd, avail, uobjs, aobjs, ratio; - dsl_dir_stats(ds->ds_dir, nv); + ratio = ds->ds_phys->ds_compressed_bytes == 0 ? 100 : + (ds->ds_phys->ds_uncompressed_bytes * 100 / + ds->ds_phys->ds_compressed_bytes); + + dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_REFRATIO, ratio); + + if (dsl_dataset_is_snapshot(ds)) { + dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_COMPRESSRATIO, ratio); + dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USED, + ds->ds_phys->ds_unique_bytes); + get_clones_stat(ds, nv); + } else { + dsl_dir_stats(ds->ds_dir, nv); + } dsl_dataset_space(ds, &refd, &avail, &uobjs, &aobjs); dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_AVAILABLE, avail); @@ -2297,22 +2307,6 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvl } } - ratio = ds->ds_phys->ds_compressed_bytes == 0 ? 100 : - (ds->ds_phys->ds_uncompressed_bytes * 100 / - ds->ds_phys->ds_compressed_bytes); - dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_REFRATIO, ratio); - - if (ds->ds_phys->ds_next_snap_obj) { - /* - * This is a snapshot; override the dd's space used with - * our unique space and compression ratio. - */ - dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USED, - ds->ds_phys->ds_unique_bytes); - dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_COMPRESSRATIO, ratio); - - get_clones_stat(ds, nv); - } } void @@ -2321,27 +2315,25 @@ dsl_dataset_fast_stat(dsl_dataset_t *ds, stat->dds_creation_txg = ds->ds_phys->ds_creation_txg; stat->dds_inconsistent = ds->ds_phys->ds_flags & DS_FLAG_INCONSISTENT; stat->dds_guid = ds->ds_phys->ds_guid; - if (ds->ds_phys->ds_next_snap_obj) { + stat->dds_origin[0] = '\0'; + if (dsl_dataset_is_snapshot(ds)) { stat->dds_is_snapshot = B_TRUE; stat->dds_num_clones = ds->ds_phys->ds_num_children - 1; } else { stat->dds_is_snapshot = B_FALSE; stat->dds_num_clones = 0; - } - - /* clone origin is really a dsl_dir thing... */ - rw_enter(&ds->ds_dir->dd_pool->dp_config_rwlock, RW_READER); - if (dsl_dir_is_clone(ds->ds_dir)) { - dsl_dataset_t *ods; - VERIFY(0 == dsl_dataset_get_ref(ds->ds_dir->dd_pool, - ds->ds_dir->dd_phys->dd_origin_obj, FTAG, &ods)); - dsl_dataset_name(ods, stat->dds_origin); - dsl_dataset_drop_ref(ods, FTAG); - } else { - stat->dds_origin[0] = '\0'; + rw_enter(&ds->ds_dir->dd_pool->dp_config_rwlock, RW_READER); + if (dsl_dir_is_clone(ds->ds_dir)) { + dsl_dataset_t *ods; + + VERIFY(0 == dsl_dataset_get_ref(ds->ds_dir->dd_pool, + ds->ds_dir->dd_phys->dd_origin_obj, FTAG, &ods)); + dsl_dataset_name(ods, stat->dds_origin); + dsl_dataset_drop_ref(ods, FTAG); + } + rw_exit(&ds->ds_dir->dd_pool->dp_config_rwlock); } - rw_exit(&ds->ds_dir->dd_pool->dp_config_rwlock); } uint64_t @@ -2458,8 +2450,8 @@ dsl_dataset_snapshot_rename_sync(void *a ds->ds_snapname, 8, 1, &ds->ds_object, tx); ASSERT3U(err, ==, 0); - spa_history_log_internal(LOG_DS_RENAME, dd->dd_pool->dp_spa, tx, - "dataset = %llu", ds->ds_object); + spa_history_log_internal_ds(ds, "rename", tx, + "-> @%s", newsnapname); dsl_dataset_rele(hds, FTAG); } @@ -2939,8 +2931,7 @@ dsl_dataset_promote_sync(void *arg1, voi origin_ds->ds_phys->ds_unique_bytes = pa->unique; /* log history record */ - spa_history_log_internal(LOG_DS_PROMOTE, dd->dd_pool->dp_spa, tx, - "dataset = %llu", hds->ds_object); + spa_history_log_internal_ds(hds, "promote", tx, ""); dsl_dir_close(odd, FTAG); } @@ -3298,6 +3289,9 @@ dsl_dataset_clone_swap_sync(void *arg1, csa->ohds->ds_phys->ds_deadlist_obj); dsl_scan_ds_clone_swapped(csa->ohds, csa->cds, tx); + + spa_history_log_internal_ds(csa->cds, "clone swap", tx, + "parent=%s", csa->ohds->ds_dir->dd_myname); } /* @@ -3454,9 +3448,8 @@ dsl_dataset_set_quota_sync(void *arg1, v dmu_buf_will_dirty(ds->ds_dbuf, tx); ds->ds_quota = effective_value; - spa_history_log_internal(LOG_DS_REFQUOTA, - ds->ds_dir->dd_pool->dp_spa, tx, "%lld dataset = %llu ", - (longlong_t)ds->ds_quota, ds->ds_object); + spa_history_log_internal_ds(ds, "set refquota", tx, + "refquota=%lld", (longlong_t)ds->ds_quota); } } @@ -3561,9 +3554,8 @@ dsl_dataset_set_reservation_sync(void *a dsl_dir_diduse_space(ds->ds_dir, DD_USED_REFRSRV, delta, 0, 0, tx); mutex_exit(&ds->ds_dir->dd_lock); - spa_history_log_internal(LOG_DS_REFRESERV, - ds->ds_dir->dd_pool->dp_spa, tx, "%lld dataset = %llu", - (longlong_t)effective_value, ds->ds_object); + spa_history_log_internal_ds(ds, "set refreservation", tx, + "refreservation=%lld", (longlong_t)effective_value); } int @@ -3629,7 +3621,7 @@ dsl_dataset_user_hold_check(void *arg1, { dsl_dataset_t *ds = arg1; struct dsl_ds_holdarg *ha = arg2; - char *htag = ha->htag; + const char *htag = ha->htag; objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset; int error = 0; @@ -3663,7 +3655,7 @@ dsl_dataset_user_hold_sync(void *arg1, v { dsl_dataset_t *ds = arg1; struct dsl_ds_holdarg *ha = arg2; - char *htag = ha->htag; + const char *htag = ha->htag; dsl_pool_t *dp = ds->ds_dir->dd_pool; objset_t *mos = dp->dp_meta_objset; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 10:58:07 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D161F106564A; Wed, 18 Jul 2012 10:58:07 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B82118FC21; Wed, 18 Jul 2012 10:58:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IAw7XC062901; Wed, 18 Jul 2012 10:58:07 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IAw7Y2062891; Wed, 18 Jul 2012 10:58:07 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207181058.q6IAw7Y2062891@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 10:58:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238592 - in vendor/illumos/dist: cmd/zdb cmd/zfs cmd/zhack cmd/zpool cmd/ztest lib/libzfs/common lib/libzfs_core lib/libzfs_core/common lib/libzpool/common lib/libzpool/common/sys man/... X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 10:58:07 -0000 Author: mm Date: Wed Jul 18 10:58:07 2012 New Revision: 238592 URL: http://svn.freebsd.org/changeset/base/238592 Log: Update vendor-sys/illumos/dist to illumos-gate 13752:9f5f6c52ba19 (zfs part) Obtained from: ssh://anonhg@hg.illumos.org/illumos-gate Added: vendor/illumos/dist/lib/libzfs_core/ vendor/illumos/dist/lib/libzfs_core/common/ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/zfs/zfs_main.c vendor/illumos/dist/cmd/zhack/zhack.c vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/cmd/ztest/ztest.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_config.c vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs/common/libzfs_impl.h vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c vendor/illumos/dist/lib/libzfs/common/libzfs_util.c vendor/illumos/dist/lib/libzpool/common/kernel.c vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h vendor/illumos/dist/man/man1m/zfs.1m Modified: vendor/illumos/dist/cmd/zdb/zdb.c ============================================================================== --- vendor/illumos/dist/cmd/zdb/zdb.c Wed Jul 18 10:56:48 2012 (r238591) +++ vendor/illumos/dist/cmd/zdb/zdb.c Wed Jul 18 10:58:07 2012 (r238592) @@ -57,6 +57,7 @@ #include #include #include +#include #undef ZFS_MAXNAMELEN #undef verify #include @@ -204,6 +205,27 @@ dump_packed_nvlist(objset_t *os, uint64_ nvlist_free(nv); } +/* ARGSUSED */ +static void +dump_history_offsets(objset_t *os, uint64_t object, void *data, size_t size) +{ + spa_history_phys_t *shp = data; + + if (shp == NULL) + return; + + (void) printf("\t\tpool_create_len = %llu\n", + (u_longlong_t)shp->sh_pool_create_len); + (void) printf("\t\tphys_max_off = %llu\n", + (u_longlong_t)shp->sh_phys_max_off); + (void) printf("\t\tbof = %llu\n", + (u_longlong_t)shp->sh_bof); + (void) printf("\t\teof = %llu\n", + (u_longlong_t)shp->sh_eof); + (void) printf("\t\trecords_lost = %llu\n", + (u_longlong_t)shp->sh_records_lost); +} + static void zdb_nicenum(uint64_t num, char *buf) { @@ -853,21 +875,22 @@ dump_history(spa_t *spa) for (int i = 0; i < num; i++) { uint64_t time, txg, ievent; char *cmd, *intstr; + boolean_t printed = B_FALSE; if (nvlist_lookup_uint64(events[i], ZPOOL_HIST_TIME, &time) != 0) - continue; + goto next; if (nvlist_lookup_string(events[i], ZPOOL_HIST_CMD, &cmd) != 0) { if (nvlist_lookup_uint64(events[i], ZPOOL_HIST_INT_EVENT, &ievent) != 0) - continue; + goto next; verify(nvlist_lookup_uint64(events[i], ZPOOL_HIST_TXG, &txg) == 0); verify(nvlist_lookup_string(events[i], ZPOOL_HIST_INT_STR, &intstr) == 0); - if (ievent >= LOG_END) - continue; + if (ievent >= ZFS_NUM_LEGACY_HISTORY_EVENTS) + goto next; (void) snprintf(internalstr, sizeof (internalstr), @@ -880,6 +903,14 @@ dump_history(spa_t *spa) (void) localtime_r(&tsec, &t); (void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t); (void) printf("%s %s\n", tbuf, cmd); + printed = B_TRUE; + +next: + if (dump_opt['h'] > 1) { + if (!printed) + (void) printf("unrecognized record:\n"); + dump_nvlist(events[i], 2); + } } } @@ -1456,7 +1487,7 @@ static object_viewer_t *object_viewer[DM dump_zap, /* other ZAP */ dump_zap, /* persistent error log */ dump_uint8, /* SPA history */ - dump_uint64, /* SPA history offsets */ + dump_history_offsets, /* SPA history offsets */ dump_zap, /* Pool properties */ dump_zap, /* DSL permissions */ dump_acl, /* ZFS ACL */ Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c ============================================================================== --- vendor/illumos/dist/cmd/zfs/zfs_main.c Wed Jul 18 10:56:48 2012 (r238591) +++ vendor/illumos/dist/cmd/zfs/zfs_main.c Wed Jul 18 10:58:07 2012 (r238592) @@ -56,6 +56,7 @@ #include #include +#include #include #include #include @@ -70,6 +71,7 @@ libzfs_handle_t *g_zfs; static FILE *mnttab_file; static char history_str[HIS_MAX_RECORD_LEN]; +static boolean_t log_history = B_TRUE; static int zfs_do_clone(int argc, char **argv); static int zfs_do_create(int argc, char **argv); @@ -259,7 +261,7 @@ get_usage(zfs_help_t idx) return (gettext("\tshare <-a | filesystem>\n")); case HELP_SNAPSHOT: return (gettext("\tsnapshot [-r] [-o property=value] ... " - "\n")); + " ...\n")); case HELP_UNMOUNT: return (gettext("\tunmount [-f] " "<-a | filesystem|mountpoint>\n")); @@ -888,9 +890,9 @@ typedef struct destroy_cbdata { nvlist_t *cb_nvl; /* first snap in contiguous run */ - zfs_handle_t *cb_firstsnap; + char *cb_firstsnap; /* previous snap in contiguous run */ - zfs_handle_t *cb_prevsnap; + char *cb_prevsnap; int64_t cb_snapused; char *cb_snapspec; } destroy_cbdata_t; @@ -1004,11 +1006,13 @@ destroy_print_cb(zfs_handle_t *zhp, void if (nvlist_exists(cb->cb_nvl, name)) { if (cb->cb_firstsnap == NULL) - cb->cb_firstsnap = zfs_handle_dup(zhp); + cb->cb_firstsnap = strdup(name); if (cb->cb_prevsnap != NULL) - zfs_close(cb->cb_prevsnap); + free(cb->cb_prevsnap); /* this snap continues the current range */ - cb->cb_prevsnap = zfs_handle_dup(zhp); + cb->cb_prevsnap = strdup(name); + if (cb->cb_firstsnap == NULL || cb->cb_prevsnap == NULL) + nomem(); if (cb->cb_verbose) { if (cb->cb_parsable) { (void) printf("destroy\t%s\n", name); @@ -1023,12 +1027,12 @@ destroy_print_cb(zfs_handle_t *zhp, void } else if (cb->cb_firstsnap != NULL) { /* end of this range */ uint64_t used = 0; - err = zfs_get_snapused_int(cb->cb_firstsnap, + err = lzc_snaprange_space(cb->cb_firstsnap, cb->cb_prevsnap, &used); cb->cb_snapused += used; - zfs_close(cb->cb_firstsnap); + free(cb->cb_firstsnap); cb->cb_firstsnap = NULL; - zfs_close(cb->cb_prevsnap); + free(cb->cb_prevsnap); cb->cb_prevsnap = NULL; } zfs_close(zhp); @@ -1045,13 +1049,13 @@ destroy_print_snapshots(zfs_handle_t *fs if (cb->cb_firstsnap != NULL) { uint64_t used = 0; if (err == 0) { - err = zfs_get_snapused_int(cb->cb_firstsnap, + err = lzc_snaprange_space(cb->cb_firstsnap, cb->cb_prevsnap, &used); } cb->cb_snapused += used; - zfs_close(cb->cb_firstsnap); + free(cb->cb_firstsnap); cb->cb_firstsnap = NULL; - zfs_close(cb->cb_prevsnap); + free(cb->cb_prevsnap); cb->cb_prevsnap = NULL; } return (err); @@ -1064,7 +1068,7 @@ snapshot_to_nvl_cb(zfs_handle_t *zhp, vo int err = 0; /* Check for clones. */ - if (!cb->cb_doclones) { + if (!cb->cb_doclones && !cb->cb_defer_destroy) { cb->cb_target = zhp; cb->cb_first = B_TRUE; err = zfs_iter_dependents(zhp, B_TRUE, @@ -1904,9 +1908,11 @@ upgrade_set_callback(zfs_handle_t *zhp, /* * If they did "zfs upgrade -a", then we could * be doing ioctls to different pools. We need - * to log this history once to each pool. + * to log this history once to each pool, and bypass + * the normal history logging that happens in main(). */ - verify(zpool_stage_history(g_zfs, history_str) == 0); + (void) zpool_log_history(g_zfs, history_str); + log_history = B_FALSE; } if (zfs_prop_set(zhp, "version", verstr) == 0) cb->cb_numupgraded++; @@ -3424,6 +3430,32 @@ zfs_do_set(int argc, char **argv) return (ret); } +typedef struct snap_cbdata { + nvlist_t *sd_nvl; + boolean_t sd_recursive; + const char *sd_snapname; +} snap_cbdata_t; + +static int +zfs_snapshot_cb(zfs_handle_t *zhp, void *arg) +{ + snap_cbdata_t *sd = arg; + char *name; + int rv = 0; + int error; + + error = asprintf(&name, "%s@%s", zfs_get_name(zhp), sd->sd_snapname); + if (error == -1) + nomem(); + fnvlist_add_boolean(sd->sd_nvl, name); + free(name); + + if (sd->sd_recursive) + rv = zfs_iter_filesystems(zhp, zfs_snapshot_cb, sd); + zfs_close(zhp); + return (rv); +} + /* * zfs snapshot [-r] [-o prop=value] ... * @@ -3433,13 +3465,16 @@ zfs_do_set(int argc, char **argv) static int zfs_do_snapshot(int argc, char **argv) { - boolean_t recursive = B_FALSE; int ret = 0; char c; nvlist_t *props; + snap_cbdata_t sd = { 0 }; + boolean_t multiple_snaps = B_FALSE; if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0) nomem(); + if (nvlist_alloc(&sd.sd_nvl, NV_UNIQUE_NAME, 0) != 0) + nomem(); /* check options */ while ((c = getopt(argc, argv, "ro:")) != -1) { @@ -3449,7 +3484,8 @@ zfs_do_snapshot(int argc, char **argv) return (1); break; case 'r': - recursive = B_TRUE; + sd.sd_recursive = B_TRUE; + multiple_snaps = B_TRUE; break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), @@ -3466,18 +3502,35 @@ zfs_do_snapshot(int argc, char **argv) (void) fprintf(stderr, gettext("missing snapshot argument\n")); goto usage; } - if (argc > 1) { - (void) fprintf(stderr, gettext("too many arguments\n")); - goto usage; + + if (argc > 1) + multiple_snaps = B_TRUE; + for (; argc > 0; argc--, argv++) { + char *atp; + zfs_handle_t *zhp; + + atp = strchr(argv[0], '@'); + if (atp == NULL) + goto usage; + *atp = '\0'; + sd.sd_snapname = atp + 1; + zhp = zfs_open(g_zfs, argv[0], + ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); + if (zhp == NULL) + goto usage; + if (zfs_snapshot_cb(zhp, &sd) != 0) + goto usage; } - ret = zfs_snapshot(g_zfs, argv[0], recursive, props); + ret = zfs_snapshot_nvl(g_zfs, sd.sd_nvl, props); + nvlist_free(sd.sd_nvl); nvlist_free(props); - if (ret && recursive) + if (ret != 0 && multiple_snaps) (void) fprintf(stderr, gettext("no snapshots were created\n")); return (ret != 0); usage: + nvlist_free(sd.sd_nvl); nvlist_free(props); usage(B_FALSE); return (-1); @@ -6479,8 +6532,7 @@ main(int argc, char **argv) return (1); } - zpool_set_history_str("zfs", argc, argv, history_str); - verify(zpool_stage_history(g_zfs, history_str) == 0); + zfs_save_arguments(argc, argv, history_str, sizeof (history_str)); libzfs_print_on_error(g_zfs, B_TRUE); @@ -6549,6 +6601,9 @@ main(int argc, char **argv) (void) fclose(mnttab_file); + if (ret == 0 && log_history) + (void) zpool_log_history(g_zfs, history_str); + libzfs_fini(g_zfs); /* Modified: vendor/illumos/dist/cmd/zhack/zhack.c ============================================================================== --- vendor/illumos/dist/cmd/zhack/zhack.c Wed Jul 18 10:56:48 2012 (r238591) +++ vendor/illumos/dist/cmd/zhack/zhack.c Wed Jul 18 10:58:07 2012 (r238592) @@ -279,6 +279,9 @@ feature_enable_sync(void *arg1, void *ar zfeature_info_t *feature = arg2; spa_feature_enable(spa, feature, tx); + spa_history_log_internal(spa, "zhack enable feature", tx, + "name=%s can_readonly=%u", + feature->fi_guid, feature->fi_can_readonly); } static void @@ -356,6 +359,8 @@ feature_incr_sync(void *arg1, void *arg2 zfeature_info_t *feature = arg2; spa_feature_incr(spa, feature, tx); + spa_history_log_internal(spa, "zhack feature incr", tx, + "name=%s", feature->fi_guid); } static void @@ -365,6 +370,8 @@ feature_decr_sync(void *arg1, void *arg2 zfeature_info_t *feature = arg2; spa_feature_decr(spa, feature, tx); + spa_history_log_internal(spa, "zhack feature decr", tx, + "name=%s", feature->fi_guid); } static void Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_main.c Wed Jul 18 10:56:48 2012 (r238591) +++ vendor/illumos/dist/cmd/zpool/zpool_main.c Wed Jul 18 10:58:07 2012 (r238592) @@ -185,9 +185,9 @@ static zpool_command_t command_table[] = #define NCOMMAND (sizeof (command_table) / sizeof (command_table[0])) -zpool_command_t *current_command; +static zpool_command_t *current_command; static char history_str[HIS_MAX_RECORD_LEN]; - +static boolean_t log_history = B_TRUE; static uint_t timestamp_fmt = NODATE; static const char * @@ -935,7 +935,10 @@ zpool_do_destroy(int argc, char **argv) return (1); } - ret = (zpool_destroy(zhp) != 0); + /* The history must be logged as part of the export */ + log_history = B_FALSE; + + ret = (zpool_destroy(zhp, history_str) != 0); zpool_close(zhp); @@ -999,10 +1002,13 @@ zpool_do_export(int argc, char **argv) continue; } + /* The history must be logged as part of the export */ + log_history = B_FALSE; + if (hardforce) { - if (zpool_export_force(zhp) != 0) + if (zpool_export_force(zhp, history_str) != 0) ret = 1; - } else if (zpool_export(zhp, force) != 0) { + } else if (zpool_export(zhp, force, history_str) != 0) { ret = 1; } @@ -4269,6 +4275,14 @@ upgrade_cb(zpool_handle_t *zhp, void *ar (void) printf(gettext("Successfully upgraded " "'%s'\n\n"), zpool_get_name(zhp)); } + /* + * If they did "zpool upgrade -a", then we could + * be doing ioctls to different pools. We need + * to log this history once to each pool, and bypass + * the normal history logging that happens in main(). + */ + (void) zpool_log_history(g_zfs, history_str); + log_history = B_FALSE; } } else if (cbp->cb_newer && !SPA_VERSION_IS_SUPPORTED(version)) { assert(!cbp->cb_all); @@ -4491,8 +4505,8 @@ zpool_do_upgrade(int argc, char **argv) typedef struct hist_cbdata { boolean_t first; - int longfmt; - int internal; + boolean_t longfmt; + boolean_t internal; } hist_cbdata_t; /* @@ -4504,21 +4518,8 @@ get_history_one(zpool_handle_t *zhp, voi nvlist_t *nvhis; nvlist_t **records; uint_t numrecords; - char *cmdstr; - char *pathstr; - uint64_t dst_time; - time_t tsec; - struct tm t; - char tbuf[30]; int ret, i; - uint64_t who; - struct passwd *pwd; - char *hostname; - char *zonename; - char internalstr[MAXPATHLEN]; hist_cbdata_t *cb = (hist_cbdata_t *)data; - uint64_t txg; - uint64_t ievent; cb->first = B_FALSE; @@ -4530,64 +4531,94 @@ get_history_one(zpool_handle_t *zhp, voi verify(nvlist_lookup_nvlist_array(nvhis, ZPOOL_HIST_RECORD, &records, &numrecords) == 0); for (i = 0; i < numrecords; i++) { - if (nvlist_lookup_uint64(records[i], ZPOOL_HIST_TIME, - &dst_time) != 0) - continue; + nvlist_t *rec = records[i]; + char tbuf[30] = ""; - /* is it an internal event or a standard event? */ - if (nvlist_lookup_string(records[i], ZPOOL_HIST_CMD, - &cmdstr) != 0) { - if (cb->internal == 0) + if (nvlist_exists(rec, ZPOOL_HIST_TIME)) { + time_t tsec; + struct tm t; + + tsec = fnvlist_lookup_uint64(records[i], + ZPOOL_HIST_TIME); + (void) localtime_r(&tsec, &t); + (void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t); + } + + if (nvlist_exists(rec, ZPOOL_HIST_CMD)) { + (void) printf("%s %s", tbuf, + fnvlist_lookup_string(rec, ZPOOL_HIST_CMD)); + } else if (nvlist_exists(rec, ZPOOL_HIST_INT_EVENT)) { + int ievent = + fnvlist_lookup_uint64(rec, ZPOOL_HIST_INT_EVENT); + if (!cb->internal) continue; - - if (nvlist_lookup_uint64(records[i], - ZPOOL_HIST_INT_EVENT, &ievent) != 0) + if (ievent >= ZFS_NUM_LEGACY_HISTORY_EVENTS) { + (void) printf("%s unrecognized record:\n", + tbuf); + dump_nvlist(rec, 4); + continue; + } + (void) printf("%s [internal %s txg:%lld] %s", tbuf, + zfs_history_event_names[ievent], + fnvlist_lookup_uint64(rec, ZPOOL_HIST_TXG), + fnvlist_lookup_string(rec, ZPOOL_HIST_INT_STR)); + } else if (nvlist_exists(rec, ZPOOL_HIST_INT_NAME)) { + if (!cb->internal) continue; - verify(nvlist_lookup_uint64(records[i], - ZPOOL_HIST_TXG, &txg) == 0); - verify(nvlist_lookup_string(records[i], - ZPOOL_HIST_INT_STR, &pathstr) == 0); - if (ievent >= LOG_END) + (void) printf("%s [txg:%lld] %s", tbuf, + fnvlist_lookup_uint64(rec, ZPOOL_HIST_TXG), + fnvlist_lookup_string(rec, ZPOOL_HIST_INT_NAME)); + if (nvlist_exists(rec, ZPOOL_HIST_DSNAME)) { + (void) printf(" %s (%llu)", + fnvlist_lookup_string(rec, + ZPOOL_HIST_DSNAME), + fnvlist_lookup_uint64(rec, + ZPOOL_HIST_DSID)); + } + (void) printf(" %s", fnvlist_lookup_string(rec, + ZPOOL_HIST_INT_STR)); + } else if (nvlist_exists(rec, ZPOOL_HIST_IOCTL)) { + if (!cb->internal) continue; - (void) snprintf(internalstr, - sizeof (internalstr), - "[internal %s txg:%lld] %s", - zfs_history_event_names[ievent], txg, - pathstr); - cmdstr = internalstr; - } - tsec = dst_time; - (void) localtime_r(&tsec, &t); - (void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t); - (void) printf("%s %s", tbuf, cmdstr); + (void) printf("%s ioctl %s\n", tbuf, + fnvlist_lookup_string(rec, ZPOOL_HIST_IOCTL)); + if (nvlist_exists(rec, ZPOOL_HIST_INPUT_NVL)) { + (void) printf(" input:\n"); + dump_nvlist(fnvlist_lookup_nvlist(rec, + ZPOOL_HIST_INPUT_NVL), 8); + } + if (nvlist_exists(rec, ZPOOL_HIST_OUTPUT_NVL)) { + (void) printf(" output:\n"); + dump_nvlist(fnvlist_lookup_nvlist(rec, + ZPOOL_HIST_OUTPUT_NVL), 8); + } + } else { + if (!cb->internal) + continue; + (void) printf("%s unrecognized record:\n", tbuf); + dump_nvlist(rec, 4); + } if (!cb->longfmt) { (void) printf("\n"); continue; } (void) printf(" ["); - if (nvlist_lookup_uint64(records[i], - ZPOOL_HIST_WHO, &who) == 0) { - pwd = getpwuid((uid_t)who); - if (pwd) - (void) printf("user %s on", - pwd->pw_name); - else - (void) printf("user %d on", - (int)who); - } else { - (void) printf(gettext("no info]\n")); - continue; + if (nvlist_exists(rec, ZPOOL_HIST_WHO)) { + uid_t who = fnvlist_lookup_uint64(rec, ZPOOL_HIST_WHO); + struct passwd *pwd = getpwuid(who); + (void) printf("user %d ", (int)who); + if (pwd != NULL) + (void) printf("(%s) ", pwd->pw_name); + } + if (nvlist_exists(rec, ZPOOL_HIST_HOST)) { + (void) printf("on %s", + fnvlist_lookup_string(rec, ZPOOL_HIST_HOST)); + } + if (nvlist_exists(rec, ZPOOL_HIST_ZONE)) { + (void) printf(":%s", + fnvlist_lookup_string(rec, ZPOOL_HIST_ZONE)); } - if (nvlist_lookup_string(records[i], - ZPOOL_HIST_HOST, &hostname) == 0) { - (void) printf(" %s", hostname); - } - if (nvlist_lookup_string(records[i], - ZPOOL_HIST_ZONE, &zonename) == 0) { - (void) printf(":%s", zonename); - } - (void) printf("]"); (void) printf("\n"); } @@ -4602,8 +4633,6 @@ get_history_one(zpool_handle_t *zhp, voi * * Displays the history of commands that modified pools. */ - - int zpool_do_history(int argc, char **argv) { @@ -4616,10 +4645,10 @@ zpool_do_history(int argc, char **argv) while ((c = getopt(argc, argv, "li")) != -1) { switch (c) { case 'l': - cbdata.longfmt = 1; + cbdata.longfmt = B_TRUE; break; case 'i': - cbdata.internal = 1; + cbdata.internal = B_TRUE; break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), @@ -4844,8 +4873,7 @@ main(int argc, char **argv) if (strcmp(cmdname, "-?") == 0) usage(B_TRUE); - zpool_set_history_str("zpool", argc, argv, history_str); - verify(zpool_stage_history(g_zfs, history_str) == 0); + zfs_save_arguments(argc, argv, history_str, sizeof (history_str)); /* * Run the appropriate command. @@ -4872,6 +4900,9 @@ main(int argc, char **argv) usage(B_FALSE); } + if (ret == 0 && log_history) + (void) zpool_log_history(g_zfs, history_str); + libzfs_fini(g_zfs); /* Modified: vendor/illumos/dist/cmd/ztest/ztest.c ============================================================================== --- vendor/illumos/dist/cmd/ztest/ztest.c Wed Jul 18 10:56:48 2012 (r238591) +++ vendor/illumos/dist/cmd/ztest/ztest.c Wed Jul 18 10:58:07 2012 (r238592) @@ -2252,7 +2252,7 @@ ztest_spa_create_destroy(ztest_ds_t *zd, */ nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1); VERIFY3U(ENOENT, ==, - spa_create("ztest_bad_file", nvroot, NULL, NULL, NULL)); + spa_create("ztest_bad_file", nvroot, NULL, NULL)); nvlist_free(nvroot); /* @@ -2260,7 +2260,7 @@ ztest_spa_create_destroy(ztest_ds_t *zd, */ nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 2, 1); VERIFY3U(ENOENT, ==, - spa_create("ztest_bad_mirror", nvroot, NULL, NULL, NULL)); + spa_create("ztest_bad_mirror", nvroot, NULL, NULL)); nvlist_free(nvroot); /* @@ -2269,7 +2269,7 @@ ztest_spa_create_destroy(ztest_ds_t *zd, */ (void) rw_rdlock(&ztest_name_lock); nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1); - VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL, NULL)); + VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL)); nvlist_free(nvroot); VERIFY3U(0, ==, spa_open(zo->zo_pool, &spa, FTAG)); VERIFY3U(EBUSY, ==, spa_destroy(zo->zo_pool)); @@ -3056,8 +3056,7 @@ ztest_snapshot_create(char *osname, uint (void) snprintf(snapname, MAXNAMELEN, "%s@%llu", osname, (u_longlong_t)id); - error = dmu_objset_snapshot(osname, strchr(snapname, '@') + 1, - NULL, NULL, B_FALSE, B_FALSE, -1); + error = dmu_objset_snapshot_one(osname, strchr(snapname, '@') + 1); if (error == ENOSPC) { ztest_record_enospc(FTAG); return (B_FALSE); @@ -3257,8 +3256,7 @@ ztest_dsl_dataset_promote_busy(ztest_ds_ (void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id); (void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id); - error = dmu_objset_snapshot(osname, strchr(snap1name, '@')+1, - NULL, NULL, B_FALSE, B_FALSE, -1); + error = dmu_objset_snapshot_one(osname, strchr(snap1name, '@') + 1); if (error && error != EEXIST) { if (error == ENOSPC) { ztest_record_enospc(FTAG); @@ -3281,8 +3279,7 @@ ztest_dsl_dataset_promote_busy(ztest_ds_ fatal(0, "dmu_objset_create(%s) = %d", clone1name, error); } - error = dmu_objset_snapshot(clone1name, strchr(snap2name, '@')+1, - NULL, NULL, B_FALSE, B_FALSE, -1); + error = dmu_objset_snapshot_one(clone1name, strchr(snap2name, '@') + 1); if (error && error != EEXIST) { if (error == ENOSPC) { ztest_record_enospc(FTAG); @@ -3291,8 +3288,7 @@ ztest_dsl_dataset_promote_busy(ztest_ds_ fatal(0, "dmu_open_snapshot(%s) = %d", snap2name, error); } - error = dmu_objset_snapshot(clone1name, strchr(snap3name, '@')+1, - NULL, NULL, B_FALSE, B_FALSE, -1); + error = dmu_objset_snapshot_one(clone1name, strchr(snap3name, '@') + 1); if (error && error != EEXIST) { if (error == ENOSPC) { ztest_record_enospc(FTAG); @@ -4480,8 +4476,7 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, * Create snapshot, clone it, mark snap for deferred destroy, * destroy clone, verify snap was also destroyed. */ - error = dmu_objset_snapshot(osname, snapname, NULL, NULL, FALSE, - FALSE, -1); + error = dmu_objset_snapshot_one(osname, snapname); if (error) { if (error == ENOSPC) { ztest_record_enospc("dmu_objset_snapshot"); @@ -4523,8 +4518,7 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, * destroy a held snapshot, mark for deferred destroy, * release hold, verify snapshot was destroyed. */ - error = dmu_objset_snapshot(osname, snapname, NULL, NULL, FALSE, - FALSE, -1); + error = dmu_objset_snapshot_one(osname, snapname); if (error) { if (error == ENOSPC) { ztest_record_enospc("dmu_objset_snapshot"); @@ -5612,8 +5606,7 @@ ztest_init(ztest_shared_t *zs) spa_feature_table[i].fi_uname); VERIFY3U(0, ==, nvlist_add_uint64(props, buf, 0)); } - VERIFY3U(0, ==, spa_create(ztest_opts.zo_pool, nvroot, props, - NULL, NULL)); + VERIFY3U(0, ==, spa_create(ztest_opts.zo_pool, nvroot, props, NULL)); nvlist_free(nvroot); VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG)); Modified: vendor/illumos/dist/lib/libzfs/common/libzfs.h ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs.h Wed Jul 18 10:56:48 2012 (r238591) +++ vendor/illumos/dist/lib/libzfs/common/libzfs.h Wed Jul 18 10:58:07 2012 (r238592) @@ -54,7 +54,8 @@ extern "C" { /* * libzfs errors */ -enum { +typedef enum zfs_error { + EZFS_SUCCESS = 0, /* no error -- success */ EZFS_NOMEM = 2000, /* out of memory */ EZFS_BADPROP, /* invalid property value */ EZFS_PROPREADONLY, /* cannot set readonly property */ @@ -126,7 +127,7 @@ enum { EZFS_DIFFDATA, /* bad zfs diff data */ EZFS_POOLREADONLY, /* pool is in read-only mode */ EZFS_UNKNOWN -}; +} zfs_error_t; /* * The following data structures are all part @@ -182,6 +183,9 @@ extern libzfs_handle_t *zfs_get_handle(z extern void libzfs_print_on_error(libzfs_handle_t *, boolean_t); +extern void zfs_save_arguments(int argc, char **, char *, int); +extern int zpool_log_history(libzfs_handle_t *, const char *); + extern int libzfs_errno(libzfs_handle_t *); extern const char *libzfs_error_action(libzfs_handle_t *); extern const char *libzfs_error_description(libzfs_handle_t *); @@ -216,7 +220,7 @@ extern int zpool_iter(libzfs_handle_t *, */ extern int zpool_create(libzfs_handle_t *, const char *, nvlist_t *, nvlist_t *, nvlist_t *); -extern int zpool_destroy(zpool_handle_t *); +extern int zpool_destroy(zpool_handle_t *, const char *); extern int zpool_add(zpool_handle_t *, nvlist_t *); typedef struct splitflags { @@ -338,8 +342,8 @@ extern int zpool_get_errlog(zpool_handle /* * Import and export functions */ -extern int zpool_export(zpool_handle_t *, boolean_t); -extern int zpool_export_force(zpool_handle_t *); +extern int zpool_export(zpool_handle_t *, boolean_t, const char *); +extern int zpool_export_force(zpool_handle_t *, const char *); extern int zpool_import(libzfs_handle_t *, nvlist_t *, const char *, char *altroot); extern int zpool_import_props(libzfs_handle_t *, nvlist_t *, const char *, @@ -373,7 +377,7 @@ extern nvlist_t *zpool_find_import_cache */ struct zfs_cmd; -extern const char *zfs_history_event_names[LOG_END]; +extern const char *zfs_history_event_names[]; extern char *zpool_vdev_name(libzfs_handle_t *, zpool_handle_t *, nvlist_t *, boolean_t verbose); @@ -381,9 +385,6 @@ extern int zpool_upgrade(zpool_handle_t extern int zpool_get_history(zpool_handle_t *, nvlist_t **); extern int zpool_history_unpack(char *, uint64_t, uint64_t *, nvlist_t ***, uint_t *); -extern void zpool_set_history_str(const char *subcommand, int argc, - char **argv, char *history_str); -extern int zpool_stage_history(libzfs_handle_t *, const char *); extern void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *, size_t len); extern int zfs_ioctl(libzfs_handle_t *, int, struct zfs_cmd *); @@ -436,8 +437,6 @@ extern int zfs_prop_get_written(zfs_hand char *propbuf, int proplen, boolean_t literal); extern int zfs_prop_get_feature(zfs_handle_t *zhp, const char *propname, char *buf, size_t len); -extern int zfs_get_snapused_int(zfs_handle_t *firstsnap, zfs_handle_t *lastsnap, - uint64_t *usedp); extern uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t); extern int zfs_prop_inherit(zfs_handle_t *, const char *, boolean_t); extern const char *zfs_prop_values(zfs_prop_t); @@ -553,6 +552,8 @@ extern int zfs_destroy_snaps(zfs_handle_ extern int zfs_destroy_snaps_nvl(zfs_handle_t *, nvlist_t *, boolean_t); extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *); extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *); +extern int zfs_snapshot_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, + nvlist_t *props); extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t); extern int zfs_rename(zfs_handle_t *, const char *, boolean_t, boolean_t); Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_config.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_config.c Wed Jul 18 10:56:48 2012 (r238591) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_config.c Wed Jul 18 10:58:07 2012 (r238592) @@ -337,6 +337,48 @@ zpool_refresh_stats(zpool_handle_t *zhp, } /* + * If the __ZFS_POOL_RESTRICT environment variable is set we only iterate over + * pools it lists. + * + * This is an undocumented feature for use during testing only. + * + * This function returns B_TRUE if the pool should be skipped + * during iteration. + */ +static boolean_t +check_restricted(const char *poolname) +{ + static boolean_t initialized = B_FALSE; + static char *restricted = NULL; + + const char *cur, *end; + int len, namelen; + + if (!initialized) { + initialized = B_TRUE; + restricted = getenv("__ZFS_POOL_RESTRICT"); + } + + if (NULL == restricted) + return (B_FALSE); + + cur = restricted; + namelen = strlen(poolname); + do { + end = strchr(cur, ' '); + len = (NULL == end) ? strlen(cur) : (end - cur); + + if (len == namelen && 0 == strncmp(cur, poolname, len)) { + return (B_FALSE); + } + + cur += (len + 1); + } while (NULL != end); + + return (B_TRUE); +} + +/* * Iterate over all pools in the system. */ int @@ -359,6 +401,9 @@ zpool_iter(libzfs_handle_t *hdl, zpool_i for (cn = uu_avl_first(hdl->libzfs_ns_avl); cn != NULL; cn = uu_avl_next(hdl->libzfs_ns_avl, cn)) { + if (check_restricted(cn->cn_name)) + continue; + if (zpool_open_silent(hdl, cn->cn_name, &zhp) != 0) { hdl->libzfs_pool_iter--; return (-1); @@ -394,6 +439,9 @@ zfs_iter_root(libzfs_handle_t *hdl, zfs_ for (cn = uu_avl_first(hdl->libzfs_ns_avl); cn != NULL; cn = uu_avl_next(hdl->libzfs_ns_avl, cn)) { + if (check_restricted(cn->cn_name)) + continue; + if ((zhp = make_dataset_handle(hdl, cn->cn_name)) == NULL) continue; Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Wed Jul 18 10:56:48 2012 (r238591) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Wed Jul 18 10:58:07 2012 (r238592) @@ -1407,8 +1407,7 @@ zfs_prop_set(zfs_handle_t *zhp, const ch libzfs_handle_t *hdl = zhp->zfs_hdl; nvlist_t *nvl = NULL, *realprops; zfs_prop_t prop; - boolean_t do_prefix; - uint64_t idx; + boolean_t do_prefix = B_TRUE; int added_resv; (void) snprintf(errbuf, sizeof (errbuf), @@ -1447,12 +1446,17 @@ zfs_prop_set(zfs_handle_t *zhp, const ch } /* - * If the dataset's canmount property is being set to noauto, - * then we want to prevent unmounting & remounting it. - */ - do_prefix = !((prop == ZFS_PROP_CANMOUNT) && - (zprop_string_to_index(prop, propval, &idx, - ZFS_TYPE_DATASET) == 0) && (idx == ZFS_CANMOUNT_NOAUTO)); + * We don't want to unmount & remount the dataset when changing + * its canmount property to 'on' or 'noauto'. We only use + * the changelist logic to unmount when setting canmount=off. + */ + if (prop == ZFS_PROP_CANMOUNT) { + uint64_t idx; + int err = zprop_string_to_index(prop, propval, &idx, + ZFS_TYPE_DATASET); + if (err == 0 && idx != ZFS_CANMOUNT_OFF) + do_prefix = B_FALSE; + } if (do_prefix && (ret = changelist_prefix(cl)) != 0) goto error; @@ -2641,25 +2645,6 @@ zfs_prop_get_written(zfs_handle_t *zhp, return (0); } -int -zfs_get_snapused_int(zfs_handle_t *firstsnap, zfs_handle_t *lastsnap, - uint64_t *usedp) -{ - int err; - zfs_cmd_t zc = { 0 }; - - (void) strlcpy(zc.zc_name, lastsnap->zfs_name, sizeof (zc.zc_name)); - (void) strlcpy(zc.zc_value, firstsnap->zfs_name, sizeof (zc.zc_value)); - - err = ioctl(lastsnap->zfs_hdl->libzfs_fd, ZFS_IOC_SPACE_SNAPS, &zc); - if (err) - return (err); - - *usedp = zc.zc_cookie; - - return (0); -} - /* * Returns the name of the given zfs handle. */ @@ -2860,7 +2845,6 @@ create_parents(libzfs_handle_t *hdl, cha */ for (cp = target + prefixlen + 1; cp = strchr(cp, '/'); *cp = '/', cp++) { - char *logstr; *cp = '\0'; @@ -2871,16 +2855,12 @@ create_parents(libzfs_handle_t *hdl, cha continue; } - logstr = hdl->libzfs_log_str; - hdl->libzfs_log_str = NULL; if (zfs_create(hdl, target, ZFS_TYPE_FILESYSTEM, NULL) != 0) { - hdl->libzfs_log_str = logstr; opname = dgettext(TEXT_DOMAIN, "create"); goto ancestorerr; } - hdl->libzfs_log_str = logstr; h = zfs_open(hdl, target, ZFS_TYPE_FILESYSTEM); if (h == NULL) { opname = dgettext(TEXT_DOMAIN, "open"); @@ -2938,12 +2918,12 @@ int zfs_create(libzfs_handle_t *hdl, const char *path, zfs_type_t type, nvlist_t *props) { - zfs_cmd_t zc = { 0 }; int ret; uint64_t size = 0; uint64_t blocksize = zfs_prop_default_numeric(ZFS_PROP_VOLBLOCKSIZE); char errbuf[1024]; uint64_t zoned; + dmu_objset_type_t ost; (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot create '%s'"), path); @@ -2963,17 +2943,16 @@ zfs_create(libzfs_handle_t *hdl, const c * will return ENOENT, not EEXIST. To prevent this from happening, we * first try to see if the dataset exists. */ - (void) strlcpy(zc.zc_name, path, sizeof (zc.zc_name)); - if (zfs_dataset_exists(hdl, zc.zc_name, ZFS_TYPE_DATASET)) { + if (zfs_dataset_exists(hdl, path, ZFS_TYPE_DATASET)) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "dataset already exists")); return (zfs_error(hdl, EZFS_EXISTS, errbuf)); } if (type == ZFS_TYPE_VOLUME) - zc.zc_objset_type = DMU_OST_ZVOL; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@FreeBSD.ORG Wed Jul 18 10:58:30 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8B1A1065708; Wed, 18 Jul 2012 10:58:30 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A99368FC12; Wed, 18 Jul 2012 10:58:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IAwUaD062960; Wed, 18 Jul 2012 10:58:30 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6IAwUWB062958; Wed, 18 Jul 2012 10:58:30 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207181058.q6IAwUWB062958@svn.freebsd.org> From: Martin Matuska Date: Wed, 18 Jul 2012 10:58:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238593 - vendor/illumos/dist/tools/ctf/cvt X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 10:58:30 -0000 Author: mm Date: Wed Jul 18 10:58:30 2012 New Revision: 238593 URL: http://svn.freebsd.org/changeset/base/238593 Log: Update vendor-sys/illumos/dist to illumos-gate 13752:9f5f6c52ba19 (non-zfs part) Obtained from: ssh://anonhg@hg.illumos.org/illumos-gate Modified: vendor/illumos/dist/tools/ctf/cvt/dwarf.c Modified: vendor/illumos/dist/tools/ctf/cvt/dwarf.c ============================================================================== --- vendor/illumos/dist/tools/ctf/cvt/dwarf.c Wed Jul 18 10:58:07 2012 (r238592) +++ vendor/illumos/dist/tools/ctf/cvt/dwarf.c Wed Jul 18 10:58:30 2012 (r238593) @@ -22,6 +22,10 @@ * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2012 Jason King. All rights reserved. + * Use is subject to license terms. + */ /* * DWARF to tdata conversion @@ -360,6 +364,37 @@ die_attr_form(dwarf_t *dw, Dwarf_Attribu return (0); } +/* + * the following functions lookup the value of an attribute in a DIE: + * + * die_signed + * die_unsigned + * die_bool + * die_string + * + * They all take the same parameters (with the exception of valp which is + * a pointer to the type of the attribute we are looking up): + * + * dw - the dwarf object to look in + * die - the DIE we're interested in + * name - the name of the attribute to lookup + * valp - pointer to where the value of the attribute is placed + * req - if the value is required (0 / non-zero) + * + * If the attribute is not found, one of the following happens: + * - program terminates (req is non-zero) + * - function returns 0 + * + * If the value is found, and in a form (class) we can handle, the function + * returns 1. + * + * Currently, we can only handle attribute values that are stored as + * constants (immediate value). If an attribute has a form we cannot + * handle (for example VLAs may store the dimensions of the array + * as a DWARF expression that can compute it at runtime by reading + * values off the stack or other locations in memory), it is treated + * the same as if the attribute does not exist. + */ static int die_signed(dwarf_t *dw, Dwarf_Die die, Dwarf_Half name, Dwarf_Signed *valp, int req) @@ -371,6 +406,9 @@ die_signed(dwarf_t *dw, Dwarf_Die die, D return (0); /* die_attr will terminate for us if necessary */ if (dwarf_formsdata(attr, &val, &dw->dw_err) != DW_DLV_OK) { + if (req == 0) + return (0); + terminate("die %llu: failed to get signed (form 0x%x)\n", die_off(dw, die), die_attr_form(dw, attr)); } @@ -392,6 +430,9 @@ die_unsigned(dwarf_t *dw, Dwarf_Die die, return (0); /* die_attr will terminate for us if necessary */ if (dwarf_formudata(attr, &val, &dw->dw_err) != DW_DLV_OK) { + if (req == 0) + return (0); + terminate("die %llu: failed to get unsigned (form 0x%x)\n", die_off(dw, die), die_attr_form(dw, attr)); } @@ -412,6 +453,9 @@ die_bool(dwarf_t *dw, Dwarf_Die die, Dwa return (0); /* die_attr will terminate for us if necessary */ if (dwarf_formflag(attr, &val, &dw->dw_err) != DW_DLV_OK) { + if (req == 0) + return (0); + terminate("die %llu: failed to get bool (form 0x%x)\n", die_off(dw, die), die_attr_form(dw, attr)); } @@ -432,6 +476,9 @@ die_string(dwarf_t *dw, Dwarf_Die die, D return (0); /* die_attr will terminate for us if necessary */ if (dwarf_formstring(attr, &str, &dw->dw_err) != DW_DLV_OK) { + if (req == 0) + return (0); + terminate("die %llu: failed to get string (form 0x%x)\n", die_off(dw, die), die_attr_form(dw, attr)); } @@ -1791,6 +1838,27 @@ die_resolve(dwarf_t *dw) } while (dw->dw_nunres != 0); } +/* + * Any object containing at least one allocatable section of non-0 size is + * taken to be a file which should contain DWARF type information + */ +static boolean_t +should_have_dwarf(Elf *elf) +{ + Elf_Scn *scn = NULL; + + while ((scn = elf_nextscn(elf, scn)) != NULL) { + GElf_Shdr shdr; + gelf_getshdr(scn, &shdr); + + if ((shdr.sh_flags & SHF_ALLOC) && + (shdr.sh_size != 0)) + return (B_TRUE); + } + + return (B_FALSE); +} + /*ARGSUSED*/ int dw_read(tdata_t *td, Elf *elf, const char *filename) @@ -1814,8 +1882,12 @@ dw_read(tdata_t *td, Elf *elf, const cha if ((rc = dwarf_elf_init(elf, DW_DLC_READ, NULL, NULL, &dw.dw_dw, &dw.dw_err)) == DW_DLV_NO_ENTRY) { - errno = ENOENT; - return (-1); + if (should_have_dwarf(elf)) { + errno = ENOENT; + return (-1); + } else { + return (0); + } } else if (rc != DW_DLV_OK) { if (dwarf_errno(dw.dw_err) == DW_DLE_DEBUG_INFO_NULL) { /* @@ -1834,10 +1906,18 @@ dw_read(tdata_t *td, Elf *elf, const cha terminate("file does not contain valid DWARF data: %s\n", dwarf_errmsg(dw.dw_err)); + /* + * Some compilers emit no DWARF for empty files, others emit an empty + * compilation unit. + */ if ((cu = die_sibling(&dw, NULL)) == NULL || - (child = die_child(&dw, cu)) == NULL) + ((child = die_child(&dw, cu)) == NULL) && + should_have_dwarf(elf)) { terminate("file does not contain dwarf type data " "(try compiling with -g)\n"); + } else if (child == NULL) { + return (0); + } dw.dw_maxoff = nxthdr - 1;