Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Aug 2013 14:49:51 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r254788 - in projects/camlock: bin/sh cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/common/ctf cddl/contrib/opensolaris/lib/libctf/common cddl/contrib/opensolaris/lib/libz...
Message-ID:  <201308241449.r7OEnpoR063993@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sat Aug 24 14:49:51 2013
New Revision: 254788
URL: http://svnweb.freebsd.org/changeset/base/254788

Log:
  MFC @ r254787

Modified:
  projects/camlock/bin/sh/jobs.c
  projects/camlock/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_create.c
  projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_error.c
  projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_impl.h
  projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_open.c
  projects/camlock/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
  projects/camlock/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
  projects/camlock/contrib/llvm/tools/lldb/include/lldb/Expression/IRExecutionUnit.h
  projects/camlock/contrib/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp
  projects/camlock/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp
  projects/camlock/contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp
  projects/camlock/contrib/llvm/tools/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
  projects/camlock/contrib/llvm/tools/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
  projects/camlock/etc/network.subr
  projects/camlock/share/man/man4/sa.4
  projects/camlock/share/man/man9/pfil.9
  projects/camlock/sys/cam/cam_xpt.c
  projects/camlock/sys/cam/ctl/ctl.c
  projects/camlock/sys/cam/ctl/ctl.h
  projects/camlock/sys/cam/ctl/ctl_backend.h
  projects/camlock/sys/cam/ctl/ctl_backend_block.c
  projects/camlock/sys/cam/ctl/ctl_backend_ramdisk.c
  projects/camlock/sys/cam/ctl/ctl_frontend.h
  projects/camlock/sys/cam/ctl/ctl_io.h
  projects/camlock/sys/cam/scsi/scsi_sa.c
  projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
  projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
  projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c
  projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
  projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h
  projects/camlock/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h
  projects/camlock/sys/contrib/dev/acpica/acpica_prep.sh
  projects/camlock/sys/contrib/dev/acpica/changes.txt   (contents, props changed)
  projects/camlock/sys/contrib/dev/acpica/common/adisasm.c
  projects/camlock/sys/contrib/dev/acpica/common/adwalk.c
  projects/camlock/sys/contrib/dev/acpica/common/dmextern.c
  projects/camlock/sys/contrib/dev/acpica/common/dmtable.c
  projects/camlock/sys/contrib/dev/acpica/compiler/aslcompile.c
  projects/camlock/sys/contrib/dev/acpica/compiler/aslglobal.h
  projects/camlock/sys/contrib/dev/acpica/compiler/aslload.c
  projects/camlock/sys/contrib/dev/acpica/compiler/aslmain.c
  projects/camlock/sys/contrib/dev/acpica/compiler/asloptions.c
  projects/camlock/sys/contrib/dev/acpica/compiler/dtcompile.c
  projects/camlock/sys/contrib/dev/acpica/components/debugger/dbcmds.c
  projects/camlock/sys/contrib/dev/acpica/components/debugger/dbfileio.c
  projects/camlock/sys/contrib/dev/acpica/components/debugger/dbinput.c
  projects/camlock/sys/contrib/dev/acpica/components/debugger/dbnames.c
  projects/camlock/sys/contrib/dev/acpica/components/events/evgpeutil.c
  projects/camlock/sys/contrib/dev/acpica/components/events/evmisc.c
  projects/camlock/sys/contrib/dev/acpica/components/events/evregion.c
  projects/camlock/sys/contrib/dev/acpica/components/events/evsci.c
  projects/camlock/sys/contrib/dev/acpica/components/events/evxface.c
  projects/camlock/sys/contrib/dev/acpica/components/hardware/hwxface.c
  projects/camlock/sys/contrib/dev/acpica/components/namespace/nsaccess.c
  projects/camlock/sys/contrib/dev/acpica/components/namespace/nsdump.c
  projects/camlock/sys/contrib/dev/acpica/components/namespace/nsxfeval.c
  projects/camlock/sys/contrib/dev/acpica/components/tables/tbinstal.c
  projects/camlock/sys/contrib/dev/acpica/components/tables/tbprint.c
  projects/camlock/sys/contrib/dev/acpica/components/tables/tbxfroot.c
  projects/camlock/sys/contrib/dev/acpica/components/utilities/utdebug.c
  projects/camlock/sys/contrib/dev/acpica/components/utilities/utglobal.c
  projects/camlock/sys/contrib/dev/acpica/include/acdebug.h
  projects/camlock/sys/contrib/dev/acpica/include/acdisasm.h
  projects/camlock/sys/contrib/dev/acpica/include/acevents.h
  projects/camlock/sys/contrib/dev/acpica/include/acexcep.h
  projects/camlock/sys/contrib/dev/acpica/include/acglobal.h
  projects/camlock/sys/contrib/dev/acpica/include/aclocal.h
  projects/camlock/sys/contrib/dev/acpica/include/acnamesp.h
  projects/camlock/sys/contrib/dev/acpica/include/acpiosxf.h
  projects/camlock/sys/contrib/dev/acpica/include/acpixf.h
  projects/camlock/sys/contrib/dev/acpica/include/actypes.h
  projects/camlock/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c
  projects/camlock/sys/dev/mfi/mfi_cam.c
  projects/camlock/sys/fs/tmpfs/tmpfs_vfsops.c
  projects/camlock/sys/geom/geom_disk.c
  projects/camlock/sys/kern/kern_jail.c
  projects/camlock/sys/kern/kern_mbuf.c
  projects/camlock/sys/kern/kern_physio.c
  projects/camlock/sys/kern/uipc_mbuf.c
  projects/camlock/sys/net/pfil.c
  projects/camlock/sys/net/pfil.h
  projects/camlock/sys/netpfil/ipfw/ip_dummynet.c
  projects/camlock/sys/netpfil/ipfw/ip_fw2.c
  projects/camlock/sys/netpfil/ipfw/ip_fw_nat.c
  projects/camlock/sys/netpfil/ipfw/ip_fw_private.h
  projects/camlock/sys/sys/conf.h
  projects/camlock/sys/sys/jail.h
  projects/camlock/sys/sys/mbuf.h
  projects/camlock/sys/sys/mount.h
  projects/camlock/sys/sys/param.h
  projects/camlock/usr.sbin/jail/jail.8
Directory Properties:
  projects/camlock/   (props changed)
  projects/camlock/cddl/   (props changed)
  projects/camlock/cddl/contrib/opensolaris/   (props changed)
  projects/camlock/cddl/contrib/opensolaris/lib/libzfs/   (props changed)
  projects/camlock/contrib/llvm/   (props changed)
  projects/camlock/share/man/man4/   (props changed)
  projects/camlock/sys/   (props changed)
  projects/camlock/sys/cddl/contrib/opensolaris/   (props changed)
  projects/camlock/sys/contrib/dev/acpica/   (props changed)
  projects/camlock/sys/contrib/dev/acpica/common/   (props changed)
  projects/camlock/sys/contrib/dev/acpica/compiler/   (props changed)
  projects/camlock/sys/contrib/dev/acpica/components/debugger/   (props changed)
  projects/camlock/sys/contrib/dev/acpica/components/events/   (props changed)
  projects/camlock/sys/contrib/dev/acpica/components/hardware/   (props changed)
  projects/camlock/sys/contrib/dev/acpica/components/namespace/   (props changed)
  projects/camlock/sys/contrib/dev/acpica/components/tables/   (props changed)
  projects/camlock/sys/contrib/dev/acpica/components/utilities/   (props changed)
  projects/camlock/sys/contrib/dev/acpica/include/   (props changed)
  projects/camlock/sys/contrib/dev/acpica/os_specific/   (props changed)
  projects/camlock/usr.sbin/jail/   (props changed)

Modified: projects/camlock/bin/sh/jobs.c
==============================================================================
--- projects/camlock/bin/sh/jobs.c	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/bin/sh/jobs.c	Sat Aug 24 14:49:51 2013	(r254788)
@@ -495,14 +495,10 @@ waitcmdloop(struct job *job)
 	in_waitcmd++;
 	do {
 		if (job != NULL) {
-			if (job->state) {
+			if (job->state == JOBDONE) {
 				status = job->ps[job->nprocs - 1].status;
 				if (WIFEXITED(status))
 					retval = WEXITSTATUS(status);
-#if JOBS
-				else if (WIFSTOPPED(status))
-					retval = WSTOPSIG(status) + 128;
-#endif
 				else
 					retval = WTERMSIG(status) + 128;
 				if (! iflag || ! job->changed)

Modified: projects/camlock/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==============================================================================
--- projects/camlock/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Sat Aug 24 14:49:51 2013	(r254788)
@@ -25,6 +25,7 @@
  * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright (c) 2012 by Frederik Wessels. All rights reserved.
  * Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
+ * Copyright (c) 2013 by Prasad Joshi (sTec). All rights reserved.
  */
 
 #include <solaris.h>
@@ -2128,8 +2129,10 @@ zpool_do_import(int argc, char **argv)
 
 		errno = 0;
 		searchguid = strtoull(argv[0], &endptr, 10);
-		if (errno != 0 || *endptr != '\0')
+		if (errno != 0 || *endptr != '\0') {
 			searchname = argv[0];
+			searchguid = 0;
+		}
 		found_config = NULL;
 
 		/*

Modified: projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_create.c
==============================================================================
--- projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_create.c	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_create.c	Sat Aug 24 14:49:51 2013	(r254788)
@@ -24,13 +24,15 @@
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+ */
 
 #include <sys/sysmacros.h>
 #include <sys/param.h>
 #include <sys/mman.h>
 #include <ctf_impl.h>
+#include <sys/debug.h>
 
 /*
  * This static string is used as the template for initially populating a
@@ -167,6 +169,51 @@ ctf_copy_membnames(ctf_dtdef_t *dtd, uch
 }
 
 /*
+ * Only types of dyanmic CTF containers contain reference counts. These
+ * containers are marked RD/WR. Because of that we basically make this a no-op
+ * for compatability with non-dynamic CTF sections. This is also a no-op for
+ * types which are not dynamic types. It is the responsibility of the caller to
+ * make sure it is a valid type. We help that caller out on debug builds.
+ *
+ * Note that the reference counts are not maintained for types that are not
+ * within this container. In other words if we have a type in a parent, that
+ * will not have its reference count increased. On the flip side, the parent
+ * will not be allowed to remove dynamic types if it has children.
+ */
+static void
+ctf_ref_inc(ctf_file_t *fp, ctf_id_t tid)
+{
+	ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, tid);
+
+	if (dtd == NULL)
+		return;
+
+	if (!(fp->ctf_flags & LCTF_RDWR))
+		return;
+
+	dtd->dtd_ref++;
+}
+
+/*
+ * Just as with ctf_ref_inc, this is a no-op on non-writeable containers and the
+ * caller should ensure that this is already a valid type.
+ */
+static void
+ctf_ref_dec(ctf_file_t *fp, ctf_id_t tid)
+{
+	ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, tid);
+
+	if (dtd == NULL)
+		return;
+
+	if (!(fp->ctf_flags & LCTF_RDWR))
+		return;
+
+	ASSERT(dtd->dtd_ref >= 1);
+	dtd->dtd_ref--;
+}
+
+/*
  * If the specified CTF container is writable and has been modified, reload
  * this container with the updated type definitions.  In order to make this
  * code and the rest of libctf as simple as possible, we perform updates by
@@ -180,6 +227,10 @@ ctf_copy_membnames(ctf_dtdef_t *dtd, uch
  * ctf_bufopen() will return a new ctf_file_t, but we want to keep the fp
  * constant for the caller, so after ctf_bufopen() returns, we use bcopy to
  * swap the interior of the old and new ctf_file_t's, and then free the old.
+ *
+ * Note that the lists of dynamic types stays around and the resulting container
+ * is still writeable. Furthermore, the reference counts that are on the dtd's
+ * are still valid.
  */
 int
 ctf_update(ctf_file_t *fp)
@@ -432,6 +483,7 @@ ctf_dtd_delete(ctf_file_t *fp, ctf_dtdef
 	ctf_dtdef_t *p, **q = &fp->ctf_dthash[h];
 	ctf_dmdef_t *dmd, *nmd;
 	size_t len;
+	int kind, i;
 
 	for (p = *q; p != NULL; p = p->dtd_hash) {
 		if (p != dtd)
@@ -443,7 +495,8 @@ ctf_dtd_delete(ctf_file_t *fp, ctf_dtdef
 	if (p != NULL)
 		*q = p->dtd_hash;
 
-	switch (CTF_INFO_KIND(dtd->dtd_data.ctt_info)) {
+	kind = CTF_INFO_KIND(dtd->dtd_data.ctt_info);
+	switch (kind) {
 	case CTF_K_STRUCT:
 	case CTF_K_UNION:
 	case CTF_K_ENUM:
@@ -454,14 +507,33 @@ ctf_dtd_delete(ctf_file_t *fp, ctf_dtdef
 				ctf_free(dmd->dmd_name, len);
 				fp->ctf_dtstrlen -= len;
 			}
+			if (kind != CTF_K_ENUM)
+				ctf_ref_dec(fp, dmd->dmd_type);
 			nmd = ctf_list_next(dmd);
 			ctf_free(dmd, sizeof (ctf_dmdef_t));
 		}
 		break;
 	case CTF_K_FUNCTION:
+		ctf_ref_dec(fp, dtd->dtd_data.ctt_type);
+		for (i = 0; i < CTF_INFO_VLEN(dtd->dtd_data.ctt_info); i++)
+			if (dtd->dtd_u.dtu_argv[i] != 0)
+				ctf_ref_dec(fp, dtd->dtd_u.dtu_argv[i]);
 		ctf_free(dtd->dtd_u.dtu_argv, sizeof (ctf_id_t) *
 		    CTF_INFO_VLEN(dtd->dtd_data.ctt_info));
 		break;
+	case CTF_K_ARRAY:
+		ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_contents);
+		ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_index);
+		break;
+	case CTF_K_TYPEDEF:
+		ctf_ref_dec(fp, dtd->dtd_data.ctt_type);
+		break;
+	case CTF_K_POINTER:
+	case CTF_K_VOLATILE:
+	case CTF_K_CONST:
+	case CTF_K_RESTRICT:
+		ctf_ref_dec(fp, dtd->dtd_data.ctt_type);
+		break;
 	}
 
 	if (dtd->dtd_name) {
@@ -495,7 +567,9 @@ ctf_dtd_lookup(ctf_file_t *fp, ctf_id_t 
  * Discard all of the dynamic type definitions that have been added to the
  * container since the last call to ctf_update().  We locate such types by
  * scanning the list and deleting elements that have type IDs greater than
- * ctf_dtoldid, which is set by ctf_update(), above.
+ * ctf_dtoldid, which is set by ctf_update(), above. Note that to work properly
+ * with our reference counting schemes, we must delete the dynamic list in
+ * reverse.
  */
 int
 ctf_discard(ctf_file_t *fp)
@@ -508,11 +582,11 @@ ctf_discard(ctf_file_t *fp)
 	if (!(fp->ctf_flags & LCTF_DIRTY))
 		return (0); /* no update required */
 
-	for (dtd = ctf_list_next(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) {
+	for (dtd = ctf_list_prev(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) {
 		if (dtd->dtd_type <= fp->ctf_dtoldid)
 			continue; /* skip types that have been committed */
 
-		ntd = ctf_list_next(dtd);
+		ntd = ctf_list_prev(dtd);
 		ctf_dtd_delete(fp, dtd);
 	}
 
@@ -614,6 +688,8 @@ ctf_add_reftype(ctf_file_t *fp, uint_t f
 	if ((type = ctf_add_generic(fp, flag, NULL, &dtd)) == CTF_ERR)
 		return (CTF_ERR); /* errno is set for us */
 
+	ctf_ref_inc(fp, ref);
+
 	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(kind, flag, 0);
 	dtd->dtd_data.ctt_type = (ushort_t)ref;
 
@@ -645,16 +721,29 @@ ctf_add_array(ctf_file_t *fp, uint_t fla
 {
 	ctf_dtdef_t *dtd;
 	ctf_id_t type;
+	ctf_file_t *fpd;
 
 	if (arp == NULL)
 		return (ctf_set_errno(fp, EINVAL));
 
+	fpd = fp;
+	if (ctf_lookup_by_id(&fpd, arp->ctr_contents) == NULL &&
+	    ctf_dtd_lookup(fp, arp->ctr_contents) == NULL)
+		return (ctf_set_errno(fp, ECTF_BADID));
+
+	fpd = fp;
+	if (ctf_lookup_by_id(&fpd, arp->ctr_index) == NULL &&
+	    ctf_dtd_lookup(fp, arp->ctr_index) == NULL)
+		return (ctf_set_errno(fp, ECTF_BADID));
+
 	if ((type = ctf_add_generic(fp, flag, NULL, &dtd)) == CTF_ERR)
 		return (CTF_ERR); /* errno is set for us */
 
 	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_ARRAY, flag, 0);
 	dtd->dtd_data.ctt_size = 0;
 	dtd->dtd_u.dtu_arr = *arp;
+	ctf_ref_inc(fp, arp->ctr_contents);
+	ctf_ref_inc(fp, arp->ctr_index);
 
 	return (type);
 }
@@ -662,6 +751,7 @@ ctf_add_array(ctf_file_t *fp, uint_t fla
 int
 ctf_set_array(ctf_file_t *fp, ctf_id_t type, const ctf_arinfo_t *arp)
 {
+	ctf_file_t *fpd;
 	ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, type);
 
 	if (!(fp->ctf_flags & LCTF_RDWR))
@@ -670,8 +760,22 @@ ctf_set_array(ctf_file_t *fp, ctf_id_t t
 	if (dtd == NULL || CTF_INFO_KIND(dtd->dtd_data.ctt_info) != CTF_K_ARRAY)
 		return (ctf_set_errno(fp, ECTF_BADID));
 
+	fpd = fp;
+	if (ctf_lookup_by_id(&fpd, arp->ctr_contents) == NULL &&
+	    ctf_dtd_lookup(fp, arp->ctr_contents) == NULL)
+		return (ctf_set_errno(fp, ECTF_BADID));
+
+	fpd = fp;
+	if (ctf_lookup_by_id(&fpd, arp->ctr_index) == NULL &&
+	    ctf_dtd_lookup(fp, arp->ctr_index) == NULL)
+		return (ctf_set_errno(fp, ECTF_BADID));
+
+	ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_contents);
+	ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_index);
 	fp->ctf_flags |= LCTF_DIRTY;
 	dtd->dtd_u.dtu_arr = *arp;
+	ctf_ref_inc(fp, arp->ctr_contents);
+	ctf_ref_inc(fp, arp->ctr_index);
 
 	return (0);
 }
@@ -683,7 +787,9 @@ ctf_add_function(ctf_file_t *fp, uint_t 
 	ctf_dtdef_t *dtd;
 	ctf_id_t type;
 	uint_t vlen;
+	int i;
 	ctf_id_t *vdat = NULL;
+	ctf_file_t *fpd;
 
 	if (ctc == NULL || (ctc->ctc_flags & ~CTF_FUNC_VARARG) != 0 ||
 	    (ctc->ctc_argc != 0 && argv == NULL))
@@ -696,6 +802,18 @@ ctf_add_function(ctf_file_t *fp, uint_t 
 	if (vlen > CTF_MAX_VLEN)
 		return (ctf_set_errno(fp, EOVERFLOW));
 
+	fpd = fp;
+	if (ctf_lookup_by_id(&fpd, ctc->ctc_return) == NULL &&
+	    ctf_dtd_lookup(fp, ctc->ctc_return) == NULL)
+		return (ctf_set_errno(fp, ECTF_BADID));
+
+	for (i = 0; i < ctc->ctc_argc; i++) {
+		fpd = fp;
+		if (ctf_lookup_by_id(&fpd, argv[i]) == NULL &&
+		    ctf_dtd_lookup(fp, argv[i]) == NULL)
+			return (ctf_set_errno(fp, ECTF_BADID));
+	}
+
 	if (vlen != 0 && (vdat = ctf_alloc(sizeof (ctf_id_t) * vlen)) == NULL)
 		return (ctf_set_errno(fp, EAGAIN));
 
@@ -707,6 +825,10 @@ ctf_add_function(ctf_file_t *fp, uint_t 
 	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_FUNCTION, flag, vlen);
 	dtd->dtd_data.ctt_type = (ushort_t)ctc->ctc_return;
 
+	ctf_ref_inc(fp, ctc->ctc_return);
+	for (i = 0; i < ctc->ctc_argc; i++)
+		ctf_ref_inc(fp, argv[i]);
+
 	bcopy(argv, vdat, sizeof (ctf_id_t) * ctc->ctc_argc);
 	if (ctc->ctc_flags & CTF_FUNC_VARARG)
 		vdat[vlen - 1] = 0; /* add trailing zero to indicate varargs */
@@ -825,8 +947,11 @@ ctf_add_typedef(ctf_file_t *fp, uint_t f
 {
 	ctf_dtdef_t *dtd;
 	ctf_id_t type;
+	ctf_file_t *fpd;
 
-	if (ref == CTF_ERR || ref < 0 || ref > CTF_MAX_TYPE)
+	fpd = fp;
+	if (ref == CTF_ERR || (ctf_lookup_by_id(&fpd, ref) == NULL &&
+	    ctf_dtd_lookup(fp, ref) == NULL))
 		return (ctf_set_errno(fp, EINVAL));
 
 	if ((type = ctf_add_generic(fp, flag, name, &dtd)) == CTF_ERR)
@@ -834,6 +959,7 @@ ctf_add_typedef(ctf_file_t *fp, uint_t f
 
 	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_TYPEDEF, flag, 0);
 	dtd->dtd_data.ctt_type = (ushort_t)ref;
+	ctf_ref_inc(fp, ref);
 
 	return (type);
 }
@@ -1008,6 +1134,45 @@ ctf_add_member(ctf_file_t *fp, ctf_id_t 
 	if (s != NULL)
 		fp->ctf_dtstrlen += strlen(s) + 1;
 
+	ctf_ref_inc(fp, type);
+	fp->ctf_flags |= LCTF_DIRTY;
+	return (0);
+}
+
+/*
+ * This removes a type from the dynamic section. This will fail if the type is
+ * referenced by another type. Note that the CTF ID is never reused currently by
+ * CTF. Note that if this container is a parent container then we just outright
+ * refuse to remove the type. There currently is no notion of searching for the
+ * ctf_dtdef_t in parent containers. If there is, then this constraint could
+ * become finer grained.
+ */
+int
+ctf_delete_type(ctf_file_t *fp, ctf_id_t type)
+{
+	ctf_file_t *fpd;
+	ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, type);
+
+	if (!(fp->ctf_flags & LCTF_RDWR))
+		return (ctf_set_errno(fp, ECTF_RDONLY));
+
+	/*
+	 * We want to give as useful an errno as possible. That means that we
+	 * want to distinguish between a type which does not exist and one for
+	 * which the type is not dynamic.
+	 */
+	fpd = fp;
+	if (ctf_lookup_by_id(&fpd, type) == NULL &&
+	    ctf_dtd_lookup(fp, type) == NULL)
+		return (CTF_ERR); /* errno is set for us */
+
+	if (dtd == NULL)
+		return (ctf_set_errno(fp, ECTF_NOTDYN));
+
+	if (dtd->dtd_ref != 0 || fp->ctf_refcnt > 1)
+		return (ctf_set_errno(fp, ECTF_REFERENCED));
+
+	ctf_dtd_delete(fp, dtd);
 	fp->ctf_flags |= LCTF_DIRTY;
 	return (0);
 }
@@ -1103,6 +1268,9 @@ ctf_add_type(ctf_file_t *dst_fp, ctf_fil
 	ctf_hash_t *hp;
 	ctf_helem_t *hep;
 
+	if (dst_fp == src_fp)
+		return (src_type);
+
 	if (!(dst_fp->ctf_flags & LCTF_RDWR))
 		return (ctf_set_errno(dst_fp, ECTF_RDONLY));
 
@@ -1313,6 +1481,14 @@ ctf_add_type(ctf_file_t *dst_fp, ctf_fil
 
 		if (errs)
 			return (CTF_ERR); /* errno is set for us */
+
+		/*
+		 * Now that we know that we can't fail, we go through and bump
+		 * all the reference counts on the member types.
+		 */
+		for (dmd = ctf_list_next(&dtd->dtd_u.dtu_members);
+		    dmd != NULL; dmd = ctf_list_next(dmd))
+			ctf_ref_inc(dst_fp, dmd->dmd_type);
 		break;
 	}
 

Modified: projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_error.c
==============================================================================
--- projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_error.c	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_error.c	Sat Aug 24 14:49:51 2013	(r254788)
@@ -23,8 +23,9 @@
  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2012, Joyent, Inc.
+ */
 
 #include <ctf_impl.h>
 
@@ -73,6 +74,8 @@ static const char *const _ctf_errlist[] 
 	"Limit on number of dynamic types reached",	 /* ECTF_FULL */
 	"Duplicate member name definition",		 /* ECTF_DUPMEMBER */
 	"Conflicting type is already defined",		 /* ECTF_CONFLICT */
+	"Type has outstanding references",		 /* ECTF_REFERENCED */
+	"Type is not a dynamic type"			 /* ECTF_NOTDYN */
 };
 
 static const int _ctf_nerr = sizeof (_ctf_errlist) / sizeof (_ctf_errlist[0]);

Modified: projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_impl.h
==============================================================================
--- projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_impl.h	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_impl.h	Sat Aug 24 14:49:51 2013	(r254788)
@@ -24,12 +24,13 @@
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
+/*
+ * Copyright (c) 2012, Joyent, Inc.  All rights reserved.
+ */
 
 #ifndef	_CTF_IMPL_H
 #define	_CTF_IMPL_H
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
 #include <sys/errno.h>
 #include <sys/sysmacros.h>
@@ -149,6 +150,7 @@ typedef struct ctf_dtdef {
 	char *dtd_name;		/* name associated with definition (if any) */
 	ctf_id_t dtd_type;	/* type identifier for this definition */
 	ctf_type_t dtd_data;	/* type node (see <sys/ctf.h>) */
+	int dtd_ref;		/* recfount for dyanmic types */
 	union {
 		ctf_list_t dtu_members;	/* struct, union, or enum */
 		ctf_arinfo_t dtu_arr;	/* array */
@@ -269,7 +271,9 @@ enum {
 	ECTF_DTFULL,		/* CTF type is full (no more members allowed) */
 	ECTF_FULL,		/* CTF container is full */
 	ECTF_DUPMEMBER,		/* duplicate member name definition */
-	ECTF_CONFLICT		/* conflicting type definition present */
+	ECTF_CONFLICT,		/* conflicting type definition present */
+	ECTF_REFERENCED,	/* type has outstanding references */
+	ECTF_NOTDYN		/* type is not a dynamic type */
 };
 
 extern ssize_t ctf_get_ctt_size(const ctf_file_t *, const ctf_type_t *,

Modified: projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_open.c
==============================================================================
--- projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_open.c	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/cddl/contrib/opensolaris/common/ctf/ctf_open.c	Sat Aug 24 14:49:51 2013	(r254788)
@@ -24,8 +24,9 @@
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2012, Joyent, Inc.  All rights reserved.
+ */
 
 #include <ctf_impl.h>
 #include <sys/mman.h>
@@ -810,8 +811,12 @@ ctf_close(ctf_file_t *fp)
 	if (fp->ctf_parent != NULL)
 		ctf_close(fp->ctf_parent);
 
-	for (dtd = ctf_list_next(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) {
-		ntd = ctf_list_next(dtd);
+	/*
+	 * Note, to work properly with reference counting on the dynamic
+	 * section, we must delete the list in reverse.
+	 */
+	for (dtd = ctf_list_prev(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) {
+		ntd = ctf_list_prev(dtd);
 		ctf_dtd_delete(fp, dtd);
 	}
 

Modified: projects/camlock/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
==============================================================================
--- projects/camlock/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c	Sat Aug 24 14:49:51 2013	(r254788)
@@ -216,6 +216,7 @@ ctf_fdopen(int fd, int *errp)
 {
 	ctf_sect_t ctfsect, symsect, strsect;
 	ctf_file_t *fp = NULL;
+	size_t shstrndx, shnum;
 
 	struct stat64 st;
 	ssize_t nbytes;
@@ -278,11 +279,10 @@ ctf_fdopen(int fd, int *errp)
 #else
 		uchar_t order = ELFDATA2LSB;
 #endif
-		GElf_Half i, n;
 		GElf_Shdr *sp;
 
 		void *strs_map;
-		size_t strs_mapsz;
+		size_t strs_mapsz, i;
 		char *strs;
 
 		if (hdr.e32.e_ident[EI_DATA] != order)
@@ -298,11 +298,38 @@ ctf_fdopen(int fd, int *errp)
 			ehdr_to_gelf(&e32, &hdr.e64);
 		}
 
-		if (hdr.e64.e_shstrndx >= hdr.e64.e_shnum)
+		shnum = hdr.e64.e_shnum;
+		shstrndx = hdr.e64.e_shstrndx;
+
+		/* Extended ELF sections */
+		if ((shstrndx == SHN_XINDEX) || (shnum == 0)) {
+			if (hdr.e32.e_ident[EI_CLASS] == ELFCLASS32) {
+				Elf32_Shdr x32;
+
+				if (pread64(fd, &x32, sizeof (x32),
+				    hdr.e64.e_shoff) != sizeof (x32))
+					return (ctf_set_open_errno(errp,
+					    errno));
+
+				shnum = x32.sh_size;
+				shstrndx = x32.sh_link;
+			} else {
+				Elf64_Shdr x64;
+
+				if (pread64(fd, &x64, sizeof (x64),
+				    hdr.e64.e_shoff) != sizeof (x64))
+					return (ctf_set_open_errno(errp,
+					    errno));
+
+				shnum = x64.sh_size;
+				shstrndx = x64.sh_link;
+			}
+		}
+
+		if (shstrndx >= shnum)
 			return (ctf_set_open_errno(errp, ECTF_CORRUPT));
 
-		n = hdr.e64.e_shnum;
-		nbytes = sizeof (GElf_Shdr) * n;
+		nbytes = sizeof (GElf_Shdr) * shnum;
 
 		if ((sp = malloc(nbytes)) == NULL)
 			return (ctf_set_open_errno(errp, errno));
@@ -314,7 +341,7 @@ ctf_fdopen(int fd, int *errp)
 		if (hdr.e32.e_ident[EI_CLASS] == ELFCLASS32) {
 			Elf32_Shdr *sp32;
 
-			nbytes = sizeof (Elf32_Shdr) * n;
+			nbytes = sizeof (Elf32_Shdr) * shnum;
 
 			if ((sp32 = malloc(nbytes)) == NULL || pread64(fd,
 			    sp32, nbytes, hdr.e64.e_shoff) != nbytes) {
@@ -322,7 +349,7 @@ ctf_fdopen(int fd, int *errp)
 				return (ctf_set_open_errno(errp, errno));
 			}
 
-			for (i = 0; i < n; i++)
+			for (i = 0; i < shnum; i++)
 				shdr_to_gelf(&sp32[i], &sp[i]);
 
 			free(sp32);
@@ -336,14 +363,14 @@ ctf_fdopen(int fd, int *errp)
 		 * Now mmap the section header strings section so that we can
 		 * perform string comparison on the section names.
 		 */
-		strs_mapsz = sp[hdr.e64.e_shstrndx].sh_size +
-		    (sp[hdr.e64.e_shstrndx].sh_offset & ~_PAGEMASK);
+		strs_mapsz = sp[shstrndx].sh_size +
+		    (sp[shstrndx].sh_offset & ~_PAGEMASK);
 
 		strs_map = mmap64(NULL, strs_mapsz, PROT_READ, MAP_PRIVATE,
-		    fd, sp[hdr.e64.e_shstrndx].sh_offset & _PAGEMASK);
+		    fd, sp[shstrndx].sh_offset & _PAGEMASK);
 
 		strs = (char *)strs_map +
-		    (sp[hdr.e64.e_shstrndx].sh_offset & ~_PAGEMASK);
+		    (sp[shstrndx].sh_offset & ~_PAGEMASK);
 
 		if (strs_map == MAP_FAILED) {
 			free(sp);
@@ -354,15 +381,15 @@ ctf_fdopen(int fd, int *errp)
 		 * Iterate over the section header array looking for the CTF
 		 * section and symbol table.  The strtab is linked to symtab.
 		 */
-		for (i = 0; i < n; i++) {
+		for (i = 0; i < shnum; i++) {
 			const GElf_Shdr *shp = &sp[i];
 			const GElf_Shdr *lhp = &sp[shp->sh_link];
 
-			if (shp->sh_link >= hdr.e64.e_shnum)
+			if (shp->sh_link >= shnum)
 				continue; /* corrupt sh_link field */
 
-			if (shp->sh_name >= sp[hdr.e64.e_shstrndx].sh_size ||
-			    lhp->sh_name >= sp[hdr.e64.e_shstrndx].sh_size)
+			if (shp->sh_name >= sp[shstrndx].sh_size ||
+			    lhp->sh_name >= sp[shstrndx].sh_size)
 				continue; /* corrupt sh_name field */
 
 			if (shp->sh_type == SHT_PROGBITS &&

Modified: projects/camlock/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
==============================================================================
--- projects/camlock/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c	Sat Aug 24 14:49:51 2013	(r254788)
@@ -21,10 +21,10 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
  * All rights reserved.
+ * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #include <stdio.h>
@@ -452,8 +452,12 @@ iter_dependents_cb(zfs_handle_t *zhp, vo
 		}
 		ida->stack = isf.next;
 	}
+
 	if (!first && err == 0)
 		err = ida->func(zhp, ida->data);
+	else
+		zfs_close(zhp);
+
 	return (err);
 }
 

Modified: projects/camlock/contrib/llvm/tools/lldb/include/lldb/Expression/IRExecutionUnit.h
==============================================================================
--- projects/camlock/contrib/llvm/tools/lldb/include/lldb/Expression/IRExecutionUnit.h	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/contrib/llvm/tools/lldb/include/lldb/Expression/IRExecutionUnit.h	Sat Aug 24 14:49:51 2013	(r254788)
@@ -336,13 +336,7 @@ private:
         /// @return
         ///     True in case of failure, false in case of success.
         //------------------------------------------------------------------
-        virtual bool finalizeMemory(std::string *ErrMsg) {
-            // TODO: Ensure that the instruction cache is flushed because
-            // relocations are updated by dy-load.  See:
-            //   sys::Memory::InvalidateInstructionCache
-            //   llvm::SectionMemoryManager
-            return false;
-        }
+        bool applyPermissions(std::string *ErrMsg) { return false; }
         
         //------------------------------------------------------------------
         /// Passthrough interface stub
@@ -352,6 +346,38 @@ private:
         //------------------------------------------------------------------
         /// Passthrough interface stub
         //------------------------------------------------------------------
+        virtual uint8_t* startExceptionTable(const llvm::Function* F,
+                                             uintptr_t &ActualSize);
+        
+        //------------------------------------------------------------------
+        /// Complete the exception table for a function, and add it to the
+        /// m_exception_tables map
+        ///
+        /// @param[in] F
+        ///     The function whose exception table is being written.
+        ///
+        /// @param[in] TableStart
+        ///     The first byte of the exception table.
+        ///
+        /// @param[in] TableEnd
+        ///     The last byte of the exception table.
+        ///
+        /// @param[in] FrameRegister
+        ///     I don't know what this does, but it's passed through.
+        //------------------------------------------------------------------
+        virtual void endExceptionTable(const llvm::Function *F,
+                                       uint8_t *TableStart,
+                                       uint8_t *TableEnd,
+                                       uint8_t* FrameRegister);
+        
+        //------------------------------------------------------------------
+        /// Passthrough interface stub
+        //------------------------------------------------------------------
+        virtual void deallocateExceptionTable(void *ET);
+        
+        //------------------------------------------------------------------
+        /// Passthrough interface stub
+        //------------------------------------------------------------------
         virtual size_t GetDefaultCodeSlabSize() {
             return m_default_mm_ap->GetDefaultCodeSlabSize();
         }

Modified: projects/camlock/contrib/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp
==============================================================================
--- projects/camlock/contrib/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/contrib/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp	Sat Aug 24 14:49:51 2013	(r254788)
@@ -52,7 +52,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/PathV1.h"
 #include "llvm/Support/TargetSelect.h"
 
 #if defined(__FreeBSD__)
@@ -81,16 +81,19 @@ using namespace lldb_private;
 //===----------------------------------------------------------------------===//
 
 std::string GetBuiltinIncludePath(const char *Argv0) {
-    SmallString<128> P(llvm::sys::fs::getMainExecutable(
-        Argv0, (void *)(intptr_t) GetBuiltinIncludePath));
-
-    if (!P.empty()) {
-        llvm::sys::path::remove_filename(P); // Remove /clang from foo/bin/clang
-        llvm::sys::path::remove_filename(P); // Remove /bin   from foo/bin
-
+    llvm::sys::Path P =
+    llvm::sys::Path::GetMainExecutable(Argv0,
+                                       (void*)(intptr_t) GetBuiltinIncludePath);
+    
+    if (!P.isEmpty()) {
+        P.eraseComponent();  // Remove /clang from foo/bin/clang
+        P.eraseComponent();  // Remove /bin   from foo/bin
+        
         // Get foo/lib/clang/<version>/include
-        llvm::sys::path::append(P, "lib", "clang", CLANG_VERSION_STRING,
-                                "include");
+        P.appendComponent("lib");
+        P.appendComponent("clang");
+        P.appendComponent(CLANG_VERSION_STRING);
+        P.appendComponent("include");
     }
     
     return P.str();

Modified: projects/camlock/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp
==============================================================================
--- projects/camlock/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp	Sat Aug 24 14:49:51 2013	(r254788)
@@ -563,6 +563,28 @@ IRExecutionUnit::MemoryManager::dealloca
     m_default_mm_ap->deallocateFunctionBody(Body);
 }
 
+uint8_t*
+IRExecutionUnit::MemoryManager::startExceptionTable(const llvm::Function* F,
+                                                    uintptr_t &ActualSize)
+{
+    return m_default_mm_ap->startExceptionTable(F, ActualSize);
+}
+
+void
+IRExecutionUnit::MemoryManager::endExceptionTable(const llvm::Function *F,
+                                                  uint8_t *TableStart,
+                                                  uint8_t *TableEnd,
+                                                  uint8_t* FrameRegister)
+{
+    m_default_mm_ap->endExceptionTable(F, TableStart, TableEnd, FrameRegister);
+}
+
+void
+IRExecutionUnit::MemoryManager::deallocateExceptionTable(void *ET)
+{
+    m_default_mm_ap->deallocateExceptionTable (ET);
+}
+
 lldb::addr_t
 IRExecutionUnit::GetRemoteAddressForLocal (lldb::addr_t local_address)
 {

Modified: projects/camlock/contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp
==============================================================================
--- projects/camlock/contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp	Sat Aug 24 14:49:51 2013	(r254788)
@@ -553,8 +553,9 @@ FileSpec::ResolveExecutableLocation ()
         if (file_cstr)
         {
             const std::string file_str (file_cstr);
-            std::string path = llvm::sys::FindProgramByName (file_str);
-            llvm::StringRef dir_ref = llvm::sys::path::parent_path(path);
+            llvm::sys::Path path = llvm::sys::Program::FindProgramByName (file_str);
+            const std::string &path_str = path.str();
+            llvm::StringRef dir_ref = llvm::sys::path::parent_path(path_str);
             //llvm::StringRef dir_ref = path.getDirname();
             if (! dir_ref.empty())
             {

Modified: projects/camlock/contrib/llvm/tools/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
==============================================================================
--- projects/camlock/contrib/llvm/tools/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/contrib/llvm/tools/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp	Sat Aug 24 14:49:51 2013	(r254788)
@@ -10,7 +10,6 @@
 #include "DisassemblerLLVMC.h"
 
 #include "llvm-c/Disassembler.h"
-#include "llvm/ADT/OwningPtr.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCDisassembler.h"
@@ -18,7 +17,6 @@
 #include "llvm/MC/MCInstPrinter.h"
 #include "llvm/MC/MCInstrInfo.h"
 #include "llvm/MC/MCRegisterInfo.h"
-#include "llvm/MC/MCRelocationInfo.h"
 #include "llvm/MC/MCSubtargetInfo.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MemoryObject.h"
@@ -442,30 +440,23 @@ DisassemblerLLVMC::LLVMCDisassembler::LL
     m_subtarget_info_ap.reset(curr_target->createMCSubtargetInfo(triple, "",
                                                                 features_str));
     
-    m_asm_info_ap.reset(curr_target->createMCAsmInfo(*curr_target->createMCRegInfo(triple), triple));
-
+    m_asm_info_ap.reset(curr_target->createMCAsmInfo(triple));
+    
     if (m_instr_info_ap.get() == NULL || m_reg_info_ap.get() == NULL || m_subtarget_info_ap.get() == NULL || m_asm_info_ap.get() == NULL)
     {
         m_is_valid = false;
         return;
     }
     
-    m_context_ap.reset(new llvm::MCContext(m_asm_info_ap.get(), m_reg_info_ap.get(), 0));
+    m_context_ap.reset(new llvm::MCContext(*m_asm_info_ap.get(), *(m_reg_info_ap.get()), 0));
     
     m_disasm_ap.reset(curr_target->createMCDisassembler(*m_subtarget_info_ap.get()));
-    if (m_disasm_ap.get() && m_context_ap.get())
+    if (m_disasm_ap.get())
     {
-        llvm::OwningPtr<llvm::MCRelocationInfo> RelInfo(curr_target->createMCRelocationInfo(triple, *m_context_ap.get()));
-        if (!RelInfo)
-        {
-            m_is_valid = false;
-            return;
-        }
         m_disasm_ap->setupForSymbolicDisassembly(NULL,
-                                                 DisassemblerLLVMC::SymbolLookupCallback,
-                                                 (void *) &owner,
-                                                 m_context_ap.get(),
-                                                 RelInfo);
+                                                  DisassemblerLLVMC::SymbolLookupCallback,
+                                                  (void *) &owner,
+                                                  m_context_ap.get());
         
         unsigned asm_printer_variant;
         if (flavor == ~0U)

Modified: projects/camlock/contrib/llvm/tools/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
==============================================================================
--- projects/camlock/contrib/llvm/tools/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/contrib/llvm/tools/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp	Sat Aug 24 14:49:51 2013	(r254788)
@@ -25,7 +25,7 @@
 #include "Utility/ARM_DWARF_Registers.h"
 
 #include "llvm/Support/MathExtras.h" // for SignExtend32 template function
-                                     // and countTrailingZeros function
+                                     // and CountTrailingZeros_32 function
 
 using namespace lldb;
 using namespace lldb_private;
@@ -47,7 +47,7 @@ using namespace lldb_private;
 static uint32_t
 CountITSize (uint32_t ITMask) {
     // First count the trailing zeros of the IT mask.
-    uint32_t TZ = llvm::countTrailingZeros(ITMask);
+    uint32_t TZ = llvm::CountTrailingZeros_32(ITMask);
     if (TZ > 3)
     {
 #ifdef LLDB_CONFIGURATION_DEBUG

Modified: projects/camlock/etc/network.subr
==============================================================================
--- projects/camlock/etc/network.subr	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/etc/network.subr	Sat Aug 24 14:49:51 2013	(r254788)
@@ -661,9 +661,9 @@ ipv4_down()
 	for _inet in $inetList ; do
 		# get rid of extraneous line
 		case $_inet in
-		"")		break ;;
-		inet\ *)	;;
-		*)		continue ;;
+		"")				break ;;
+		\	inet\ *|inet\ *)	;;
+		*)				continue ;;
 		esac
 		[ -z "$_inet" ] && break
 

Modified: projects/camlock/share/man/man4/sa.4
==============================================================================
--- projects/camlock/share/man/man4/sa.4	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/share/man/man4/sa.4	Sat Aug 24 14:49:51 2013	(r254788)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 6, 1999
+.Dd August 23, 2013
 .Dt SA 4
 .Os
 .Sh NAME
@@ -159,6 +159,70 @@ of 0.
 (As above, if the file mark is never read, it remains for the next
 process to read if in no-rewind mode.)
 .El
+.Sh BLOCK SIZES
+By default, the driver will NOT accept reads or writes to a tape device that
+are larger than may be written to or read from the mounted tape using a single
+write or read request.
+Because of this, the application author may have confidence that his wishes
+are respected in terms of the block size written to tape.
+For example, if the user tries to write a 256KB block to the tape, but the
+controller can handle no more than 128KB, the write will fail.
+The previous
+.Fx
+behavior, prior to
+.Fx
+10.0,
+was to break up large reads or writes into smaller blocks when going to the
+tape.
+The problem with that behavior, though, is that it hides the actual on-tape
+block size from the application writer, at least in variable block mode.
+.Pp
+If the user would like his large reads and writes broken up into separate
+pieces, he may set the following loader tunables.
+Note that these tunables WILL GO AWAY in
+.Fx 11.0 .
+They are provided for transition purposes only.
+.Bl -tag -width 12
+.It kern.cam.sa.allow_io_split
+.Pp
+This variable, when set to 1, will configure all
+.Nm
+devices to split large buffers into smaller pieces when needed.
+.It kern.cam.sa.%d.allow_io_split
+.Pp
+This variable, when set to 1, will configure the given
+.Nm
+unit to split large buffers into multiple pieces.
+This will override the global setting, if it exists.
+.El
+.Pp
+There are several
+.Xr sysctl 8
+variables available to view block handling parameters:
+.Bl -tag -width 12
+.It kern.cam.sa.%d.allow_io_split
+.Pp
+This variable allows the user to see, but not modify, the current I/O split
+setting.
+The user is not permitted to modify this setting so that there is no chance
+of behavior changing for the application while a tape is mounted.
+.It kern.cam.sa.%d.maxio
+.Pp
+This variable shows the maximum I/O size in bytes that is allowed by the
+combination of kernel tuning parameters (MAXPHYS, DFLTPHYS) and the
+capabilities of the controller that is attached to the tape drive.
+Applications may look at this value for a guide on how large an I/O may be
+permitted, but should keep in mind that the actual maximum may be
+restricted further by the tape drive via the
+.Tn SCSI
+READ BLOCK LIMITS command.
+.It kern.cam.sa.%d.cpi_maxio
+.Pp
+This variable shows the maximum I/O size supported by the controller, in
+bytes, that is reported via the CAM Path Inquiry CCB (XPT_PATH_INQ).
+If this is 0, that means that the controller has not reported a maximum I/O
+size.
+.El
 .Sh FILE MARK HANDLING
 The handling of file marks on write is automatic.
 If the user has

Modified: projects/camlock/share/man/man9/pfil.9
==============================================================================
--- projects/camlock/share/man/man9/pfil.9	Sat Aug 24 14:41:49 2013	(r254787)
+++ projects/camlock/share/man/man9/pfil.9	Sat Aug 24 14:49:51 2013	(r254788)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 22, 2012
+.Dd August 23, 2013
 .Dt PFIL 9
 .Os
 .Sh NAME
@@ -36,7 +36,6 @@
 .Nm pfil_head_register ,
 .Nm pfil_head_unregister ,
 .Nm pfil_head_get ,
-.Nm pfil_hook_get ,
 .Nm pfil_add_hook ,
 .Nm pfil_remove_hook ,
 .Nm pfil_run_hooks ,
@@ -50,20 +49,18 @@
 .In sys/mbuf.h
 .In net/if.h
 .In net/pfil.h
+.Bd -literal
+typedef int (*pfil_func_t)(void *arg, struct mbuf **mp, struct ifnet *, int dir, struct inpcb);
 .Ft int
 .Fn pfil_head_register "struct pfil_head *head"
 .Ft int
 .Fn pfil_head_unregister "struct pfil_head *head"
 .Ft "struct pfil_head *"
 .Fn pfil_head_get "int af" "u_long dlt"
-.Ft "struct packet_filter_hook *"
-.Fn pfil_hook_get "int dir" "struct pfil_head *head"
 .Ft void
-.Fn pfil_add_hook "int (*func)()" "void *arg" "int flags" "struct pfil_head *"
+.Fn pfil_add_hook "pfil_func_t" "void *arg" "int flags" "struct pfil_head *"
 .Ft void
-.Fn pfil_remove_hook "int (*func)()" "void *arg" "int flags" "struct pfil_head *"
-.Ft int
-.Fn (*func) "void *arg" "struct mbuf **mp" "struct ifnet *" "int dir" "struct inpcb *"
+.Fn pfil_remove_hook "pfil_func_t" "void *arg" "int flags" "struct pfil_head *"
 .Ft int
 .Fn pfil_run_hooks "struct pfil_head *head" "struct mbuf **mp" "struct ifnet *" "int dir" "struct inpcb *"
 .Ft void
@@ -245,11 +242,7 @@ lock export was added in
 .Fx 10.0 .

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308241449.r7OEnpoR063993>