CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2012-01-10 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Tue Jan 10 08:42:22 UTC 2012

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctf.c dwarf.c

Log Message:
Fix a segfault in ctfmerge.

GCC can generate bogus dwarf attributes with DW_AT_byte_size set to 0x.
See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35998 .

GCC is currently doing this for external/bsd/tmux/dist/compat/imsg-buffer.c:
readelf -a --debug-dump imsg-buffer.o
...
 26e3: Abbrev Number: 32 (DW_TAG_union_type)
6e4   DW_AT_byte_size   : 0x
6e8   DW_AT_decl_file   : 1
6e9   DW_AT_decl_line   : 229
6ea   DW_AT_sibling : 0x705

This resulted in ctfconvert generating a faulty CTF entry which then caused the
segfault in ctfmerge.

The fix has ctfconvert check for the bogus 0x value and works around it.
It also adds some protection to ctfmerge to avoid the segfault and fail
more gracefully if the error should occur in the future.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.6
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.5	Thu Mar 11 23:26:33 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c	Tue Jan 10 08:42:22 2012
@@ -53,6 +53,10 @@
  */
 char *curfile;
 
+
+/* The number of types. */
+static int ntypes=0;
+
 #define	CTF_BUF_CHUNK_SIZE	(64 * 1024)
 #define	RES_BUF_CHUNK_SIZE	(64 * 1024)
 
@@ -1048,6 +1052,9 @@ resurrect_types(ctf_header_t *h, tdata_t
 	(*mpp)-ml_type = tdarr[ctm-ctm_type];
 	(*mpp)-ml_offset = ctm-ctm_offset;
 	(*mpp)-ml_size = 0;
+	if (ctm-ctm_type  ntypes) {
+	parseterminate(Invalid member type ctm_type=%d, ctm-ctm_type);
+	}
 }
 			} else {
 for (i = 0, mpp = tdp-t_members; i  vlen;
@@ -1064,6 +1071,9 @@ resurrect_types(ctf_header_t *h, tdata_t
 	(*mpp)-ml_offset =
 	(int)CTF_LMEM_OFFSET(ctlm);
 	(*mpp)-ml_size = 0;
+	if (ctlm-ctlm_type  ntypes) {
+	parseterminate(Invalid lmember type ctlm_type=%d, ctlm-ctlm_type);
+	}
 }
 			}
 
@@ -1177,9 +1187,10 @@ ctf_parse(ctf_header_t *h, caddr_t buf, 
 {
 	tdata_t *td = tdata_new();
 	tdesc_t **tdarr;
-	int ntypes = count_types(h, buf);
 	int idx, i;
 
+	ntypes = count_types(h, buf);
+
 	/* shudder */
 	tdarr = xcalloc(sizeof (tdesc_t *) * (ntypes + 1));
 	tdarr[0] = NULL;

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.4 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.5
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.4	Wed Feb 24 21:53:26 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Tue Jan 10 08:42:22 2012
@@ -678,6 +678,12 @@ die_array_create(dwarf_t *dw, Dwarf_Die 
 		tdesc_t *dimtdp;
 		int flags;
 
+		/* Check for bogus gcc DW_AT_byte_size attribute */
+		if (uval == 0x) {
+		printf(dwarf.c:%s() working around bogus DW_AT_byte_size = 0x\n, __func__);
+		uval = 0;
+		}
+
 		tdp-t_size = uval;
 
 		/*
@@ -764,6 +770,11 @@ die_enum_create(dwarf_t *dw, Dwarf_Die d
 	tdp-t_type = ENUM;
 
 	(void) die_unsigned(dw, die, DW_AT_byte_size, uval, DW_ATTR_REQ);
+	/* Check for bogus gcc DW_AT_byte_size attribute */
+	if (uval == 0x) {
+	printf(dwarf.c:%s() working around bogus DW_AT_byte_size = 0x\n, __func__);
+	uval = 0;
+	}
 	tdp-t_size = uval;
 
 	if ((mem = die_child(dw, die)) != NULL) {
@@ -877,7 +888,7 @@ static void
 die_sou_create(dwarf_t *dw, Dwarf_Die str, Dwarf_Off off, tdesc_t *tdp,
 int type, const char *typename)
 {
-	Dwarf_Unsigned sz, bitsz, bitoff;
+	Dwarf_Unsigned sz, bitsz, bitoff, maxsz=0;
 	Dwarf_Die mem;
 	mlist_t *ml, **mlastp;
 	iidesc_t *ii;
@@ -933,6 +944,8 @@ die_sou_create(dwarf_t *dw, Dwarf_Die st
 			ml-ml_name = NULL;
 
 		ml-ml_type = die_lookup_pass1(dw, mem, DW_AT_type);
+		debug(3, die_sou_create(): ml_type = %p t_id = %d\n, ml-ml_type,
+			ml-ml_type-t_id);
 
 		if (die_mem_offset(dw, mem, DW_AT_data_member_location,
 		mloff, 0)) {
@@ -960,8 +973,21 @@ die_sou_create(dwarf_t *dw, Dwarf_Die st
 
 		*mlastp = ml;
 		mlastp = ml-ml_next;
+
+		/* work out the size of the largest member to work around a gcc bug */
+		if (maxsz  ml-ml_size) {
+		maxsz = ml-ml_size;
+		}
 	} while ((mem = die_sibling(dw, mem)) != NULL);
 
+	/* See if we got a bogus DW_AT_byte_size.  GCC will sometimes
+	 * emit this.
+	 */
+	if (sz == 0x) {
+	printf(dwarf.c:%s() working around bogus DW_AT_byte_size = 0x\n, __func__);
+	tdp-t_size = maxsz / 8;	/* maxsz is in 

CVS commit: src/external/cddl/osnet/dev/fbt

2010-05-03 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Mon May  3 09:28:38 UTC 2010

Modified Files:
src/external/cddl/osnet/dev/fbt: fbt.c

Log Message:
DTrace: print a warning no CTF section is found when processing arguments.
This should help diagnose problems such as netbsd images without CTF
sections and old boot loaders.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dev/fbt/fbt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dev/fbt/fbt.c
diff -u src/external/cddl/osnet/dev/fbt/fbt.c:1.5 src/external/cddl/osnet/dev/fbt/fbt.c:1.6
--- src/external/cddl/osnet/dev/fbt/fbt.c:1.5	Sat Mar 13 22:31:15 2010
+++ src/external/cddl/osnet/dev/fbt/fbt.c	Mon May  3 09:28:38 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fbt.c,v 1.5 2010/03/13 22:31:15 christos Exp $	*/
+/*	$NetBSD: fbt.c,v 1.6 2010/05/03 09:28:38 darran Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -1399,6 +1399,12 @@
 
 	/* Get a pointer to the CTF data and it's length. */
 	if (mod_ctf_get(ctl, mc) != 0) {
+		static int report=0;
+		if (report  1) {
+		report++;
+		printf(FBT: Error no CTF section found in module \%s\\n,
+			ctl-mod_info-mi_name);
+		}
 		/* No CTF data? Something wrong? *shrug* */
 		return;
 	}



CVS commit: src/sys/kern

2010-05-03 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Mon May  3 09:51:36 UTC 2010

Modified Files:
src/sys/kern: kern_ctf.c kern_ksyms.c

Log Message:
DTrace: Fix several bugs where the mod_ctf_get() function could return
success even though no CTF section was present in the kernel or module.
This fixes the panic that several people saw when trying out the FBT
provider without updating /boot or missing a CTF section in /netbsd.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/kern/kern_ctf.c
cvs rdiff -u -r1.58 -r1.59 src/sys/kern/kern_ksyms.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_ctf.c
diff -u src/sys/kern/kern_ctf.c:1.2 src/sys/kern/kern_ctf.c:1.3
--- src/sys/kern/kern_ctf.c:1.2	Sat Mar 13 01:41:14 2010
+++ src/sys/kern/kern_ctf.c	Mon May  3 09:51:36 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ctf.c,v 1.2 2010/03/13 01:41:14 christos Exp $	*/
+/*	$NetBSD: kern_ctf.c,v 1.3 2010/05/03 09:51:36 darran Exp $	*/
 /*-
  * Copyright (c) 2008 John Birrell j...@freebsd.org
  * All rights reserved.
@@ -82,8 +82,9 @@
 	uint8_t *ctfaddr;
 	size_t ctfsize;
 
-	if (mc == NULL)
+	if (mc == NULL) {
 		return EINVAL;
+	}
 
 	/* Set the defaults for no CTF present. That's not a crime! */
 	memset(mc, 0, sizeof(*mc));
@@ -116,8 +117,9 @@
 		mc-strcnt = 0;		/* XXX TBD */
 		mc-nsym   = st-sd_symsize / sizeof(Elf_Sym);
 	} else {
-		if (kobj_find_section(mod-mod_kobj, .SUNW_ctf, (void **)ctfaddr, ctfsize))
+		if (kobj_find_section(mod-mod_kobj, .SUNW_ctf, (void **)ctfaddr, ctfsize)) {
 			return ENOENT;
+		}
 
 		mc-symtab = mod-mod_kobj-ko_symtab;
 		mc-strtab = mod-mod_kobj-ko_strtab;
@@ -126,17 +128,21 @@
 	}
 
 	if (ctfaddr == NULL) {
+		error = ENOENT;
 		goto out;
 	}
 
 	/* Check the CTF magic number. (XXX check for big endian!) */
 	if (ctfaddr[0] != 0xf1 || ctfaddr[1] != 0xcf) {
+		error = EINVAL;
 		goto out;
 	}
 
 	/* Check if version 2. */
-	if (ctfaddr[2] != 2)
+	if (ctfaddr[2] != 2) {
+		error = EINVAL;
 		goto out;
+	}
 
 	/* Check if the data is compressed. */
 	if ((ctfaddr[3]  0x1) != 0) {

Index: src/sys/kern/kern_ksyms.c
diff -u src/sys/kern/kern_ksyms.c:1.58 src/sys/kern/kern_ksyms.c:1.59
--- src/sys/kern/kern_ksyms.c:1.58	Sun Mar 14 21:27:49 2010
+++ src/sys/kern/kern_ksyms.c	Mon May  3 09:51:36 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ksyms.c,v 1.58 2010/03/14 21:27:49 darran Exp $	*/
+/*	$NetBSD: kern_ksyms.c,v 1.59 2010/05/03 09:51:36 darran Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_ksyms.c,v 1.58 2010/03/14 21:27:49 darran Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_ksyms.c,v 1.59 2010/05/03 09:51:36 darran Exp $);
 
 #if defined(_KERNEL)  defined(_KERNEL_OPT)
 #include opt_ddb.h
@@ -473,6 +473,9 @@
 		char *shstr = (uint8_t*)start +
 shdr[ehdr-e_shstrndx].sh_offset;
 		for (i = 1; i  ehdr-e_shnum; i++) {
+#ifdef DEBUG
+			printf(ksyms: checking %s\n, shstr[shdr[i].sh_name]);
+#endif
 			if (shdr[i].sh_type != SHT_PROGBITS)
 continue;
 			if (strncmp(.SUNW_ctf, shstr[shdr[i].sh_name] ,10) != 0)
@@ -486,6 +489,10 @@
 #endif
 			break;
 		}
+#ifdef DEBUG
+	} else {
+		printf(ksyms: e_shstrndx == 0\n);
+#endif
 	}
 #endif
 



CVS commit: src/sys

2010-03-14 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Mar 14 21:27:50 UTC 2010

Modified Files:
src/sys/kern: kern_ksyms.c
src/sys/sys: ksyms.h

Log Message:
DTrace: Make the CTF handling conditional on KDTRACE_HOOKS for now since
it breaks the boot of the atari kernel (and possibly others).


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/kern/kern_ksyms.c
cvs rdiff -u -r1.25 -r1.26 src/sys/sys/ksyms.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_ksyms.c
diff -u src/sys/kern/kern_ksyms.c:1.57 src/sys/kern/kern_ksyms.c:1.58
--- src/sys/kern/kern_ksyms.c:1.57	Sat Mar 13 16:27:06 2010
+++ src/sys/kern/kern_ksyms.c	Sun Mar 14 21:27:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ksyms.c,v 1.57 2010/03/13 16:27:06 christos Exp $	*/
+/*	$NetBSD: kern_ksyms.c,v 1.58 2010/03/14 21:27:49 darran Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_ksyms.c,v 1.57 2010/03/13 16:27:06 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_ksyms.c,v 1.58 2010/03/14 21:27:49 darran Exp $);
 
 #if defined(_KERNEL)  defined(_KERNEL_OPT)
 #include opt_ddb.h
@@ -298,10 +298,12 @@
 	tab-sd_maxsym = 0;
 	tab-sd_usroffset = 0;
 	tab-sd_gone = false;
+#ifdef KDTRACE_HOOKS
 	tab-sd_ctfstart = ctfstart;
 	tab-sd_ctfsize = ctfsize;
 	tab-sd_nmap = nmap;
 	tab-sd_nmapsize = nsyms;
+#endif
 #ifdef KSYMS_DEBUG
 	printf(newstart %p sym %p ksyms_symsz %d str %p strsz %d send %p\n,
 	newstart, symstart, symsize, strstart, strsize,
@@ -345,6 +347,7 @@
 		/* Save symbol. Set it as an absolute offset */
 		nsym[n] = sym[i];
 
+#ifdef KDTRACE_HOOKS
 		if (nmap != NULL) {
 			/* Save the size, replace it with the symbol id so
 			 * the mapping can be done after the cleanup and sort.
@@ -352,6 +355,7 @@
 			nmap[i] = nsym[n].st_size;
 			nsym[n].st_size = i+1;	/* zero is reserved */
 		}
+#endif
 
 		nsym[n].st_shndx = SHBSS;
 		j = strlen(nsym[n].st_name + str) + 1;
@@ -377,6 +381,7 @@
 	if (kheapsort(nsym, n, sizeof(Elf_Sym), addsymtab_compar, ts) != 0)
 		panic(addsymtab);
 
+#ifdef KDTRACE_HOOKS
 	/* 
 	 * Build the mapping from original symbol id to new symbol table.
 	 * Deleted symbols will have a zero map, indices will be one based
@@ -395,6 +400,7 @@
 			nsym[new].st_size = size;
 		}
 	}
+#endif
 
 	/* ksymsread() is unlocked, so membar. */
 	membar_producer();
@@ -416,7 +422,6 @@
 	Elf_Ehdr *ehdr;
 	char *ctfstart = NULL;
 	size_t ctfsize = 0;
-	char *shstr = NULL;
 
 	if (symsize = 0) {
 		printf([ Kernel symbol table missing! ]\n);
@@ -461,10 +466,12 @@
 		break;
 	}
 
+#ifdef KDTRACE_HOOKS
 	/* Find the CTF section */
 	shdr = (Elf_Shdr *)((uint8_t *)start + ehdr-e_shoff);
 	if (ehdr-e_shstrndx != 0) {
-		shstr = (uint8_t*)start + shdr[ehdr-e_shstrndx].sh_offset;
+		char *shstr = (uint8_t*)start +
+shdr[ehdr-e_shstrndx].sh_offset;
 		for (i = 1; i  ehdr-e_shnum; i++) {
 			if (shdr[i].sh_type != SHT_PROGBITS)
 continue;
@@ -480,6 +487,7 @@
 			break;
 		}
 	}
+#endif
 
 	if (!ksyms_verify(symstart, strstart))
 		return;
@@ -875,6 +883,7 @@
 	ksyms_hdr.kh_shdr[SHBSS].sh_addralign = PAGE_SIZE;
 	ksyms_hdr.kh_shdr[SHBSS].sh_flags = SHF_ALLOC | SHF_EXECINSTR;
 
+#ifdef KDTRACE_HOOKS
 	/* Sixth section header; .SUNW_ctf */
 	ksyms_hdr.kh_shdr[SHCTF].sh_name = 32; /* Section 6 offset */
 	ksyms_hdr.kh_shdr[SHCTF].sh_type = SHT_PROGBITS;
@@ -882,6 +891,7 @@
 /*	ksyms_hdr.kh_shdr[SHCTF].sh_size = filled in at open */
 	ksyms_hdr.kh_shdr[SHCTF].sh_link = SYMTAB; /* Corresponding symtab */
 	ksyms_hdr.kh_shdr[SHCTF].sh_addralign = sizeof(char);
+#endif
 
 	/* Set section names */
 	strlcpy(ksyms_hdr.kh_strtab[1], .symtab,
@@ -892,8 +902,10 @@
 	sizeof(ksyms_hdr.kh_strtab) - 17);
 	strlcpy(ksyms_hdr.kh_strtab[27], .bss,
 	sizeof(ksyms_hdr.kh_strtab) - 27);
+#ifdef KDTRACE_HOOKS
 	strlcpy(ksyms_hdr.kh_strtab[32], .SUNW_ctf,
 	sizeof(ksyms_hdr.kh_strtab) - 32);
+#endif
 }
 
 static int
@@ -913,9 +925,11 @@
 	ksyms_hdr.kh_shdr[STRTAB].sh_offset = ksyms_symsz +
 	ksyms_hdr.kh_shdr[SYMTAB].sh_offset;
 	ksyms_hdr.kh_shdr[STRTAB].sh_size = ksyms_strsz;
+#ifdef KDTRACE_HOOKS
 	ksyms_hdr.kh_shdr[SHCTF].sh_offset = ksyms_strsz +
 	ksyms_hdr.kh_shdr[STRTAB].sh_offset;
 	ksyms_hdr.kh_shdr[SHCTF].sh_size = ksyms_ctfsz;
+#endif
 	ksyms_isopen = true;
 	mutex_exit(ksyms_lock);
 
@@ -950,9 +964,12 @@
 static int
 ksymsread(dev_t dev, struct uio *uio, int ioflag)
 {
-	struct ksyms_symtab *st, *cst;
+	struct ksyms_symtab *st;
 	size_t filepos, inpos, off;
 	int error;
+#ifdef KDTRACE_HOOKS
+	struct ksyms_symtab *cst;
+#endif
 
 	/*
 	 * First: Copy out the ELF header.   XXX Lose if ksymsopen()
@@ -1001,6 +1018,7 @@
 		filepos += st-sd_strsize;
 	}
 
+#ifdef KDTRACE_HOOKS
 	/*
 	 * Copy out the CTF table.
 	 */
@@ -1017,7 +1035,7 @@
 		}
 		filepos += cst-sd_ctfsize;
 	}
-
+#endif
 
 	

CVS commit: src/sys/conf

2010-03-13 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sat Mar 13 08:33:26 UTC 2010

Modified Files:
src/sys/conf: files

Log Message:
DTrace: only build in kernel CTF support if DTrace support is enabled
(i.e. options KDTRACE_HOOKS).


To generate a diff of this commit:
cvs rdiff -u -r1.981 -r1.982 src/sys/conf/files

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.981 src/sys/conf/files:1.982
--- src/sys/conf/files:1.981	Fri Mar 12 21:43:11 2010
+++ src/sys/conf/files	Sat Mar 13 08:33:26 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.981 2010/03/12 21:43:11 darran Exp $
+#	$NetBSD: files,v 1.982 2010/03/13 08:33:26 darran Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20090313
@@ -1424,7 +1424,7 @@
 file	kern/kern_condvar.c
 file	kern/kern_core.c		coredump
 file	kern/kern_cpu.c
-file	kern/kern_ctf.c
+file	kern/kern_ctf.c			kdtrace_hooks
 file	kern/kern_descrip.c
 file	kern/kern_event.c
 file	kern/kern_exec.c



CVS commit: src

2010-03-12 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Fri Mar 12 21:37:38 UTC 2010

Modified Files:
src/external/cddl/osnet/sys/kern: mod.c
src/external/cddl/osnet/sys/sys: cpuvar.h
src/sys/modules/solaris: Makefile
Added Files:
src/external/cddl/osnet/sys/kern: opensolaris.c

Log Message:
DTrace: Add support for a simulated solaris_cpu[] data structure per
cpu.  Needed for the FBT provider amongst other features.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/sys/kern/mod.c
cvs rdiff -u -r0 -r1.1 src/external/cddl/osnet/sys/kern/opensolaris.c
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/sys/sys/cpuvar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/solaris/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/sys/kern/mod.c
diff -u src/external/cddl/osnet/sys/kern/mod.c:1.1 src/external/cddl/osnet/sys/kern/mod.c:1.2
--- src/external/cddl/osnet/sys/kern/mod.c:1.1	Fri Aug  7 20:57:57 2009
+++ src/external/cddl/osnet/sys/kern/mod.c	Fri Mar 12 21:37:37 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mod.c,v 1.1 2009/08/07 20:57:57 haad Exp $	*/
+/*	$NetBSD: mod.c,v 1.2 2010/03/12 21:37:37 darran Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mod.c,v 1.1 2009/08/07 20:57:57 haad Exp $);
+__KERNEL_RCSID(0, $NetBSD: mod.c,v 1.2 2010/03/12 21:37:37 darran Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -35,6 +35,9 @@
 #include sys/kthread.h
 #include sys/callb.h
 
+void opensolaris_init(void *);
+void opensolaris_fini(void *);
+
 MODULE(MODULE_CLASS_MISC, solaris, NULL);
 
 static int
@@ -47,9 +50,11 @@
 	case MODULE_CMD_INIT:
 		callb_init(NULL);
 		taskq_init();
+		opensolaris_init(NULL);
 		break;
 
 	case MODULE_CMD_FINI:
+		opensolaris_fini(NULL);
 		taskq_fini();
 		callb_fini(NULL);
 		break;

Index: src/external/cddl/osnet/sys/sys/cpuvar.h
diff -u src/external/cddl/osnet/sys/sys/cpuvar.h:1.5 src/external/cddl/osnet/sys/sys/cpuvar.h:1.6
--- src/external/cddl/osnet/sys/sys/cpuvar.h:1.5	Mon Mar  1 11:19:39 2010
+++ src/external/cddl/osnet/sys/sys/cpuvar.h	Fri Mar 12 21:37:37 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuvar.h,v 1.5 2010/03/01 11:19:39 darran Exp $	*/
+/*	$NetBSD: cpuvar.h,v 1.6 2010/03/12 21:37:37 darran Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -33,6 +33,25 @@
 #include sys/cpuvar_defs.h
 
 #ifdef _KERNEL
+
+typedef struct {
+	int		cpuid;
+struct cyc_cpu *cpu_cyclic;
+	uint32_t	cpu_flags;
+	uint_t		cpu_intr_actv;
+	uintptr_t	cpu_profile_pc;
+	uintptr_t	cpu_profile_upc;
+	uintptr_t	cpu_dtrace_caller;	/* DTrace: caller, if any */
+	hrtime_t	cpu_dtrace_chillmark;	/* DTrace: chill mark time */
+	hrtime_t	cpu_dtrace_chilled;	/* DTrace: total chill time */
+} solaris_cpu_t; 
+
+/* Some code may choose to redefine this if pcpu_t would be more useful. */
+#define cpu_t	solaris_cpu_t
+#define	cpu_id	cpuid
+
+extern solaris_cpu_tsolaris_cpu[];
+
 #define	CPU_CACHE_COHERENCE_SIZE	64
 
 /*
@@ -82,6 +101,47 @@
 CPU_DTRACE_BADSTACK)
 #define	CPU_DTRACE_ERROR	(CPU_DTRACE_FAULT | CPU_DTRACE_DROP)
 
+/*
+ * Flags in the CPU structure.
+ *
+ * These are protected by cpu_lock (except during creation).
+ *
+ * Offlined-CPUs have three stages of being offline:
+ *
+ * CPU_ENABLE indicates that the CPU is participating in I/O interrupts
+ * that can be directed at a number of different CPUs.  If CPU_ENABLE
+ * is off, the CPU will not be given interrupts that can be sent elsewhere,
+ * but will still get interrupts from devices associated with that CPU only,
+ * and from other CPUs.
+ *
+ * CPU_OFFLINE indicates that the dispatcher should not allow any threads
+ * other than interrupt threads to run on that CPU.  A CPU will not have
+ * CPU_OFFLINE set if there are any bound threads (besides interrupts).
+ *
+ * CPU_QUIESCED is set if p_offline was able to completely turn idle the
+ * CPU and it will not have to run interrupt threads.  In this case it'll
+ * stay in the idle loop until CPU_QUIESCED is turned off.
+ *
+ * CPU_FROZEN is used only by CPR to mark CPUs that have been successfully
+ * suspended (in the suspend path), or have yet to be resumed (in the resume
+ * case).
+ *
+ * On some platforms CPUs can be individually powered off.
+ * The following flags are set for powered off CPUs: CPU_QUIESCED,
+ * CPU_OFFLINE, and CPU_POWEROFF.  The following flags are cleared:
+ * CPU_RUNNING, CPU_READY, CPU_EXISTS, and CPU_ENABLE.
+ */
+#define	CPU_RUNNING	0x001		/* CPU running */
+#define	CPU_READY	0x002		/* CPU ready for cross-calls */
+#define	CPU_QUIESCED	0x004		/* CPU will stay in idle */
+#define	CPU_EXISTS	0x008		/* CPU is configured */
+#define	CPU_ENABLE	0x010		/* CPU enabled for interrupts */
+#define	CPU_OFFLINE	0x020		/* CPU offline via p_online */
+#define	CPU_POWEROFF	0x040		/* CPU is powered off */
+#define	

CVS commit: src/sys

2010-03-12 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Fri Mar 12 21:43:11 UTC 2010

Modified Files:
src/sys/conf: files
src/sys/kern: kern_ksyms.c
src/sys/lib/libsa: loadfile_elf32.c
src/sys/sys: ksyms.h
Added Files:
src/sys/kern: kern_ctf.c
src/sys/sys: kern_ctf.h

Log Message:
DTrace: Add support for CTF sections in the netbsd elf image, load these
at boot.
Add a ksyms_mod_foreach() function to iterate a callback function over the
set of elf symbols for a specific module (netbsd included).
Add kern_ctf.c and mod_ctf_get() to allow the retrieval and decompression
of CTF sections for a specific module.


To generate a diff of this commit:
cvs rdiff -u -r1.980 -r1.981 src/sys/conf/files
cvs rdiff -u -r0 -r1.1 src/sys/kern/kern_ctf.c
cvs rdiff -u -r1.55 -r1.56 src/sys/kern/kern_ksyms.c
cvs rdiff -u -r1.24 -r1.25 src/sys/lib/libsa/loadfile_elf32.c
cvs rdiff -u -r0 -r1.1 src/sys/sys/kern_ctf.h
cvs rdiff -u -r1.24 -r1.25 src/sys/sys/ksyms.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.980 src/sys/conf/files:1.981
--- src/sys/conf/files:1.980	Wed Mar  3 13:39:57 2010
+++ src/sys/conf/files	Fri Mar 12 21:43:11 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.980 2010/03/03 13:39:57 tsutsui Exp $
+#	$NetBSD: files,v 1.981 2010/03/12 21:43:11 darran Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20090313
@@ -1424,6 +1424,7 @@
 file	kern/kern_condvar.c
 file	kern/kern_core.c		coredump
 file	kern/kern_cpu.c
+file	kern/kern_ctf.c
 file	kern/kern_descrip.c
 file	kern/kern_event.c
 file	kern/kern_exec.c

Index: src/sys/kern/kern_ksyms.c
diff -u src/sys/kern/kern_ksyms.c:1.55 src/sys/kern/kern_ksyms.c:1.56
--- src/sys/kern/kern_ksyms.c:1.55	Mon Mar  1 22:27:07 2010
+++ src/sys/kern/kern_ksyms.c	Fri Mar 12 21:43:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ksyms.c,v 1.55 2010/03/01 22:27:07 darran Exp $	*/
+/*	$NetBSD: kern_ksyms.c,v 1.56 2010/03/12 21:43:11 darran Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -71,11 +71,12 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_ksyms.c,v 1.55 2010/03/01 22:27:07 darran Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_ksyms.c,v 1.56 2010/03/12 21:43:11 darran Exp $);
 
 #if defined(_KERNEL)  defined(_KERNEL_OPT)
 #include opt_ddb.h
 #include opt_ddbparam.h	/* for SYMTAB_SPACE */
+#include opt_dtrace.h
 #endif
 
 #define _KSYMS_PRIVATE
@@ -98,6 +99,13 @@
 
 #include ksyms.h
 
+#define KSYMS_MAX_ID	65536
+#ifdef KDTRACE_HOOKS
+static uint32_t ksyms_nmap[KSYMS_MAX_ID];	/* sorted symbol table map */
+#else
+static uint32_t *ksyms_nmap = NULL;
+#endif
+
 static int ksyms_maxlen;
 static bool ksyms_isopen;
 static bool ksyms_initted;
@@ -124,6 +132,7 @@
 
 int ksyms_symsz;
 int ksyms_strsz;
+int ksyms_ctfsz;
 TAILQ_HEAD(, ksyms_symtab) ksyms_symtabs =
 TAILQ_HEAD_INITIALIZER(ksyms_symtabs);
 static struct ksyms_symtab kernel_symtab;
@@ -264,11 +273,21 @@
 static void
 addsymtab(const char *name, void *symstart, size_t symsize,
 	  void *strstart, size_t strsize, struct ksyms_symtab *tab,
-	  void *newstart)
+	  void *newstart, void *ctfstart, size_t ctfsize, uint32_t *nmap)
 {
 	Elf_Sym *sym, *nsym, ts;
 	int i, j, n, nglob;
 	char *str;
+	int nsyms = symsize / sizeof(Elf_Sym);
+
+	/* sanity check for pre-malloc map table used during startup */
+	if ((nmap == ksyms_nmap)  (nsyms = KSYMS_MAX_ID)) {
+	printf(kern_ksyms: ERROR %d  %d, increase KSYMS_MAX_ID\n,
+		nsyms, KSYMS_MAX_ID);
+
+	/* truncate for now */
+	nsyms = KSYMS_MAX_ID-1;
+	}
 
 	tab-sd_symstart = symstart;
 	tab-sd_symsize = symsize;
@@ -279,18 +298,31 @@
 	tab-sd_maxsym = 0;
 	tab-sd_usroffset = 0;
 	tab-sd_gone = false;
+	tab-sd_ctfstart = ctfstart;
+	tab-sd_ctfsize = ctfsize;
+	tab-sd_nmap = nmap;
+	tab-sd_nmapsize = nsyms;
 #ifdef KSYMS_DEBUG
 	printf(newstart %p sym %p ksyms_symsz %d str %p strsz %d send %p\n,
 	newstart, symstart, symsize, strstart, strsize,
 	tab-sd_strstart + tab-sd_strsize);
 #endif
 
+	if (nmap) {
+		memset(nmap, 0, nsyms * sizeof(uint32_t));
+	}
+
 	/* Pack symbol table by removing all file name references. */
 	sym = tab-sd_symstart;
 	nsym = (Elf_Sym *)newstart;
 	str = tab-sd_strstart;
 	nglob = 0;
-	for (i = n = 0; i  tab-sd_symsize/sizeof(Elf_Sym); i++) {
+	for (i = n = 0; i  nsyms; i++) {
+
+		/* This breaks CTF mapping, so don't do it when
+		 * DTrace is enabled
+		 */
+#ifndef KDTRACE_HOOKS
 		/*
 		 * Remove useless symbols.
 		 * Should actually remove all typeless symbols.
@@ -308,9 +340,19 @@
 		if (ELF_ST_TYPE(sym[i].st_info) == STT_NOTYPE 
 		strcmp(str + sym[i].st_name, gcc2_compiled.) == 0)
 			continue; /* XXX */
+#endif
 
 		/* Save symbol. Set it as an absolute offset */
 		nsym[n] = sym[i];
+
+		if (nmap != NULL) {
+			/* Save the size, replace it with the symbol id so
+			 * the mapping can be done after the 

CVS commit: src

2010-03-12 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Fri Mar 12 21:53:16 UTC 2010

Modified Files:
src/distrib/sets/lists/modules: mi
src/external/cddl/osnet/dev/fbt: fbt.c
src/external/cddl/osnet/dist/uts/common/dtrace: dtrace.c
src/sys/modules/dtrace: Makefile
src/sys/sys: module.h
Added Files:
src/sys/modules/dtrace/fbt: Makefile

Log Message:
DTrace: Add the Function Boundary Trace (FBT) provider moduile.  This
module  instruments every function in the kernel with entry and exit
probes.  These probes are true zero-effect probes in that they don't
exist in the code until they are enabled.  The probes are enabled by
directly patching the function entry and exit points to make jumps into
the dtrace framework.
This gives us over 29,000 trace points in the kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/dev/fbt/fbt.c
cvs rdiff -u -r1.8 -r1.9 \
src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/dtrace/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/dtrace/fbt/Makefile
cvs rdiff -u -r1.20 -r1.21 src/sys/sys/module.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.11 src/distrib/sets/lists/modules/mi:1.12
--- src/distrib/sets/lists/modules/mi:1.11	Wed Mar  3 16:13:42 2010
+++ src/distrib/sets/lists/modules/mi	Fri Mar 12 21:53:16 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.11 2010/03/03 16:13:42 tron Exp $
+# $NetBSD: mi,v 1.12 2010/03/12 21:53:16 darran Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -40,6 +40,8 @@
 ./@MODULEDIR@/exec_script/exec_script.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/ext2fsbase-kernel-modules	kmod
 ./@MODULEDIR@/ext2fs/ext2fs.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/fbtbase-kernel-modules	kmod,dtrace
+./@MODULEDIR@/fbt/fbt.kmod			base-kernel-modules	kmod,dtrace
 ./@MODULEDIR@/fdescbase-kernel-modules	kmod
 ./@MODULEDIR@/fdesc/fdesc.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/ffsbase-kernel-modules	kmod

Index: src/external/cddl/osnet/dev/fbt/fbt.c
diff -u src/external/cddl/osnet/dev/fbt/fbt.c:1.2 src/external/cddl/osnet/dev/fbt/fbt.c:1.3
--- src/external/cddl/osnet/dev/fbt/fbt.c:1.2	Sun Feb 21 01:46:33 2010
+++ src/external/cddl/osnet/dev/fbt/fbt.c	Fri Mar 12 21:53:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fbt.c,v 1.2 2010/02/21 01:46:33 darran Exp $	*/
+/*	$NetBSD: fbt.c,v 1.3 2010/03/12 21:53:15 darran Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -21,6 +21,7 @@
  * CDDL HEADER END
  *
  * Portions Copyright 2006-2008 John Birrell j...@freebsd.org
+ * Portions Copyright 2010 Darran Hunt dar...@netbsd.org
  *
  * $FreeBSD: src/sys/cddl/dev/fbt/fbt.c,v 1.1.4.1 2009/08/03 08:13:06 kensmith Exp $
  *
@@ -38,9 +39,9 @@
 #include sys/cpuvar.h
 #include sys/fcntl.h
 #include sys/filio.h
-#include sys/kdb.h
 #include sys/kernel.h
 #include sys/kmem.h
+#include sys/cpu.h
 #include sys/kthread.h
 #include sys/limits.h
 #include sys/linker.h
@@ -48,20 +49,30 @@
 #include sys/malloc.h
 #include sys/module.h
 #include sys/mutex.h
-#include sys/pcpu.h
 #include sys/poll.h
 #include sys/proc.h
 #include sys/selinfo.h
-#include sys/smp.h
 #include sys/syscall.h
-#include sys/sysent.h
-#include sys/sysproto.h
 #include sys/uio.h
 #include sys/unistd.h
 #include machine/stdarg.h
 
+#include machine/cpu.h
+#include machine/cpufunc.h
+#include machine/specialreg.h
+#if 0
+#include x86/cpuvar.h
+#endif
+#include x86/cputypes.h
+
+#define ELFSIZE ARCH_ELFSIZE
+#include sys/exec_elf.h
+
 #include sys/dtrace.h
 #include sys/dtrace_bsd.h
+#include sys/kern_ctf.h
+
+mod_ctf_t *modptr;
 
 MALLOC_DEFINE(M_FBT, fbt, Function Boundary Tracing);
 
@@ -83,14 +94,14 @@
 #define	FBT_PATCHVAL		0xf0
 #endif
 
-static d_open_t	fbt_open;
+static dev_type_open(fbt_open);
 static int	fbt_unload(void);
 static void	fbt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *);
-static void	fbt_provide_module(void *, modctl_t *);
+static void	fbt_provide_module(void *, dtrace_modctl_t *);
 static void	fbt_destroy(void *, dtrace_id_t, void *);
-static void	fbt_enable(void *, dtrace_id_t, void *);
+static int	fbt_enable(void *, dtrace_id_t, void *);
 static void	fbt_disable(void *, dtrace_id_t, void *);
-static void	fbt_load(void *);
+static void	fbt_load(void);
 static void	fbt_suspend(void *, dtrace_id_t, void *);
 static void	fbt_resume(void *, dtrace_id_t, void *);
 
@@ -99,10 +110,10 @@
 #define	FBT_ADDR2NDX(addr)	uintptr_t)(addr))  4)  fbt_probetab_mask)
 #define	FBT_PROBETAB_SIZE	0x8000		/* 32k entries -- 128K total */
 
-static struct cdevsw fbt_cdevsw = {
-	.d_version	= D_VERSION,
-	.d_open		= fbt_open,
-	.d_name		= fbt,
+static const struct cdevsw fbt_cdevsw = {
+	fbt_open, noclose

CVS commit: src/external/cddl/osnet/dev/fbt

2010-03-12 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sat Mar 13 01:10:01 UTC 2010

Modified Files:
src/external/cddl/osnet/dev/fbt: fbt.c

Log Message:
DTrace: fix a sign problem with instruction size handling.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/dev/fbt/fbt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dev/fbt/fbt.c
diff -u src/external/cddl/osnet/dev/fbt/fbt.c:1.3 src/external/cddl/osnet/dev/fbt/fbt.c:1.4
--- src/external/cddl/osnet/dev/fbt/fbt.c:1.3	Fri Mar 12 21:53:15 2010
+++ src/external/cddl/osnet/dev/fbt/fbt.c	Sat Mar 13 01:10:01 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fbt.c,v 1.3 2010/03/12 21:53:15 darran Exp $	*/
+/*	$NetBSD: fbt.c,v 1.4 2010/03/13 01:10:01 darran Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -237,7 +237,7 @@
 
 static int
 fbt_provide_module_cb(const char *name, int symindx, void *value,
-	uint32_t size, int type, void *opaque)
+	uint32_t symsize, int type, void *opaque)
 {
 	fbt_probe_t *fbt, *retfbt;
 	u_int8_t *instr, *limit;
@@ -245,6 +245,7 @@
 	const char *modname = mod-mod_info-mi_name;
 	int j;
 	int ind;
+	int size;
 
 	/* got a function? */
 	if (ELF_ST_TYPE(type) != STT_FUNC) {
@@ -266,7 +267,7 @@
 		return (0);
 
 	instr = (u_int8_t *) value;
-	limit = (u_int8_t *) value + size;
+	limit = (u_int8_t *) value + symsize;
 
 #ifdef __amd64__
 	while (instr  limit) {



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2010-03-11 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Thu Mar 11 23:26:34 UTC 2010

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctf.c

Log Message:
DTrace: The CTF format is limited to only 1024 elements in an enum,
so rather than error out when there are more than this just truncate the
length.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.4 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.5
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.4	Sat Feb 27 23:43:53 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c	Thu Mar 11 23:26:33 2010
@@ -369,14 +369,16 @@
 			i++; /* count up enum members */
 
 		if (i  CTF_MAX_VLEN) {
-			terminate(enum %s has too many values: %d  %d\n,
+			printf(enum %s has too many values: %d  %d, truncating\n,
 			tdesc_name(tp), i, CTF_MAX_VLEN);
+
+		i = CTF_MAX_VLEN;
 		}
 
 		ctt.ctt_info = CTF_TYPE_INFO(CTF_K_ENUM, isroot, i);
 		write_sized_type_rec(b, ctt, tp-t_size);
 
-		for (ep = tp-t_emem; ep != NULL; ep = ep-el_next) {
+		for (ep = tp-t_emem; i  ep != NULL; ep = ep-el_next, i--) {
 			offset = strtab_insert(b-ctb_strtab, ep-el_name);
 			cte.cte_name = CTF_TYPE_NAME(CTF_STRTAB_0, offset);
 			cte.cte_value = ep-el_number;
@@ -818,7 +820,7 @@
 			debug(3, Skipping null object\n);
 			continue;
 		} else if (id = tdsize) {
-			parseterminate(Reference to invalid type %d, id);
+			parseterminate((1) Reference to invalid type %d, id);
 		}
 
 		ii = iidesc_new(symit_name(si));
@@ -869,7 +871,7 @@
 		dptr += 2;
 
 		if (retid = tdsize)
-			parseterminate(Reference to invalid type %d, retid);
+			parseterminate((2) Reference to invalid type %d, retid);
 
 		ii = iidesc_new(symit_name(si));
 		ii-ii_dtype = tdarr[retid];
@@ -887,8 +889,8 @@
 			v = (void *) dptr;
 			ushort_t id = *((ushort_t *)v);
 			if (id = tdsize)
-parseterminate(Reference to invalid type %d,
-id);
+parseterminate((3) Reference to invalid type %d (tdsize %d) ii_nargs %d %s,
+id, tdsize, ii-ii_nargs, ii-ii_name);
 			ii-ii_args[i] = tdarr[id];
 		}
 
@@ -943,7 +945,7 @@
 			break;
 
 		if (tid = tdsize)
-			parseterminate(Reference to invalid type %d, tid);
+			parseterminate((4) Reference to invalid type %d, tid);
 
 		void *v = (void *) dptr;
 		ctt = v;



CVS commit: src/external/cddl/osnet

2010-03-11 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Thu Mar 11 23:28:08 UTC 2010

Modified Files:
src/external/cddl/osnet/dist/uts/common/dtrace: dtrace.c
src/external/cddl/osnet/dist/uts/common/sys: dtrace.h
src/external/cddl/osnet/sys/sys: types.h

Log Message:
DTrace: fix a few build issues for tools and the dtrace provider operation
interface.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dist/uts/common/sys/dtrace.h
cvs rdiff -u -r1.10 -r1.11 src/external/cddl/osnet/sys/sys/types.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c
diff -u src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.7 src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.8
--- src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.7	Sat Feb 27 23:43:53 2010
+++ src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c	Thu Mar 11 23:28:07 2010
@@ -344,13 +344,13 @@
 }
 
 static dtrace_pops_t	dtrace_provider_ops = {
-	(void (*)(void *, dtrace_probedesc_t *))dtrace_nullop,
+	(void (*)(void *, const dtrace_probedesc_t *))dtrace_nullop,
 #if defined(sun)
 	(void (*)(void *, modctl_t *))dtrace_nullop,
 #else
 	(void (*)(void *, dtrace_modctl_t *))dtrace_nullop,
 #endif
-	(void (*)(void *, dtrace_id_t, void *))dtrace_nullop,
+	(int (*)(void *, dtrace_id_t, void *))dtrace_nullop,
 	(void (*)(void *, dtrace_id_t, void *))dtrace_nullop,
 	(void (*)(void *, dtrace_id_t, void *))dtrace_nullop,
 	(void (*)(void *, dtrace_id_t, void *))dtrace_nullop,
@@ -7443,7 +7443,7 @@
 	if (pops-dtps_provide == NULL) {
 		ASSERT(pops-dtps_provide_module != NULL);
 		provider-dtpv_pops.dtps_provide =
-		(void (*)(void *, dtrace_probedesc_t *))dtrace_nullop;
+		(void (*)(void *, const dtrace_probedesc_t *))dtrace_nullop;
 	}
 
 	if (pops-dtps_provide_module == NULL) {

Index: src/external/cddl/osnet/dist/uts/common/sys/dtrace.h
diff -u src/external/cddl/osnet/dist/uts/common/sys/dtrace.h:1.6 src/external/cddl/osnet/dist/uts/common/sys/dtrace.h:1.7
--- src/external/cddl/osnet/dist/uts/common/sys/dtrace.h:1.6	Tue Mar  2 00:55:46 2010
+++ src/external/cddl/osnet/dist/uts/common/sys/dtrace.h	Thu Mar 11 23:28:07 2010
@@ -2299,6 +2299,7 @@
 extern void dtrace_getfsr(uint64_t *);
 #endif
 
+#if defined(sun)
 #define	DTRACE_CPUFLAG_ISSET(flag) \
 	(cpu_core[curcpu_id].cpuc_dtrace_flags  (flag))
 
@@ -2307,6 +2308,16 @@
 
 #define	DTRACE_CPUFLAG_CLEAR(flag) \
 	(cpu_core[curcpu_id].cpuc_dtrace_flags = ~(flag))
+#else
+#define	DTRACE_CPUFLAG_ISSET(flag) \
+	(cpu_core[cpu_number()].cpuc_dtrace_flags  (flag))
+
+#define	DTRACE_CPUFLAG_SET(flag) \
+	(cpu_core[cpu_number()].cpuc_dtrace_flags |= (flag))
+
+#define	DTRACE_CPUFLAG_CLEAR(flag) \
+	(cpu_core[cpu_number()].cpuc_dtrace_flags = ~(flag))
+#endif
 
 #endif /* _KERNEL */
 

Index: src/external/cddl/osnet/sys/sys/types.h
diff -u src/external/cddl/osnet/sys/sys/types.h:1.10 src/external/cddl/osnet/sys/sys/types.h:1.11
--- src/external/cddl/osnet/sys/sys/types.h:1.10	Wed Mar 10 23:41:56 2010
+++ src/external/cddl/osnet/sys/sys/types.h	Thu Mar 11 23:28:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.10 2010/03/10 23:41:56 darran Exp $	*/
+/*	$NetBSD: types.h,v 1.11 2010/03/11 23:28:07 darran Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -68,10 +68,15 @@
 #else
 #include sys/stdint.h
 #endif
+#ifdef _NETBSD_SOURCE
+#include_next sys/types.h
+#include_next sys/ccompile.h
+#else
 #define _NETBSD_SOURCE
 #include_next sys/types.h
 #include_next sys/ccompile.h
 #undef _NETBSD_SOURCE
+#endif
 
 #ifndef _KERNEL
 #include stdarg.h



CVS commit: src/external/cddl/osnet/dist/uts/common/dtrace

2010-02-25 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Thu Feb 25 11:12:02 UTC 2010

Modified Files:
src/external/cddl/osnet/dist/uts/common/dtrace: dtrace.c

Log Message:
DTrace: fix a problem with the code waiting for the deadman thread to exit
- now it does actually wait for it to exit.  Thanks to Frank Kardel for
spotting this.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c
diff -u src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.4 src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.5
--- src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.4	Wed Feb 24 21:08:54 2010
+++ src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c	Thu Feb 25 11:12:02 2010
@@ -248,6 +248,7 @@
 
 kmutex_t dtrace_deadman_mutex;
 void *dtrace_deadman_wchan; 
+void *dtrace_cleanup_wchan; 
 int dtrace_deadman_alive; 			/* deadman thread keep alive */
 lwp_t *dtrace_deadman_proc;
 #endif
@@ -12872,6 +12873,9 @@
 	state-dts_alive = now;
 	}
 
+	/* let the cleanup code know we're done */
+	dtrace_deadman_alive = -1;
+
 	kthread_exit(0);
 }
 #endif
@@ -13729,10 +13733,16 @@
 
 	/* Kill off the deadman thread */
 	if (dtrace_deadman_alive) {
+	/* tell the deadman thread to exit */
 	dtrace_deadman_alive = 0;
+	dtrace_cleanup_wchan = dtrace_cleanup_wchan;
 	wakeup(dtrace_deadman_wchan);
 	/* Wait for thread to exit */
 	mutex_enter(dtrace_deadman_mutex);
+	do {
+		mtsleep(dtrace_cleanup_wchan, PRI_BIO,
+			deadman_exit, 10, dtrace_deadman_mutex);
+	} while (!dtrace_deadman_alive);
 	mutex_exit(dtrace_deadman_mutex);
 	mutex_destroy(dtrace_deadman_mutex);
 	}



CVS commit: src/external/cddl/osnet/dist/uts/common/dtrace

2010-02-24 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Wed Feb 24 21:08:54 UTC 2010

Modified Files:
src/external/cddl/osnet/dist/uts/common/dtrace: dtrace.c

Log Message:
Fix a bug in the dtrace_state_deadman() thread; return should have been
a continue (thanks Frank!).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c
diff -u src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.3 src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.4
--- src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.3	Sun Feb 21 01:46:34 2010
+++ src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c	Wed Feb 24 21:08:54 2010
@@ -12856,7 +12856,7 @@
 
 	if (state != dtrace_anon.dta_state 
 		now - state-dts_laststatus = dtrace_deadman_user)
-		return;
+		continue;
 
 	/*
 	 * We must be sure that dts_alive never appears to be less than the



CVS commit: src/tools

2010-02-24 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Wed Feb 24 21:34:57 UTC 2010

Added Files:
src/tools/ctfconvert: Makefile
src/tools/ctfmerge: Makefile
src/tools/libctf: Makefile
src/tools/libdwarf: Makefile

Log Message:
DTrace: add CTF tools to the toolchain (not built yet).


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tools/ctfconvert/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/ctfmerge/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/libctf/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/libdwarf/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/tools/ctfconvert/Makefile
diff -u /dev/null src/tools/ctfconvert/Makefile:1.1
--- /dev/null	Wed Feb 24 21:34:57 2010
+++ src/tools/ctfconvert/Makefile	Wed Feb 24 21:34:57 2010
@@ -0,0 +1,57 @@
+#	$NetBSD: Makefile,v 1.1 2010/02/24 21:34:57 darran Exp $
+
+.include bsd.own.mk
+
+HOSTPROGNAME=   ${_TOOL_PREFIX}ctfconvert
+HOST_SRCDIR=external/cddl/osnet/usr.bin/ctfconvert
+#HOST_SRCS=	alist.c \
+		ctf.c \
+		ctfconvert.c \
+		dwarf.c \
+		fixup_tdescs.c \
+		hash.c \
+		iidesc.c \
+		input.c \
+		list.c \
+		memory.c \
+		merge.c \
+		output.c \
+		st_parse.c \
+		stabs.c \
+		stack.c \
+		strtab.c \
+		symbol.c \
+		tdata.c \
+		traverse.c \
+		util.c
+
+LIBELF_DIR=	${.CURDIR}/../../external/bsd/libelf/dist
+LIBDWARF_DIR=	${.CURDIR}/../../external/bsd/libdwarf/dist
+
+HOST_CPPFLAGS+=	-I${OSNETDIR}/sys \
+		-I${OSNETDIR}/include \
+		-I${OPENSOLARIS_DISTDIR} \
+		-I${OPENSOLARIS_DISTDIR}/head \
+		-I${OPENSOLARIS_DISTDIR}/tools/ctf/common \
+		-I${OPENSOLARIS_DISTDIR}/tools/ctf/cvt \
+		-I${OPENSOLARIS_DISTDIR}/uts/common \
+		-I${LIBELF_DIR} \
+		-I${LIBDWARF_DIR}
+
+HOST_CPPFLAGS+=	-DHAVE_NBTOOL_CONFIG_H=1
+
+OSNETDIR=	${.CURDIR}/../../external/cddl/osnet
+OPENSOLARIS_DISTDIR= ${OSNETDIR}/dist
+
+CTFOBJ!=	cd ${.CURDIR}/../libctf  ${PRINTOBJDIR}
+DWARFOBJ!=	cd ${.CURDIR}/../libdwarf  ${PRINTOBJDIR}
+ELFOBJ!=	cd ${.CURDIR}/../libelf  ${PRINTOBJDIR}
+LDADD+=		-L${CTFOBJ} -lctf
+LDADD+=		-L${DWARFOBJ} -ldwarf
+LDADD+=		-L${ELFOBJ} -lelf
+
+.PATH:		${OPENSOLARIS_DISTDIR}/tools/ctf/common
+.PATH:		${OPENSOLARIS_DISTDIR}/tools/ctf/cvt
+
+.include ${.CURDIR}/../Makefile.disklabel
+.include ${.CURDIR}/../Makefile.host

Index: src/tools/ctfmerge/Makefile
diff -u /dev/null src/tools/ctfmerge/Makefile:1.1
--- /dev/null	Wed Feb 24 21:34:57 2010
+++ src/tools/ctfmerge/Makefile	Wed Feb 24 21:34:57 2010
@@ -0,0 +1,40 @@
+#	$NetBSD: Makefile,v 1.1 2010/02/24 21:34:57 darran Exp $
+
+.include bsd.own.mk
+
+HOSTPROGNAME=   ${_TOOL_PREFIX}ctfmerge
+HOST_SRCDIR=external/cddl/osnet/usr.bin/ctfmerge
+
+LIBELF_DIR=	${.CURDIR}/../../external/bsd/libelf/dist
+LIBDWARF_DIR=	${.CURDIR}/../../external/bsd/libdwarf/dist
+
+HOST_CPPFLAGS+=	-I${OSNETDIR}/sys \
+		-I${OSNETDIR}/include \
+		-I${OPENSOLARIS_DISTDIR} \
+		-I${OPENSOLARIS_DISTDIR}/head \
+		-I${OPENSOLARIS_DISTDIR}/tools/ctf/common \
+		-I${OPENSOLARIS_DISTDIR}/tools/ctf/cvt \
+		-I${OPENSOLARIS_DISTDIR}/uts/common \
+		-I${LIBELF_DIR} \
+		-I${LIBDWARF_DIR}
+
+HOST_CPPFLAGS+=	-DHAVE_NBTOOL_CONFIG_H=1
+
+OSNETDIR=	${.CURDIR}/../../external/cddl/osnet
+OPENSOLARIS_DISTDIR= ${OSNETDIR}/dist
+
+CTFOBJ!=	cd ${.CURDIR}/../libctf  ${PRINTOBJDIR}
+DWARFOBJ!=	cd ${.CURDIR}/../libdwarf  ${PRINTOBJDIR}
+ELFOBJ!=	cd ${.CURDIR}/../libelf  ${PRINTOBJDIR}
+LDADD+=		-L${CTFOBJ} -lctf
+LDADD+=		-L${DWARFOBJ} -ldwarf
+LDADD+=		-L${ELFOBJ} -lelf
+
+# need native pthread support
+LDADD+=		-lpthread
+
+.PATH:		${OPENSOLARIS_DISTDIR}/tools/ctf/common
+.PATH:		${OPENSOLARIS_DISTDIR}/tools/ctf/cvt
+
+.include ${.CURDIR}/../Makefile.disklabel
+.include ${.CURDIR}/../Makefile.host

Index: src/tools/libctf/Makefile
diff -u /dev/null src/tools/libctf/Makefile:1.1
--- /dev/null	Wed Feb 24 21:34:57 2010
+++ src/tools/libctf/Makefile	Wed Feb 24 21:34:57 2010
@@ -0,0 +1,65 @@
+#	$NetBSD: Makefile,v 1.1 2010/02/24 21:34:57 darran Exp $
+
+.include bsd.own.mk
+
+HOSTLIB=	ctf
+
+SRCS=		ctf_create.c \
+		ctf_decl.c \
+		ctf_error.c \
+		ctf_hash.c \
+		ctf_labels.c \
+		ctf_lib.c \
+		ctf_lookup.c \
+		ctf_open.c \
+		ctf_subr.c \
+		ctf_types.c \
+		ctf_util.c
+
+OSNETDIR=	${.CURDIR}/../../external/cddl/osnet
+OPENSOLARIS_DISTDIR= ${OSNETDIR}/dist
+LIBELF_DIR=	${.CURDIR}/../../external/bsd/libelf/dist
+
+CPPFLAGS+=	-DCTF_OLD_VERSIONS
+
+.ifndef NOCOMPATLIB
+COMPATOBJ!= cd ${.CURDIR}/../compat  ${PRINTOBJDIR}
+CPPFLAGS+=	-I${COMPATOBJ}
+.endif
+
+CPPFLAGS+=	-I${.CURDIR}/../compat \
+		-I${OSNETDIR}/sys \
+		-I${OSNETDIR}/include \
+		-I${OPENSOLARIS_DISTDIR}/head \
+		-I${OPENSOLARIS_DISTDIR}/common/ctf \
+		-I${OPENSOLARIS_DISTDIR}/lib/libctf/common \
+		-I${OPENSOLARIS_DISTDIR}/uts/common \
+		-I${LIBELF_DIR}
+
+BUILD_OSTYPE!=  uname -s
+
+# Disable use of pre-compiled headers on Darwin.
+.if ${BUILD_OSTYPE} == Darwin
+CPPFLAGS+=	-no-cpp-precomp
+.endif
+
+# -D_FILE_OFFSET_BITS=64 produces a much more 

CVS commit: src/external/cddl

2010-02-24 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Thu Feb 25 00:14:10 UTC 2010

Modified Files:
src/external/cddl: Makefile

Log Message:
DTrace: have DTrace build with out requiring MKZFS=yes.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/Makefile
diff -u src/external/cddl/Makefile:1.1 src/external/cddl/Makefile:1.2
--- src/external/cddl/Makefile:1.1	Mon Oct  5 22:44:26 2009
+++ src/external/cddl/Makefile	Thu Feb 25 00:14:10 2010
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.1 2009/10/05 22:44:26 haad Exp $
+#	$NetBSD: Makefile,v 1.2 2010/02/25 00:14:10 darran Exp $
 .include bsd.own.mk
 
 # We need more modular flag e.g. we can add dtrace to osnet later
 
-.if ( ${MKZFS} != no)
+.if ( ${MKZFS} != no || ${MKDTRACE} != no )
 SUBDIR+= osnet
 .endif
 



CVS commit: src/external/cddl/osnet

2010-02-24 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Thu Feb 25 00:18:44 UTC 2010

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c
src/external/cddl/osnet/sys/sys: types.h

Log Message:
DTrace: fix CTF tools for non-toolchain build.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/sys/sys/types.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.4 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.5
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.4	Wed Feb 24 21:53:26 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Thu Feb 25 00:18:44 2010
@@ -177,9 +177,13 @@
 
 #include stdio.h
 #include stdlib.h
-#define _NETBSD_SOURCE
+#ifndef _NETBSD_SOURCE
+#define _NETBSD_SOURCE	/* XXX TBD fix this */
 #include unistd.h
 #undef _NETBSD_SOURCE
+#else
+#include unistd.h
+#endif
 #include pthread.h
 #include assert.h
 #if defined(sun)

Index: src/external/cddl/osnet/sys/sys/types.h
diff -u src/external/cddl/osnet/sys/sys/types.h:1.4 src/external/cddl/osnet/sys/sys/types.h:1.5
--- src/external/cddl/osnet/sys/sys/types.h:1.4	Wed Feb 24 21:53:26 2010
+++ src/external/cddl/osnet/sys/sys/types.h	Thu Feb 25 00:18:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.4 2010/02/24 21:53:26 darran Exp $	*/
+/*	$NetBSD: types.h,v 1.5 2010/02/25 00:18:44 darran Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -65,9 +65,13 @@
  */
 
 #include sys/stdint.h
+#ifndef _NETBSD_SOURCE
 #define _NETBSD_SOURCE		/* XXX TBD fix this */
 #include_next sys/types.h
 #undef _NETBSD_SOURCE
+#else
+#include_next sys/types.h
+#endif
 #include_next sys/ccompile.h
 
 #ifndef _KERNEL



CVS commit: src/sys

2010-02-23 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Tue Feb 23 22:19:27 UTC 2010

Modified Files:
src/sys/kern: kern_dtrace.c kern_lwp.c kern_proc.c kern_synch.c
src/sys/sys: dtrace_bsd.h

Log Message:
DTrace: Get rid of the KDTRACE_HOOKS ifdefs in the kernel.  Replace the
functions with inline function that are empty when KDTRACE_HOOKS is not
defined.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/kern/kern_dtrace.c
cvs rdiff -u -r1.139 -r1.140 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.161 -r1.162 src/sys/kern/kern_proc.c
cvs rdiff -u -r1.278 -r1.279 src/sys/kern/kern_synch.c
cvs rdiff -u -r1.1 -r1.2 src/sys/sys/dtrace_bsd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_dtrace.c
diff -u src/sys/kern/kern_dtrace.c:1.1 src/sys/kern/kern_dtrace.c:1.2
--- src/sys/kern/kern_dtrace.c:1.1	Sun Feb 21 07:28:51 2010
+++ src/sys/kern/kern_dtrace.c	Tue Feb 23 22:19:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_dtrace.c,v 1.1 2010/02/21 07:28:51 darran Exp $	*/
+/*	$NetBSD: kern_dtrace.c,v 1.2 2010/02/23 22:19:27 darran Exp $	*/
 
 /*-
  * Copyright (c) 2007-2008 John Birrell j...@freebsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_dtrace.c,v 1.1 2010/02/21 07:28:51 darran Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_dtrace.c,v 1.2 2010/02/23 22:19:27 darran Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -37,11 +37,6 @@
 #include sys/proc.h
 #include sys/dtrace_bsd.h
 
-#define KDTRACE_PROC_SIZE	64
-#define KDTRACE_PROC_ZERO	8
-#define	KDTRACE_THREAD_SIZE	256
-#define	KDTRACE_THREAD_ZERO	64
-
 /* Return the DTrace process data size compiled in the kernel hooks. */
 size_t
 kdtrace_proc_size()
@@ -50,24 +45,6 @@
 	return(KDTRACE_PROC_SIZE);
 }
 
-void
-kdtrace_proc_ctor(void *arg, struct proc *p)
-{
-
-	p-p_dtrace = kmem_alloc(KDTRACE_PROC_SIZE, KM_SLEEP);
-	memset(p-p_dtrace, 0, KDTRACE_PROC_ZERO);
-}
-
-void
-kdtrace_proc_dtor(void *arg, struct proc *p)
-{
-
-	if (p-p_dtrace != NULL) {
-		kmem_free(p-p_dtrace, KDTRACE_PROC_SIZE);
-		p-p_dtrace = NULL;
-	}
-}
-
 /* Return the DTrace thread data size compiled in the kernel hooks. */
 size_t
 kdtrace_thread_size()
@@ -75,21 +52,3 @@
 
 	return(KDTRACE_THREAD_SIZE);
 }
-
-void
-kdtrace_thread_ctor(void *arg, struct lwp *l)
-{
-
-	l-l_dtrace = kmem_alloc(KDTRACE_THREAD_SIZE, KM_SLEEP);
-	memset(l-l_dtrace, 0, KDTRACE_THREAD_ZERO);
-}
-
-void
-kdtrace_thread_dtor(void *arg, struct lwp *l)
-{
-
-	if (l-l_dtrace != NULL) {
-		kmem_free(l-l_dtrace, KDTRACE_THREAD_SIZE);
-		l-l_dtrace = NULL;
-	}
-}

Index: src/sys/kern/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.139 src/sys/kern/kern_lwp.c:1.140
--- src/sys/kern/kern_lwp.c:1.139	Sun Feb 21 07:01:57 2010
+++ src/sys/kern/kern_lwp.c	Tue Feb 23 22:19:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.139 2010/02/21 07:01:57 darran Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.140 2010/02/23 22:19:27 darran Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -209,7 +209,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_lwp.c,v 1.139 2010/02/21 07:01:57 darran Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_lwp.c,v 1.140 2010/02/23 22:19:27 darran Exp $);
 
 #include opt_ddb.h
 #include opt_lockdebug.h
@@ -236,10 +236,7 @@
 #include sys/lwpctl.h
 #include sys/atomic.h
 #include sys/filedesc.h
-
-#ifdef KDTRACE_HOOKS
 #include sys/dtrace_bsd.h
-#endif
 
 #include uvm/uvm_extern.h
 #include uvm/uvm_object.h
@@ -625,9 +622,7 @@
 	l2-l_cpu = l1-l_cpu;
 	kpreempt_enable();
 
-#ifdef KDTRACE_HOOKS
 	kdtrace_thread_ctor(NULL, l2);
-#endif
 	lwp_initspecific(l2);
 	sched_lwp_fork(l1, l2);
 	lwp_update_creds(l2);
@@ -964,9 +959,7 @@
 
 	KASSERT(SLIST_EMPTY(l-l_pi_lenders));
 	KASSERT(l-l_inheritedprio == -1);
-#ifdef KDTRACE_HOOKS
 	kdtrace_thread_dtor(NULL, l);
-#endif
 	if (!recycle)
 		pool_cache_put(lwp_cache, l);
 }

Index: src/sys/kern/kern_proc.c
diff -u src/sys/kern/kern_proc.c:1.161 src/sys/kern/kern_proc.c:1.162
--- src/sys/kern/kern_proc.c:1.161	Sun Feb 21 07:01:57 2010
+++ src/sys/kern/kern_proc.c	Tue Feb 23 22:19:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_proc.c,v 1.161 2010/02/21 07:01:57 darran Exp $	*/
+/*	$NetBSD: kern_proc.c,v 1.162 2010/02/23 22:19:27 darran Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_proc.c,v 1.161 2010/02/21 07:01:57 darran Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_proc.c,v 1.162 2010/02/23 22:19:27 darran Exp $);
 
 #include opt_kstack.h
 #include opt_maxuprc.h
@@ -94,10 +94,7 @@
 #include sys/sleepq.h
 #include sys/atomic.h
 #include sys/kmem.h
-
-#ifdef KDTRACE_HOOKS
 #include sys/dtrace_bsd.h
-#endif
 
 #include uvm/uvm.h
 #include uvm/uvm_extern.h
@@ -447,9 +444,7 @@
 	mutex_init(p-p_sigacts-sa_mutex, MUTEX_DEFAULT, IPL_SCHED);
 	siginit(p);
 

CVS commit: src/sys/conf

2010-02-23 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Tue Feb 23 22:21:25 UTC 2010

Modified Files:
src/sys/conf: files


To generate a diff of this commit:
cvs rdiff -u -r1.976 -r1.977 src/sys/conf/files

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.976 src/sys/conf/files:1.977
--- src/sys/conf/files:1.976	Sun Feb 21 07:01:57 2010
+++ src/sys/conf/files	Tue Feb 23 22:21:25 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.976 2010/02/21 07:01:57 darran Exp $
+#	$NetBSD: files,v 1.977 2010/02/23 22:21:25 darran Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20090313
@@ -1425,7 +1425,6 @@
 file	kern/kern_core.c		coredump
 file	kern/kern_cpu.c
 file	kern/kern_descrip.c
-file	kern/kern_dtrace.c		kdtrace_hooks
 file	kern/kern_event.c
 file	kern/kern_exec.c
 file	kern/kern_exit.c



CVS commit: src/sys/kern

2010-02-23 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Tue Feb 23 22:22:29 UTC 2010

Removed Files:
src/sys/kern: kern_dtrace.c

Log Message:
DTrace: remove kern_dtrace.c since it is no longer used.  (Its functions
are inlined in dtrace_bsd.h).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r0 src/sys/kern/kern_dtrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/sys/sys

2010-02-21 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 21 08:28:41 UTC 2010

Removed Files:
src/external/cddl/osnet/sys/sys: file.h

Log Message:
DTrace: remove file.h - it shouldn't have been added and breaks zfs.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r0 src/external/cddl/osnet/sys/sys/file.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/include

2010-02-21 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 21 09:52:08 UTC 2010

Removed Files:
src/external/cddl/osnet/include: assert.h

Log Message:
DTrace: remove assert.h - shouldn't have been checked in (breaks libdtrace
build).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r0 src/external/cddl/osnet/include/assert.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet/include

2010-02-21 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 21 10:21:07 UTC 2010

Removed Files:
src/external/cddl/osnet/include: libshare.h

Log Message:
DTrace: remove extra libshare.h - shouldn't have added it and it breaks
the libzfs build.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r0 src/external/cddl/osnet/include/libshare.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet

2010-02-21 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 21 11:00:02 UTC 2010

Modified Files:
src/external/cddl/osnet/usr.bin/ctfconvert: Makefile
src/external/cddl/osnet/usr.bin/ctfmerge: Makefile
src/external/cddl/osnet/usr.sbin/dtrace: Makefile

Log Message:
DTrace: fix a problem with library references for libctf and libdtrace.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/usr.bin/ctfconvert/Makefile
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/usr.bin/ctfmerge/Makefile
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/usr.sbin/dtrace/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/usr.bin/ctfconvert/Makefile
diff -u src/external/cddl/osnet/usr.bin/ctfconvert/Makefile:1.2 src/external/cddl/osnet/usr.bin/ctfconvert/Makefile:1.3
--- src/external/cddl/osnet/usr.bin/ctfconvert/Makefile:1.2	Sun Feb 21 01:46:36 2010
+++ src/external/cddl/osnet/usr.bin/ctfconvert/Makefile	Sun Feb 21 11:00:01 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2010/02/21 01:46:36 darran Exp $
+#	$NetBSD: Makefile,v 1.3 2010/02/21 11:00:01 darran Exp $
 
 # $FreeBSD: src/cddl/usr.bin/ctfconvert/Makefile,v 1.1.4.1 2009/08/03 08:13:06 kensmith Exp $
 
@@ -42,9 +42,12 @@
 		-g
 
 .ifndef HOSTPROG
+LIBCTF_OBJDIR!=	cd ${.CURDIR}/../../lib/libctf   ${PRINTOBJDIR}
+
 LDADD+=		-L${OSNETDIR}/lib/libctf \
 		-L${NETBSDSRCDIR}/external/bsd/libdwarf/lib \
-		-L${NETBSDSRCDIR}/external/bsd/libelf/lib
+		-L${NETBSDSRCDIR}/external/bsd/libelf/lib \
+		-L${LIBCTF_OBJDIR}
 LDADD+=		-lctf -ldwarf -lelf -lz 
 .endif
 

Index: src/external/cddl/osnet/usr.bin/ctfmerge/Makefile
diff -u src/external/cddl/osnet/usr.bin/ctfmerge/Makefile:1.2 src/external/cddl/osnet/usr.bin/ctfmerge/Makefile:1.3
--- src/external/cddl/osnet/usr.bin/ctfmerge/Makefile:1.2	Sun Feb 21 01:46:36 2010
+++ src/external/cddl/osnet/usr.bin/ctfmerge/Makefile	Sun Feb 21 11:00:01 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2010/02/21 01:46:36 darran Exp $
+#	$NetBSD: Makefile,v 1.3 2010/02/21 11:00:01 darran Exp $
 
 # $FreeBSD: src/cddl/usr.bin/ctfmerge/Makefile,v 1.1.4.1 2009/08/03 08:13:06 kensmith Exp $
 
@@ -36,10 +36,9 @@
 		-I${OPENSOLARIS_SYS_DISTDIR}/uts/common \
 
 .ifndef HOSTPROG
-LDADD+=		-L${OSNETDIR}/lib/libctf \
-		-L${NETBSDSRCDIR}/exernal/bsd/libdwarf/lib \
-		-L${NETBSDSRCDIR}/external/bsd/libelf/lib
-LDADD+=		-lctf -ldwarf -lelf -lz -lpthread
+LIBCTF_OBJDIR!=	cd ${.CURDIR}/../../lib/libctf  ${PRINTOBJDIR}
+LDADD+=		-L${LIBCTF_OBJDIR} -lctf
+LDADD+=		-ldwarf -lelf -lz -lpthread
 .endif
 
 .PATH:		${OPENSOLARIS_USR_DISTDIR}/tools/ctf/common

Index: src/external/cddl/osnet/usr.sbin/dtrace/Makefile
diff -u src/external/cddl/osnet/usr.sbin/dtrace/Makefile:1.2 src/external/cddl/osnet/usr.sbin/dtrace/Makefile:1.3
--- src/external/cddl/osnet/usr.sbin/dtrace/Makefile:1.2	Sun Feb 21 01:46:36 2010
+++ src/external/cddl/osnet/usr.sbin/dtrace/Makefile	Sun Feb 21 11:00:02 2010
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile,v 1.2 2010/02/21 01:46:36 darran Exp $
+#	$NetBSD: Makefile,v 1.3 2010/02/21 11:00:02 darran Exp $
 
 # $FreeBSD: src/cddl/usr.sbin/dtrace/Makefile,v 1.1.4.1 2009/08/03 08:13:06 kensmith Exp $
 
+.include bsd.own.mk
 .include	../../Makefile.inc
 
 PROG=		dtrace
@@ -26,20 +27,15 @@
 #CFLAGS+=	-DNEED_ERRLOC
 #YFLAGS+=	-d
 
-LDFLAGS+=	-pthread \
-		-L${OSNETDIR}/lib/libdtrace \
-		-L${OSNETDIR}/lib/libctf 
 
-LDADD+=		-ldtrace -ly -ll -lctf -lelf -lz
+LDFLAGS+=	-pthread
 
-#LDFLAGS+=	-pthread \
-		-L${.OBJDIR}/../../lib/libdtrace \
-		-L${.OBJDIR}/../../lib/libproc \
-		-L${.OBJDIR}/../../lib/libctf \
-		-L${.OBJDIR}/../../../lib/libelf
+LIBCTF_OBJDIR!=	cd ${.CURDIR}/../../lib/libctf  ${PRINTOBJDIR}
+LDFLAGS+=	-L${LIBDTRACE_OBJDIR} -ldtrace
 
-#LDADD+=		-ldtrace -ly -ll -lproc -lctf -lelf -lz
+LIBDTRACE_OBJDIR!= cd ${.CURDIR}/../../lib/libdtrace  ${PRINTOBJDIR}
+LDFLAGS+=	-L${LIBCTF_OBJDIR} -lctf
 
-#DPADD+= ${LIBDTRACE} ${LIBCTF} ${LIBELF} ${LIBPTHREAD} ${LIBL} ${LIBY} ${LIBZ}
+LDADD+=		-ly -ll -lelf -lz
 
 .include bsd.prog.mk



CVS commit: src/sys/modules

2010-02-21 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 21 11:14:47 UTC 2010

Modified Files:
src/sys/modules: Makefile

Log Message:
DTrace: add the dtrace module to the build.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/modules/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.38 src/sys/modules/Makefile:1.39
--- src/sys/modules/Makefile:1.38	Mon Jan 25 22:21:28 2010
+++ src/sys/modules/Makefile	Sun Feb 21 11:14:47 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.38 2010/01/25 22:21:28 pooka Exp $
+#	$NetBSD: Makefile,v 1.39 2010/02/21 11:14:47 darran Exp $
 
 .include bsd.own.mk
 
@@ -107,9 +107,16 @@
 SUBDIR+= 	dm
 .endif
 
-# we need solaris and zfs modules for ZFS
-.if (${MKZFS} != no)
+.if (${MKDTRACE} != no)
+SUBDIR+=	dtrace
+.endif
+
+# we need solaris for the dtrace and zfs modules
+.if (${MKDTRACE} != no || ${MKZFS} != no)
 SUBDIR+=solaris
+.endif
+
+.if (${MKZFS} != no)
 SUBDIR+=	zfs
 .endif
 



CVS commit: src/sys/modules/dtrace

2010-02-21 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 21 11:16:19 UTC 2010

Added Files:
src/sys/modules/dtrace: Makefile
src/sys/modules/dtrace/dtrace: Makefile

Log Message:
DTrace: add the dtrace module.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/modules/dtrace/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/dtrace/dtrace/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/modules/dtrace/Makefile
diff -u /dev/null src/sys/modules/dtrace/Makefile:1.1
--- /dev/null	Sun Feb 21 11:16:19 2010
+++ src/sys/modules/dtrace/Makefile	Sun Feb 21 11:16:19 2010
@@ -0,0 +1,8 @@
+#	$NetBSD: Makefile,v 1.1 2010/02/21 11:16:19 darran Exp $
+# $FreeBSD: src/sys/modules/dtrace/Makefile,v 1.6.2.1 2009/08/03 08:13:06 kensmith Exp $
+
+.include bsd.own.mk
+
+SUBDIR=		dtrace
+
+.include bsd.subdir.mk

Index: src/sys/modules/dtrace/dtrace/Makefile
diff -u /dev/null src/sys/modules/dtrace/dtrace/Makefile:1.1
--- /dev/null	Sun Feb 21 11:16:19 2010
+++ src/sys/modules/dtrace/dtrace/Makefile	Sun Feb 21 11:16:19 2010
@@ -0,0 +1,33 @@
+# $FreeBSD: src/sys/modules/dtrace/dtrace/Makefile,v 1.2.2.1 2009/08/03 08:13:06 kensmith Exp $
+
+#.include ../../Makefile.inc
+
+ARCHDIR=	${MACHINE}
+
+.PATH: ${NETBSDSRCDIR}/external/cddl/osnet/dist/uts/common/dtrace
+.PATH: ${NETBSDSRCDIR}/external/cddl/osnet/dev/dtrace
+.PATH: ${NETBSDSRCDIR}/external/cddl/osnet/dev/dtrace/${ARCHDIR}
+
+KMOD=		dtrace
+SRCS=		dtrace.c \
+		dtrace_asm.S \
+		dtrace_subr.c
+
+.if ${MACHINE} == amd64 || ${MACHINE} == i386
+SRCS+=		dis_tables.c \
+		instr_size.c
+.endif
+
+CPPFLAGS+=	-I${NETBSDSRCDIR}/external/cddl/osnet/sys \
+		-I${NETBSDSRCDIR}/external/cddl/osnet/dev/dtrace \
+		-I${NETBSDSRCDIR}/external/cddl/osnet/dev/dtrace/${ARCHDIR} \
+		-I${NETBSDSRCDIR}/external/cddl/osnet/dist/uts/common \
+		-DDIS_MEM
+
+CPPFLAGS+=	-DSMP -DDEBUG
+
+EXPORT_SYMS=	dtrace_register \
+		dtrace_unregister \
+		dtrace_probe_lookup
+
+.include bsd.kmodule.mk



CVS commit: src/external/cddl/osnet

2010-02-20 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 21 00:50:01 UTC 2010

Modified Files:
src/external/cddl/osnet/dist/cmd/dtrace: dtrace.c
src/external/cddl/osnet/dist/lib/libctf/common: ctf_lib.c ctf_subr.c
src/external/cddl/osnet/dist/lib/libdtrace/common: drti.c
dt_aggregate.c dt_cc.c dt_cg.c dt_consume.c dt_dof.c dt_error.c
dt_errtags.h dt_handle.c dt_ident.c dt_impl.h dt_lex.l dt_link.c
dt_map.c dt_module.c dt_open.c dt_options.c dt_parser.c dt_pid.c
dt_pragma.c dt_printf.c dt_proc.c dt_proc.h dt_program.c
dt_provider.c dt_subr.c dt_work.c dtrace.h mkerrtags.sh mknames.sh
src/external/cddl/osnet/dist/lib/libgen/common: gmatch.c
src/external/cddl/osnet/dist/tools/ctf/common: list.c memory.c
src/external/cddl/osnet/dist/tools/ctf/cvt: alist.c alist.h barrier.c
barrier.h ctf.c ctfconvert.c ctfmerge.c ctfmerge.h ctftools.h
dwarf.c fixup_tdescs.c hash.c iidesc.c input.c merge.c output.c
st_parse.c stabs.c strtab.c strtab.h tdata.c traverse.c traverse.h
util.c
src/external/cddl/osnet/dist/tools/ctf/dump: dump.c
src/external/cddl/osnet/dist/uts/common/dtrace: dtrace.c fasttrap.c
lockstat.c profile.c sdt_subr.c systrace.c
src/external/cddl/osnet/dist/uts/common/sys: ctf.h ctf_api.h dtrace.h
dtrace_impl.h
src/external/cddl/osnet/include: alloca.h devid.h fcntl.h fsshare.h
libintl.h mnttab.h priv.h solaris.h stdio.h stdlib.h strings.h
unistd.h zone.h
src/external/cddl/osnet/lib: Makefile Makefile.inc
src/external/cddl/osnet/lib/libavl: Makefile
src/external/cddl/osnet/lib/libnvpair: Makefile
src/external/cddl/osnet/lib/libumem: Makefile
src/external/cddl/osnet/lib/libuutil: Makefile
src/external/cddl/osnet/lib/libzfs: Makefile
src/external/cddl/osnet/lib/libzpool: Makefile
src/external/cddl/osnet/sys/sys: atomic.h bitmap.h byteorder.h
cmn_err.h cpupart.h cpuvar.h cred.h cyclic.h debug.h dirent.h
dkio.h dnlc.h elf.h kcondvar.h kidmap.h kmem.h kobj.h kstat.h
lock.h misc.h mman.h mnttab.h modctl.h mount.h mutex.h objfs.h
param.h pathname.h pcpu.h policy.h proc.h random.h rwlock.h sdt.h
sid.h stat.h string.h sunddi.h sysmacros.h systm.h time.h types.h
uio.h varargs.h vfs.h vnode.h zone.h
Added Files:
src/external/cddl/osnet/dev: prototype.c
src/external/cddl/osnet/dev/cyclic: cyclic.c cyclic_test.c
src/external/cddl/osnet/dev/cyclic/amd64: cyclic_machdep.c
src/external/cddl/osnet/dev/cyclic/i386: cyclic_machdep.c
src/external/cddl/osnet/dev/dtmalloc: dtmalloc.c
src/external/cddl/osnet/dev/dtrace: dtrace_anon.c dtrace_cddl.h
dtrace_clone.c dtrace_debug.c dtrace_hacks.c dtrace_ioctl.c
dtrace_load.c dtrace_modevent.c dtrace_sysctl.c dtrace_test.c
dtrace_unload.c dtrace_vtime.c
src/external/cddl/osnet/dev/dtrace/amd64: dis_tables.c dis_tables.h
dtrace_asm.S dtrace_isa.c dtrace_subr.c instr_size.c
src/external/cddl/osnet/dev/dtrace/i386: dis_tables.c dis_tables.h
dtrace_asm.S dtrace_isa.c dtrace_subr.c instr_size.c
src/external/cddl/osnet/dev/fbt: fbt.c
src/external/cddl/osnet/dev/lockstat: lockstat.c
src/external/cddl/osnet/dev/profile: profile.c
src/external/cddl/osnet/dev/sdt: sdt.c
src/external/cddl/osnet/dev/systrace: systrace.c
src/external/cddl/osnet/dist/uts/common/sys: processor.h
src/external/cddl/osnet/include: assert.h dtrace.h libproc.h libshare.h
src/external/cddl/osnet/lib/drti: Makefile
src/external/cddl/osnet/lib/libctf: Makefile
src/external/cddl/osnet/lib/libdtrace: Makefile errno.d net.d nfs.d
psinfo.d sched.d signal.d unistd.d
src/external/cddl/osnet/sys/sys: acl.h cpuvar_defs.h cyclic_impl.h
feature_tests.h file.h mntent.h refstr.h sema.h sig.h
src/external/cddl/osnet/usr.bin/ctfconvert: Makefile
src/external/cddl/osnet/usr.bin/ctfdump: Makefile
src/external/cddl/osnet/usr.bin/ctfmerge: Makefile
src/external/cddl/osnet/usr.sbin/dtrace: Makefile

Log Message:
Add the FreeBSD 8-RC1 changes for DTrace.

Ok with c...@.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/cddl/osnet/dev/prototype.c
cvs rdiff -u -r0 -r1.1 src/external/cddl/osnet/dev/cyclic/cyclic.c \
src/external/cddl/osnet/dev/cyclic/cyclic_test.c
cvs rdiff -u -r0 -r1.1 \
src/external/cddl/osnet/dev/cyclic/amd64/cyclic_machdep.c
cvs rdiff -u -r0 -r1.1 \
src/external/cddl/osnet/dev/cyclic/i386/cyclic_machdep.c
cvs rdiff -u -r0 -r1.1 src/external/cddl/osnet/dev/dtmalloc/dtmalloc.c
cvs rdiff -u -r0 -r1.1 src/external/cddl/osnet/dev/dtrace/dtrace_anon.c \

CVS commit: src/share/mk

2010-02-20 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 21 01:48:03 UTC 2010

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Add a MKDTRACE build knob for DTrace, off by default.


To generate a diff of this commit:
cvs rdiff -u -r1.617 -r1.618 src/share/mk/bsd.own.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.617 src/share/mk/bsd.own.mk:1.618
--- src/share/mk/bsd.own.mk:1.617	Thu Feb 11 00:20:50 2010
+++ src/share/mk/bsd.own.mk	Sun Feb 21 01:48:03 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.617 2010/02/11 00:20:50 macallan Exp $
+#	$NetBSD: bsd.own.mk,v 1.618 2010/02/21 01:48:03 darran Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -717,7 +717,7 @@
 #
 _MKVARS.no= \
 	MKCRYPTO_IDEA MKCRYPTO_MDC2 MKCRYPTO_RC5 MKDEBUG MKDEBUGLIB \
-	MKEXTSRC \
+	MKDTRACE MKEXTSRC \
 	MKMANDOC MKMANZ MKOBJDIRS \
 	MKPCC MKPCCCMDS \
 	MKSOFTFLOAT MKSTRIPIDENT \



CVS commit: src/sys

2010-02-20 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 21 02:11:40 UTC 2010

Modified Files:
src/sys/arch/i386/i386: trap.c vector.S
src/sys/kern: kern_lwp.c kern_proc.c kern_synch.c
src/sys/sys: lwp.h proc.h
Added Files:
src/sys/sys: dtrace_bsd.h

Log Message:
Add the DTrace hooks to the kernel (KDTRACE_HOOKS config option).
DTrace adds a pointer to the lwp and proc structures which it uses to
manage its state.  These are opaque from the kernel perspective to keep
the kernel free of CDDL code. The state arenas are kmem_alloced and freed
as proccesses and threads are created and destoyed.

Also add a check for trap06 (privileged/illegal instruction) so that
DTrace can check for D scripts that may have triggered the trap so it
can clean up after them and resume normal operation.

Ok with c...@.


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 src/sys/arch/i386/i386/trap.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.137 -r1.138 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.159 -r1.160 src/sys/kern/kern_proc.c
cvs rdiff -u -r1.275 -r1.276 src/sys/kern/kern_synch.c
cvs rdiff -u -r0 -r1.1 src/sys/sys/dtrace_bsd.h
cvs rdiff -u -r1.127 -r1.128 src/sys/sys/lwp.h
cvs rdiff -u -r1.294 -r1.295 src/sys/sys/proc.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/i386/trap.c
diff -u src/sys/arch/i386/i386/trap.c:1.253 src/sys/arch/i386/i386/trap.c:1.254
--- src/sys/arch/i386/i386/trap.c:1.253	Sun Jan 17 22:21:18 2010
+++ src/sys/arch/i386/i386/trap.c	Sun Feb 21 02:11:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.253 2010/01/17 22:21:18 dsl Exp $	*/
+/*	$NetBSD: trap.c,v 1.254 2010/02/21 02:11:40 darran Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.253 2010/01/17 22:21:18 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.254 2010/02/21 02:11:40 darran Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -120,6 +120,20 @@
 
 #include npx.h
 
+#ifdef KDTRACE_HOOKS
+#include sys/dtrace_bsd.h
+
+/*
+ * This is a hook which is initialised by the dtrace module
+ * to handle traps which might occur during DTrace probe
+ * execution.
+ */
+dtrace_trap_func_t	dtrace_trap_func = NULL;
+
+dtrace_doubletrap_func_t	dtrace_doubletrap_func = NULL;
+#endif
+
+
 static inline int xmm_si_code(struct lwp *);
 void trap(struct trapframe *);
 void trap_tss(struct i386tss *, int, int);
@@ -338,6 +352,27 @@
 		LWP_CACHE_CREDS(l, p);
 	}
 
+#ifdef KDTRACE_HOOKS
+	/*
+	 * A trap can occur while DTrace executes a probe. Before
+	 * executing the probe, DTrace blocks re-scheduling and sets
+	 * a flag in it's per-cpu flags to indicate that it doesn't
+	 * want to fault. On returning from the the probe, the no-fault
+	 * flag is cleared and finally re-scheduling is enabled.
+	 *
+	 * If the DTrace kernel module has registered a trap handler,
+	 * call it and if it returns non-zero, assume that it has
+	 * handled the trap and modified the trap frame so that this
+	 * function can return normally.
+	 */
+	if ((type == T_PROTFLT || type == T_PAGEFLT) 
+	dtrace_trap_func != NULL) {
+		if ((*dtrace_trap_func)(frame, type)) {
+			return;
+		}
+	}
+#endif
+
 	switch (type) {
 
 	case T_ASTFLT:

Index: src/sys/arch/i386/i386/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.51 src/sys/arch/i386/i386/vector.S:1.52
--- src/sys/arch/i386/i386/vector.S:1.51	Sun Jan 17 22:21:18 2010
+++ src/sys/arch/i386/i386/vector.S	Sun Feb 21 02:11:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.51 2010/01/17 22:21:18 dsl Exp $	*/
+/*	$NetBSD: vector.S,v 1.52 2010/02/21 02:11:40 darran Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: vector.S,v 1.51 2010/01/17 22:21:18 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: vector.S,v 1.52 2010/02/21 02:11:40 darran Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -129,6 +129,23 @@
 	shl	$24,%eax;\
 	orl	%edx,%eax
 
+#ifdef KDTRACE_HOOKS
+	.bss
+	.globl	dtrace_invop_jump_addr
+	.align	4
+	.type	dtrace_invop_jump_addr, @object
+.size	dtrace_invop_jump_addr, 4
+dtrace_invop_jump_addr:
+	.zero	4
+	.globl	dtrace_invop_calltrap_addr
+	.align	4
+	.type	dtrace_invop_calltrap_addr, @object
+.size	dtrace_invop_calltrap_addr, 4
+dtrace_invop_calltrap_addr:
+	.zero	8
+	.text
+#endif
+
 #ifndef XEN
 #if NLAPIC  0
 #ifdef MULTIPROCESSOR
@@ -885,8 +902,47 @@
 	ZTRAP(T_OFLOW)
 IDTVEC(trap05)
 	ZTRAP(T_BOUND)
+/*
+ * Privileged instruction fault.
+ */
+#ifdef KDTRACE_HOOKS
+	SUPERALIGN_TEXT
+IDTVEC(trap06)
+	/* Check if there is no DTrace hook registered. */
+	cmpl	$0,dtrace_invop_jump_addr
+	je	norm_ill
+
+	/* Check if this is a user fault. */
+	/* XXX this was 0x0020 in FreeBSD */
+	cmpl	

CVS commit: src/distrib/sets

2010-02-20 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 21 03:18:47 UTC 2010

Modified Files:
src/distrib/sets: sets.subr
src/distrib/sets/lists/base: mi shl.elf shl.mi
src/distrib/sets/lists/comp: mi shl.mi
src/distrib/sets/lists/man: mi
src/distrib/sets/lists/modules: mi

Log Message:
Add DTrace to sets.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/distrib/sets/sets.subr
cvs rdiff -u -r1.858 -r1.859 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.202 -r1.203 src/distrib/sets/lists/base/shl.elf
cvs rdiff -u -r1.522 -r1.523 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.1393 -r1.1394 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.105 -r1.106 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.1191 -r1.1192 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.6 -r1.7 src/distrib/sets/lists/modules/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/sets.subr
diff -u src/distrib/sets/sets.subr:1.120 src/distrib/sets/sets.subr:1.121
--- src/distrib/sets/sets.subr:1.120	Thu Feb  4 13:07:55 2010
+++ src/distrib/sets/sets.subr	Sun Feb 21 03:18:45 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: sets.subr,v 1.120 2010/02/04 13:07:55 plunky Exp $
+#	$NetBSD: sets.subr,v 1.121 2010/02/21 03:18:45 darran Exp $
 #
 
 #
@@ -168,7 +168,7 @@
 # In each file, a record consists of a path and a System Package name,
 # separated by whitespace. E.g.,
 #
-# 	# $NetBSD: sets.subr,v 1.120 2010/02/04 13:07:55 plunky Exp $
+# 	# $NetBSD: sets.subr,v 1.121 2010/02/21 03:18:45 darran Exp $
 # 	.			base-sys-root	[keyword[,...]]
 # 	./altroot		base-sys-root
 # 	./bin			base-sys-root
@@ -200,6 +200,7 @@
 #	debug			${MKDEBUG} != no
 #	debuglib		${MKDEBUGLIB} != no
 #	doc			${MKDOC} != no
+#	dtrace			${MKDTRACE} != no
 #	dynamicroot		${MKDYNAMICROOT} != no
 #	extsrc			${MKEXTSRC} != no
 #	gcc			${MKGCC} != no

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.858 src/distrib/sets/lists/base/mi:1.859
--- src/distrib/sets/lists/base/mi:1.858	Fri Feb  5 19:08:25 2010
+++ src/distrib/sets/lists/base/mi	Sun Feb 21 03:18:45 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.858 2010/02/05 19:08:25 plunky Exp $
+# $NetBSD: mi,v 1.859 2010/02/21 03:18:45 darran Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -1048,6 +1048,7 @@
 ./usr/sbin/dnssec-signzone			base-bind-bin
 ./usr/sbin/download-vulnerability-list		base-pkgutil-bin
 ./usr/sbin/dtmfdecodebase-isdn-bin
+./usr/sbin/dtracebase-debug-bin		dtrace
 ./usr/sbin/dumpfsbase-sysutil-bin
 ./usr/sbin/dumplfsbase-sysutil-bin
 ./usr/sbin/eaytestbase-obsolete		obsolete

Index: src/distrib/sets/lists/base/shl.elf
diff -u src/distrib/sets/lists/base/shl.elf:1.202 src/distrib/sets/lists/base/shl.elf:1.203
--- src/distrib/sets/lists/base/shl.elf:1.202	Thu Feb 11 02:29:23 2010
+++ src/distrib/sets/lists/base/shl.elf	Sun Feb 21 03:18:46 2010
@@ -1,4 +1,4 @@
-# $NetBSD: shl.elf,v 1.202 2010/02/11 02:29:23 pooka Exp $
+# $NetBSD: shl.elf,v 1.203 2010/02/21 03:18:46 darran Exp $
 #
 # Note:	Do not mark old major and major.minor shared libraries as
 #	obsolete; just remove the entry, as third-party applications
@@ -118,6 +118,8 @@
 ./usr/lib/libcrypt.so.1base-sys-shlib
 ./usr/lib/libcrypto.sobase-crypto-shlib	crypto
 ./usr/lib/libcrypto.so.6			base-crypto-shlib	crypto
+./usr/lib/libctf.sobase-sys-shlib		dtrace
+./usr/lib/libctf.so.2base-sys-shlib		dtrace
 ./usr/lib/libcurses.sobase-sys-shlib
 ./usr/lib/libcurses.so.7			base-sys-shlib
 ./usr/lib/libdes.sobase-crypto-shlib	crypto
@@ -128,6 +130,8 @@
 ./usr/lib/libdns.so.5base-bind-shlib
 ./usr/lib/libdns_sd.sobase-mdns-shlib		mdns
 ./usr/lib/libdns_sd.so.0			base-mdns-shlib		mdns
+./usr/lib/libdtrace.sobase-sys-shlib		dtrace
+./usr/lib/libdtrace.so.2			base-sys-shlib		dtrace
 ./usr/lib/libdwarf.sobase-sys-shlib
 ./usr/lib/libdwarf.so.0base-sys-shlib
 ./usr/lib/libedit.sobase-sys-shlib

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.522 src/distrib/sets/lists/base/shl.mi:1.523
--- src/distrib/sets/lists/base/shl.mi:1.522	Sat Feb 20 02:55:52 2010
+++ src/distrib/sets/lists/base/shl.mi	Sun Feb 21 03:18:46 2010
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.522 2010/02/20 02:55:52 joerg Exp $
+# $NetBSD: shl.mi,v 1.523 2010/02/21 03:18:46 darran Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -67,11 +67,13 @@
 ./usr/lib/libcom_err.so.6.0			base-krb5-shlib		kerberos
 ./usr/lib/libcrypt.so.1.0			base-sys-shlib
 ./usr/lib/libcrypto.so.6.1			base-crypto-shlib	crypto
+./usr/lib/libctf.so.2.0base-sys-shlib		dtrace
 ./usr/lib/libcurses.so.7.0			base-sys-shlib
 ./usr/lib/libdes.so.8.1base-crypto-shlib	crypto
 ./usr/lib/libdevmapper.so.1.0			

CVS commit: src/sys/conf

2010-02-20 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 21 04:00:47 UTC 2010

Modified Files:
src/sys/conf: files

Log Message:
Add the DTrace kernel hooks file to the kernel build.


To generate a diff of this commit:
cvs rdiff -u -r1.974 -r1.975 src/sys/conf/files

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.974 src/sys/conf/files:1.975
--- src/sys/conf/files:1.974	Sun Jan 31 15:10:11 2010
+++ src/sys/conf/files	Sun Feb 21 04:00:47 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.974 2010/01/31 15:10:11 pooka Exp $
+#	$NetBSD: files,v 1.975 2010/02/21 04:00:47 darran Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20090313
@@ -1423,6 +1423,7 @@
 file	kern/kern_core.c		coredump
 file	kern/kern_cpu.c
 file	kern/kern_descrip.c
+file	kern/kern_dtrace.c		kdtrace_hooks
 file	kern/kern_event.c
 file	kern/kern_exec.c
 file	kern/kern_exit.c



CVS commit: src/sys

2010-02-20 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 21 07:01:58 UTC 2010

Modified Files:
src/sys/conf: files
src/sys/kern: kern_lwp.c kern_proc.c kern_synch.c

Log Message:
Added a defflag option for KDTRACE_HOOKS and included opt_dtrace.h in the
relevant files. (Per Quentin Garnier - thanks!).


To generate a diff of this commit:
cvs rdiff -u -r1.975 -r1.976 src/sys/conf/files
cvs rdiff -u -r1.138 -r1.139 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.160 -r1.161 src/sys/kern/kern_proc.c
cvs rdiff -u -r1.276 -r1.277 src/sys/kern/kern_synch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.975 src/sys/conf/files:1.976
--- src/sys/conf/files:1.975	Sun Feb 21 04:00:47 2010
+++ src/sys/conf/files	Sun Feb 21 07:01:57 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.975 2010/02/21 04:00:47 darran Exp $
+#	$NetBSD: files,v 1.976 2010/02/21 07:01:57 darran Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20090313
@@ -59,6 +59,8 @@
 
 defflagCPU_IN_CKSUM
 
+defflag opt_dtrace.h		KDTRACE_HOOKS
+
 defflag opt_posix.h		P1003_1B_SEMAPHORE
 defflag	opt_sysv.h		SYSVMSG SYSVSEM	SYSVSHM
 defparam opt_sysvparam.h	SHMMAXPGS SEMMNI SEMMNS SEMUME SEMMNU

Index: src/sys/kern/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.138 src/sys/kern/kern_lwp.c:1.139
--- src/sys/kern/kern_lwp.c:1.138	Sun Feb 21 02:11:40 2010
+++ src/sys/kern/kern_lwp.c	Sun Feb 21 07:01:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.138 2010/02/21 02:11:40 darran Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.139 2010/02/21 07:01:57 darran Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -209,11 +209,12 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_lwp.c,v 1.138 2010/02/21 02:11:40 darran Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_lwp.c,v 1.139 2010/02/21 07:01:57 darran Exp $);
 
 #include opt_ddb.h
 #include opt_lockdebug.h
 #include opt_sa.h
+#include opt_dtrace.h
 
 #define _LWP_API_PRIVATE
 

Index: src/sys/kern/kern_proc.c
diff -u src/sys/kern/kern_proc.c:1.160 src/sys/kern/kern_proc.c:1.161
--- src/sys/kern/kern_proc.c:1.160	Sun Feb 21 02:11:40 2010
+++ src/sys/kern/kern_proc.c	Sun Feb 21 07:01:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_proc.c,v 1.160 2010/02/21 02:11:40 darran Exp $	*/
+/*	$NetBSD: kern_proc.c,v 1.161 2010/02/21 07:01:57 darran Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,10 +62,11 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_proc.c,v 1.160 2010/02/21 02:11:40 darran Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_proc.c,v 1.161 2010/02/21 07:01:57 darran Exp $);
 
 #include opt_kstack.h
 #include opt_maxuprc.h
+#include opt_dtrace.h
 
 #include sys/param.h
 #include sys/systm.h

Index: src/sys/kern/kern_synch.c
diff -u src/sys/kern/kern_synch.c:1.276 src/sys/kern/kern_synch.c:1.277
--- src/sys/kern/kern_synch.c:1.276	Sun Feb 21 02:11:40 2010
+++ src/sys/kern/kern_synch.c	Sun Feb 21 07:01:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_synch.c,v 1.276 2010/02/21 02:11:40 darran Exp $	*/
+/*	$NetBSD: kern_synch.c,v 1.277 2010/02/21 07:01:57 darran Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,11 +69,12 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_synch.c,v 1.276 2010/02/21 02:11:40 darran Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_synch.c,v 1.277 2010/02/21 07:01:57 darran Exp $);
 
 #include opt_kstack.h
 #include opt_perfctrs.h
 #include opt_sa.h
+#include opt_dtrace.h
 
 #define	__MUTEX_PRIVATE
 



CVS commit: src/sys/kern

2010-02-20 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 21 07:28:51 UTC 2010

Added Files:
src/sys/kern: kern_dtrace.c

Log Message:
DTrace: missed kern_dtrace.c (thanks rmind!)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/kern/kern_dtrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/kern/kern_dtrace.c
diff -u /dev/null src/sys/kern/kern_dtrace.c:1.1
--- /dev/null	Sun Feb 21 07:28:51 2010
+++ src/sys/kern/kern_dtrace.c	Sun Feb 21 07:28:51 2010
@@ -0,0 +1,95 @@
+/*	$NetBSD: kern_dtrace.c,v 1.1 2010/02/21 07:28:51 darran Exp $	*/
+
+/*-
+ * Copyright (c) 2007-2008 John Birrell j...@freebsd.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: kern_dtrace.c,v 1.1 2010/02/21 07:28:51 darran Exp $);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/kernel.h
+#include sys/malloc.h
+#include sys/kmem.h
+#include sys/proc.h
+#include sys/dtrace_bsd.h
+
+#define KDTRACE_PROC_SIZE	64
+#define KDTRACE_PROC_ZERO	8
+#define	KDTRACE_THREAD_SIZE	256
+#define	KDTRACE_THREAD_ZERO	64
+
+/* Return the DTrace process data size compiled in the kernel hooks. */
+size_t
+kdtrace_proc_size()
+{
+
+	return(KDTRACE_PROC_SIZE);
+}
+
+void
+kdtrace_proc_ctor(void *arg, struct proc *p)
+{
+
+	p-p_dtrace = kmem_alloc(KDTRACE_PROC_SIZE, KM_SLEEP);
+	memset(p-p_dtrace, 0, KDTRACE_PROC_ZERO);
+}
+
+void
+kdtrace_proc_dtor(void *arg, struct proc *p)
+{
+
+	if (p-p_dtrace != NULL) {
+		kmem_free(p-p_dtrace, KDTRACE_PROC_SIZE);
+		p-p_dtrace = NULL;
+	}
+}
+
+/* Return the DTrace thread data size compiled in the kernel hooks. */
+size_t
+kdtrace_thread_size()
+{
+
+	return(KDTRACE_THREAD_SIZE);
+}
+
+void
+kdtrace_thread_ctor(void *arg, struct lwp *l)
+{
+
+	l-l_dtrace = kmem_alloc(KDTRACE_THREAD_SIZE, KM_SLEEP);
+	memset(l-l_dtrace, 0, KDTRACE_THREAD_ZERO);
+}
+
+void
+kdtrace_thread_dtor(void *arg, struct lwp *l)
+{
+
+	if (l-l_dtrace != NULL) {
+		kmem_free(l-l_dtrace, KDTRACE_THREAD_SIZE);
+		l-l_dtrace = NULL;
+	}
+}



CVS commit: src/sys/kern

2010-02-20 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Feb 21 07:39:18 UTC 2010

Modified Files:
src/sys/kern: kern_synch.c

Log Message:
DTrace: Add __predict_false() to the DTrace hooks per rmind's suggestion.


To generate a diff of this commit:
cvs rdiff -u -r1.277 -r1.278 src/sys/kern/kern_synch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_synch.c
diff -u src/sys/kern/kern_synch.c:1.277 src/sys/kern/kern_synch.c:1.278
--- src/sys/kern/kern_synch.c:1.277	Sun Feb 21 07:01:57 2010
+++ src/sys/kern/kern_synch.c	Sun Feb 21 07:39:18 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_synch.c,v 1.277 2010/02/21 07:01:57 darran Exp $	*/
+/*	$NetBSD: kern_synch.c,v 1.278 2010/02/21 07:39:18 darran Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_synch.c,v 1.277 2010/02/21 07:01:57 darran Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_synch.c,v 1.278 2010/02/21 07:39:18 darran Exp $);
 
 #include opt_kstack.h
 #include opt_perfctrs.h
@@ -775,7 +775,7 @@
 		 * other than INACTIVE (0), then it should have set the
 		 * function to call.
 		 */
-		if (dtrace_vtime_active) {
+		if (__predict_false(dtrace_vtime_active)) {
 			(*dtrace_vtime_switch_func)(newl);
 		}
 #endif
@@ -927,7 +927,7 @@
 	 * other than INACTIVE (0), then it should have set the
 	 * function to call.
 	 */
-	if (dtrace_vtime_active) {
+	if (__predict_false(dtrace_vtime_active)) {
 		(*dtrace_vtime_switch_func)(newl);
 	}
 #endif



CVS commit: src/external/cddl/osnet/dist

2010-02-19 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sat Feb 20 04:34:48 UTC 2010

Update of /cvsroot/src/external/cddl/osnet/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv22077

Log Message:
Import the rest of Opensolaris 20081117 needed for DTrace. No conflicts
with ZFS.


Status:

Vendor Tag: sun
Release Tags:   osnet-20081117

U src/external/cddl/osnet/dist/cmd/zdb/zdb_il.c
U src/external/cddl/osnet/dist/cmd/zdb/zdb.c
U src/external/cddl/osnet/dist/cmd/zfs/zfs_iter.c
U src/external/cddl/osnet/dist/cmd/zfs/zfs_iter.h
U src/external/cddl/osnet/dist/cmd/zfs/zfs_main.c
U src/external/cddl/osnet/dist/cmd/zfs/zfs_util.h
U src/external/cddl/osnet/dist/cmd/zpool/zpool_iter.c
U src/external/cddl/osnet/dist/cmd/zpool/zpool_main.c
U src/external/cddl/osnet/dist/cmd/zpool/zpool_util.c
U src/external/cddl/osnet/dist/cmd/zpool/zpool_util.h
U src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c
U src/external/cddl/osnet/dist/cmd/ztest/ztest.c
N src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c
N src/external/cddl/osnet/dist/cmd/dtrace/dtrace.1
U src/external/cddl/osnet/dist/lib/libefi/common/crc32_efi.c
U src/external/cddl/osnet/dist/lib/libnvpair/libnvpair.c
U src/external/cddl/osnet/dist/lib/libnvpair/libnvpair.h
U src/external/cddl/osnet/dist/lib/libnvpair/nvpair_alloc_system.c
U src/external/cddl/osnet/dist/lib/libshare/common/libshare.h
U src/external/cddl/osnet/dist/lib/libuutil/common/uu_strtoint.c
U src/external/cddl/osnet/dist/lib/libuutil/common/libuutil_common.h
U src/external/cddl/osnet/dist/lib/libuutil/common/libuutil_impl.h
U src/external/cddl/osnet/dist/lib/libuutil/common/uu_alloc.c
U src/external/cddl/osnet/dist/lib/libuutil/common/uu_avl.c
U src/external/cddl/osnet/dist/lib/libuutil/common/uu_dprintf.c
U src/external/cddl/osnet/dist/lib/libuutil/common/uu_ident.c
U src/external/cddl/osnet/dist/lib/libuutil/common/uu_list.c
U src/external/cddl/osnet/dist/lib/libuutil/common/uu_misc.c
U src/external/cddl/osnet/dist/lib/libuutil/common/uu_open.c
U src/external/cddl/osnet/dist/lib/libuutil/common/uu_pname.c
U src/external/cddl/osnet/dist/lib/libuutil/common/libuutil.h
U src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c
U src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_changelist.c
U src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_config.c
U src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_dataset.c
U src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_graph.c
U src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_impl.h
U src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c
U src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_mount.c
U src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c
U src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_sendrecv.c
U src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_status.c
U src/external/cddl/osnet/dist/lib/libzfs/common/libzfs.h
U src/external/cddl/osnet/dist/lib/libzpool/common/taskq.c
U src/external/cddl/osnet/dist/lib/libzpool/common/util.c
N src/external/cddl/osnet/dist/lib/libctf/common/ctf_lib.c
N src/external/cddl/osnet/dist/lib/libctf/common/ctf_subr.c
N src/external/cddl/osnet/dist/lib/libctf/common/libctf.h
N src/external/cddl/osnet/dist/lib/libdtrace/common/mknames.sh
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_aggregate.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/drti.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_consume.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_as.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_as.h
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_buf.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_buf.h
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_cc.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_cg.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_provider.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_decl.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_decl.h
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_dis.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_dof.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_dof.h
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_error.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_errtags.h
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_grammar.y
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_handle.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_ident.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_ident.h
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_inttab.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_inttab.h
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_lex.l
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c
N src/external/cddl/osnet/dist/lib/libdtrace/common/dt_list.c
N 

CVS commit: src/external/bsd/libdwarf/dist

2009-12-22 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Wed Dec 23 00:03:27 UTC 2009

Update of /cvsroot/src/external/bsd/libdwarf/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv19059

Log Message:
Import libdwarf from FreeBSD 8.0-RC1.
ok t...@.

Status:

Vendor Tag: FreeBSD
Release Tags:   FreeBSD-8-0-RC1

N src/external/bsd/libdwarf/dist/Makefile
N src/external/bsd/libdwarf/dist/dwarf_loc.c
N src/external/bsd/libdwarf/dist/dwarf_init.c
N src/external/bsd/libdwarf/dist/dwarf_form.c
N src/external/bsd/libdwarf/dist/dwarf_finish.c
N src/external/bsd/libdwarf/dist/dwarf_errno.c
N src/external/bsd/libdwarf/dist/dwarf_errmsg.c
N src/external/bsd/libdwarf/dist/dwarf_dump.c
N src/external/bsd/libdwarf/dist/dwarf_die.c
N src/external/bsd/libdwarf/dist/dwarf_dealloc.c
N src/external/bsd/libdwarf/dist/dwarf_cu.c
N src/external/bsd/libdwarf/dist/dwarf_attrval.c
N src/external/bsd/libdwarf/dist/dwarf_attr.c
N src/external/bsd/libdwarf/dist/dwarf_abbrev.c
N src/external/bsd/libdwarf/dist/dwarf.h
N src/external/bsd/libdwarf/dist/_libdwarf.h
N src/external/bsd/libdwarf/dist/libdwarf.h

No conflicts created by this import



CVS commit: src/external/bsd/libdwarf

2009-12-22 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Wed Dec 23 00:06:54 UTC 2009

Added Files:
src/external/bsd/libdwarf: prepare-import.sh

Log Message:
Add a script to prepare libdwarf for import.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/bsd/libdwarf/prepare-import.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/external/bsd/libdwarf/prepare-import.sh
diff -u /dev/null src/external/bsd/libdwarf/prepare-import.sh:1.1
--- /dev/null	Wed Dec 23 00:06:54 2009
+++ src/external/bsd/libdwarf/prepare-import.sh	Wed Dec 23 00:06:53 2009
@@ -0,0 +1,42 @@
+#!/bin/sh
+# $NetBSD: prepare-import.sh,v 1.1 2009/12/23 00:06:53 darran Exp $
+
+# Copy the FreeBSD src/lib/libdwarf directory contents to dist.  Run
+# this script and you're done.
+#
+# lib/ is built as SUBDIR from external/lib/Makefile.
+#
+# Use the following template to import
+#  cvs import src/external/bsd/libdwarf/dist FreeBSD FreeBSD-X-Y-Z
+#
+# don't forget to bump the lib/shlib_version if necessary
+#
+
+set -e
+
+echo Adding RCS tags ..
+for f in $(grep -RL '\$NetBSD.*\$' dist | grep -v CVS); do
+case $f in
+*.[ch] | *.m4)
+	cat -  ${f}_tmp - EOF
+		/*	\$NetBSD\$	*/
+
+	EOF
+	sed -e 's,^__FBSDID.*,\/\*  \*\/\
+__RCSID\(\\$NetBSD\$\\)\;,g' ${f}  ${f}_tmp
+	mv ${f}_tmp ${f}
+	;;
+*.[0-9])
+	cat - ${f}  ${f}_tmp - EOF
+		.\	\$NetBSD\$
+		.\
+	EOF
+	mv ${f}_tmp ${f}
+	;;
+*)
+	echo No RCS tag added to ${f}
+	;;
+esac
+done
+
+echo prepare-import done



CVS commit: src/external/bsd/libdwarf

2009-12-22 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Wed Dec 23 00:10:15 UTC 2009

Added Files:
src/external/bsd/libdwarf: Makefile Makefile.inc
src/external/bsd/libdwarf/lib: Makefile shlib_version

Log Message:
Add build glue.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/bsd/libdwarf/Makefile \
src/external/bsd/libdwarf/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/external/bsd/libdwarf/lib/Makefile \
src/external/bsd/libdwarf/lib/shlib_version

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/external/bsd/libdwarf/Makefile
diff -u /dev/null src/external/bsd/libdwarf/Makefile:1.1
--- /dev/null	Wed Dec 23 00:10:15 2009
+++ src/external/bsd/libdwarf/Makefile	Wed Dec 23 00:10:15 2009
@@ -0,0 +1,5 @@
+#	$NetBSD: Makefile,v 1.1 2009/12/23 00:10:15 darran Exp $
+
+SUBDIR=		lib
+
+.include bsd.subdir.mk
Index: src/external/bsd/libdwarf/Makefile.inc
diff -u /dev/null src/external/bsd/libdwarf/Makefile.inc:1.1
--- /dev/null	Wed Dec 23 00:10:15 2009
+++ src/external/bsd/libdwarf/Makefile.inc	Wed Dec 23 00:10:15 2009
@@ -0,0 +1,11 @@
+#	$NetBSD: Makefile.inc,v 1.1 2009/12/23 00:10:15 darran Exp $
+
+.include bsd.own.mk
+
+LIBDWARF_DIR=	${NETBSDSRCDIR}/external/bsd/libdwarf/dist
+
+CPPFLAGS+=	-I${LIBDWARF_DIR}
+
+WARNS?=		4
+
+.PATH:		${LIBDWARF_DIR}

Index: src/external/bsd/libdwarf/lib/Makefile
diff -u /dev/null src/external/bsd/libdwarf/lib/Makefile:1.1
--- /dev/null	Wed Dec 23 00:10:15 2009
+++ src/external/bsd/libdwarf/lib/Makefile	Wed Dec 23 00:10:15 2009
@@ -0,0 +1,28 @@
+#	$NetBSD: Makefile,v 1.1 2009/12/23 00:10:15 darran Exp $
+
+.include bsd.init.mk
+
+LIB=	dwarf
+
+SRCS=	dwarf_abbrev.c		\
+	dwarf_attr.c		\
+	dwarf_attrval.c		\
+	dwarf_cu.c		\
+	dwarf_dealloc.c		\
+	dwarf_die.c		\
+	dwarf_dump.c		\
+	dwarf_errmsg.c		\
+	dwarf_errno.c		\
+	dwarf_finish.c		\
+	dwarf_form.c		\
+	dwarf_init.c		\
+	dwarf_loc.c
+
+INCS=		dwarf.h libdwarf.h
+INCSDIR=	/usr/include
+
+CPPFLAGS+=	-I${.CURDIR}
+
+WITHOUT_MAN=	yes
+
+.include bsd.lib.mk
Index: src/external/bsd/libdwarf/lib/shlib_version
diff -u /dev/null src/external/bsd/libdwarf/lib/shlib_version:1.1
--- /dev/null	Wed Dec 23 00:10:15 2009
+++ src/external/bsd/libdwarf/lib/shlib_version	Wed Dec 23 00:10:15 2009
@@ -0,0 +1,6 @@
+#	$NetBSD: shlib_version,v 1.1 2009/12/23 00:10:15 darran Exp $
+#	Remember to update distrib/sets/lists/base/shl.* when changing
+#
+
+major=0
+minor=0



CVS commit: src/external/bsd/libdwarf/dist

2009-12-22 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Wed Dec 23 00:11:30 UTC 2009

Modified Files:
src/external/bsd/libdwarf/dist: _libdwarf.h

Log Message:
while (0) - while (/*CONSTCOND*/0)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/libdwarf/dist/_libdwarf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libdwarf/dist/_libdwarf.h
diff -u src/external/bsd/libdwarf/dist/_libdwarf.h:1.1.1.1 src/external/bsd/libdwarf/dist/_libdwarf.h:1.2
--- src/external/bsd/libdwarf/dist/_libdwarf.h:1.1.1.1	Wed Dec 23 00:03:27 2009
+++ src/external/bsd/libdwarf/dist/_libdwarf.h	Wed Dec 23 00:11:30 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: _libdwarf.h,v 1.1.1.1 2009/12/23 00:03:27 darran Exp $	*/
+/*	$NetBSD: _libdwarf.h,v 1.2 2009/12/23 00:11:30 darran Exp $	*/
 
 /*-
  * Copyright (c) 2007 John Birrell (j...@freebsd.org)
@@ -66,7 +66,7 @@
 	_e-err_func  = __func__;			\
 	_e-err_line  = __LINE__;			\
 	_e-err_msg[0] = '\0';\
-	} while (0)
+	} while (/*CONSTCOND*/0)
 
 #define	DWARF_SET_ELF_ERROR(_e, _err)	do { 		\
 	_e-err_error = DWARF_E_ELF;			\
@@ -74,7 +74,7 @@
 	_e-err_func  = __func__;			\
 	_e-err_line  = __LINE__;			\
 	_e-err_msg[0] = '\0';\
-	} while (0)
+	} while (/*CONSTCOND*/0)
 
 struct _Dwarf_AttrValue {
 	uint64_t	av_attrib;	/* DW_AT_ */



CVS commit: src/external/bsd/libdwarf/dist

2009-12-22 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Wed Dec 23 00:12:57 UTC 2009

Modified Files:
src/external/bsd/libdwarf/dist: dwarf_init.c

Log Message:
Fix a signed vrs unsigned cast.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/libdwarf/dist/dwarf_init.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libdwarf/dist/dwarf_init.c
diff -u src/external/bsd/libdwarf/dist/dwarf_init.c:1.1.1.1 src/external/bsd/libdwarf/dist/dwarf_init.c:1.2
--- src/external/bsd/libdwarf/dist/dwarf_init.c:1.1.1.1	Wed Dec 23 00:03:22 2009
+++ src/external/bsd/libdwarf/dist/dwarf_init.c	Wed Dec 23 00:12:57 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwarf_init.c,v 1.1.1.1 2009/12/23 00:03:22 darran Exp $	*/
+/*	$NetBSD: dwarf_init.c,v 1.2 2009/12/23 00:12:57 darran Exp $	*/
 
 /*-
  * Copyright (c) 2007 John Birrell (j...@freebsd.org)
@@ -247,7 +247,7 @@
 {
 	uint8_t *ret;
 
-	uint8_t *src = (char *) (*dp)-d_buf + *offsetp;
+	uint8_t *src = (uint8_t *) (*dp)-d_buf + *offsetp;
 
 	ret = src;
 



CVS commit: src/external/lib

2009-12-22 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Wed Dec 23 00:17:41 UTC 2009

Modified Files:
src/external/lib: Makefile

Log Message:
Add libdwarf to the build.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/lib/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/lib/Makefile
diff -u src/external/lib/Makefile:1.14 src/external/lib/Makefile:1.15
--- src/external/lib/Makefile:1.14	Sun Dec 20 05:52:41 2009
+++ src/external/lib/Makefile	Wed Dec 23 00:17:40 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.14 2009/12/20 05:52:41 thorpej Exp $
+#	$NetBSD: Makefile,v 1.15 2009/12/23 00:17:40 darran Exp $
 
 #
 # This Makefile exists to provide a single point to build
@@ -32,6 +32,7 @@
 SUBDIR+= ../bsd/libarchive/lib
 SUBDIR+= ../bsd/libevent/lib
 SUBDIR+= ../bsd/libelf/lib
+SUBDIR+= ../bsd/libdwarf/lib
 SUBDIR+= ../bsd/am-utils/lib
 SUBDIR+= ../bsd/bind/lib
 SUBDIR+= ../bsd/file/lib



CVS commit: src/distrib/sets/lists

2009-12-22 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Wed Dec 23 00:33:26 UTC 2009

Modified Files:
src/distrib/sets/lists/base: shl.elf shl.mi
src/distrib/sets/lists/comp: mi shl.mi

Log Message:
Add libdwarf files.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/distrib/sets/lists/base/shl.elf
cvs rdiff -u -r1.508 -r1.509 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.1352 -r1.1353 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.95 -r1.96 src/distrib/sets/lists/comp/shl.mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/base/shl.elf
diff -u src/distrib/sets/lists/base/shl.elf:1.194 src/distrib/sets/lists/base/shl.elf:1.195
--- src/distrib/sets/lists/base/shl.elf:1.194	Sun Dec 20 05:53:34 2009
+++ src/distrib/sets/lists/base/shl.elf	Wed Dec 23 00:33:25 2009
@@ -1,4 +1,4 @@
-# $NetBSD: shl.elf,v 1.194 2009/12/20 05:53:34 thorpej Exp $
+# $NetBSD: shl.elf,v 1.195 2009/12/23 00:33:25 darran Exp $
 #
 # Note:	Do not mark old major and major.minor shared libraries as
 #	obsolete; just remove the entry, as third-party applications
@@ -124,6 +124,8 @@
 ./usr/lib/libdns.so.5base-bind-shlib
 ./usr/lib/libdns_sd.sobase-mdns-shlib		mdns
 ./usr/lib/libdns_sd.so.0			base-mdns-shlib		mdns
+./usr/lib/libdwarf.sobase-sys-shlib
+./usr/lib/libdwarf.so.0base-sys-shlib
 ./usr/lib/libedit.sobase-sys-shlib
 ./usr/lib/libedit.so.3base-sys-shlib
 ./usr/lib/libelf.sobase-sys-shlib

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.508 src/distrib/sets/lists/base/shl.mi:1.509
--- src/distrib/sets/lists/base/shl.mi:1.508	Sun Dec 20 05:53:34 2009
+++ src/distrib/sets/lists/base/shl.mi	Wed Dec 23 00:33:25 2009
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.508 2009/12/20 05:53:34 thorpej Exp $
+# $NetBSD: shl.mi,v 1.509 2009/12/23 00:33:25 darran Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -70,6 +70,7 @@
 ./usr/lib/libdevmapper.so.1.0			base-lvm-shlib		lvm
 ./usr/lib/libdns.so.5.0base-bind-shlib
 ./usr/lib/libdns_sd.so.0.0			base-mdns-shlib		mdns
+./usr/lib/libdwarf.so.0.0			base-sys-shlib
 ./usr/lib/libedit.so.3.0			base-sys-shlib
 ./usr/lib/libelf.so.0.0base-sys-shlib
 ./usr/lib/libevent.so.3.2			base-sys-shlib

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1352 src/distrib/sets/lists/comp/mi:1.1353
--- src/distrib/sets/lists/comp/mi:1.1352	Tue Dec 22 13:38:40 2009
+++ src/distrib/sets/lists/comp/mi	Wed Dec 23 00:33:25 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1352 2009/12/22 13:38:40 jmmv Exp $
+#	$NetBSD: mi,v 1.1353 2009/12/23 00:33:25 darran Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -613,6 +613,7 @@
 ./usr/include/disktab.hcomp-c-include
 ./usr/include/dlfcn.hcomp-c-include
 ./usr/include/dns_sd.hcomp-mdns-include	mdns
+./usr/include/dwarf.hcomp-c-include
 ./usr/include/elf.hcomp-c-include
 ./usr/include/err.hcomp-c-include
 ./usr/include/errno.hcomp-c-include
@@ -1375,6 +1376,7 @@
 ./usr/include/ldap_features.h			comp-ldap-include	ldap
 ./usr/include/ldap_schema.h			comp-ldap-include	ldap
 ./usr/include/ldap_utf8.h			comp-ldap-include	ldap
+./usr/include/libdwarf.h			comp-c-include
 ./usr/include/libelf.hcomp-c-include
 ./usr/include/libgen.hcomp-c-include
 ./usr/include/libintl.hcomp-c-include
@@ -2364,6 +2366,9 @@
 ./usr/lib/libdns_sd.acomp-mdns-lib		mdns
 ./usr/lib/libdns_sd_g.a-unknown-		debuglib,mdns
 ./usr/lib/libdns_sd_p.acomp-mdns-proflib	profile,mdns
+./usr/lib/libdwarf.acomp-c-lib
+./usr/lib/libdwarf_g.a-unknown-		debuglib
+./usr/lib/libdwarf_p.acomp-c-proflib		profile
 ./usr/lib/libedit.acomp-c-lib
 ./usr/lib/libedit_g.a-unknown-		debuglib
 ./usr/lib/libedit_p.acomp-c-proflib		profile

Index: src/distrib/sets/lists/comp/shl.mi
diff -u src/distrib/sets/lists/comp/shl.mi:1.95 src/distrib/sets/lists/comp/shl.mi:1.96
--- src/distrib/sets/lists/comp/shl.mi:1.95	Sun Dec 20 05:53:35 2009
+++ src/distrib/sets/lists/comp/shl.mi	Wed Dec 23 00:33:26 2009
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.95 2009/12/20 05:53:35 thorpej Exp $
+# $NetBSD: shl.mi,v 1.96 2009/12/23 00:33:26 darran Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -24,6 +24,7 @@
 ./usr/lib/libdevmapper_pic.a			comp-lvm-piclib		lvm
 ./usr/lib/libdns_pic.acomp-bind-piclib
 ./usr/lib/libdns_sd_pic.a			comp-mdns-piclib	mdns
+./usr/lib/libdwarf_pic.a			comp-c-piclib
 ./usr/lib/libedit_pic.acomp-c-piclib
 ./usr/lib/libelf_pic.acomp-c-piclib
 ./usr/lib/libevent_pic.a			comp-c-piclib



CVS commit: src/doc

2009-06-07 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Sun Jun  7 22:52:50 UTC 2009

Modified Files:
src/doc: CHANGES

Log Message:
mention agr(4) vlan changes.


To generate a diff of this commit:
cvs rdiff -u -r1.1236 -r1.1237 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1236 src/doc/CHANGES:1.1237
--- src/doc/CHANGES:1.1236	Thu May 28 17:35:22 2009
+++ src/doc/CHANGES	Sun Jun  7 22:52:50 2009
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1236 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1237 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -288,3 +288,5 @@
 	kernel: File descriptor access performance improvements.
 		[ad 20090524]
 	rumpnet: Add IPv6 support [pooka 20090527]
+	agr(4): Add support for layering vlans on top. Also allow LACP
+		to be disabled. [darran 20090529]



CVS commit: src/sys/net

2009-04-01 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Wed Apr  1 22:56:59 UTC 2009

Modified Files:
src/sys/net: if_vlan.c

Log Message:
Also inherit the parent's TCP segmentation offload capability.
Note the vlan interface does not see updates to the parents capabilities
so if, for example, TSO is on in both, then turned off in the parent it
will remain on in the vlan interface.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/net/if_vlan.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.62 src/sys/net/if_vlan.c:1.63
--- src/sys/net/if_vlan.c:1.62	Wed Dec 17 20:51:37 2008
+++ src/sys/net/if_vlan.c	Wed Apr  1 22:56:59 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.62 2008/12/17 20:51:37 cegger Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.63 2009/04/01 22:56:59 darran Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_vlan.c,v 1.62 2008/12/17 20:51:37 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_vlan.c,v 1.63 2009/04/01 22:56:59 darran Exp $);
 
 #include opt_inet.h
 #include bpfilter.h
@@ -316,11 +316,13 @@
 		/*
 		 * If the parent interface can do hardware-assisted
 		 * VLAN encapsulation, then propagate its hardware-
-		 * assisted checksumming flags.
+		 * assisted checksumming flags and tcp segmentation
+		 * offload.
 		 */
 		if (ec-ec_capabilities  ETHERCAP_VLAN_HWTAGGING)
 			ifp-if_capabilities = p-if_capabilities 
-			(IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_IPv4_Rx|
+			(IFCAP_TSOv4 |
+			 IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_IPv4_Rx|
 			 IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_TCPv4_Rx|
 			 IFCAP_CSUM_UDPv4_Tx|IFCAP_CSUM_UDPv4_Rx|
 			 IFCAP_CSUM_TCPv6_Tx|IFCAP_CSUM_TCPv6_Rx|