svn commit: r250589 - in user/adrian/net80211_tx: . bin/dd bin/ed bin/sh cddl/contrib/opensolaris/cmd/dtrace cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering cddl/contrib/opensolaris/c...
Adrian Chadd
adrian at FreeBSD.org
Mon May 13 04:47:31 UTC 2013
Author: adrian
Date: Mon May 13 04:47:26 2013
New Revision: 250589
URL: http://svnweb.freebsd.org/changeset/base/250589
Log:
Merge from HEAD.
Added:
user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal.ksh
- copied unchanged from r250588, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal.ksh
user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal2.ksh
- copied unchanged from r250588, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal2.ksh
user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal3.d
- copied unchanged from r250588, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal3.d
user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pq.c
- copied unchanged from r250588, head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pq.c
user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pq.h
- copied unchanged from r250588, head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pq.h
user/adrian/net80211_tx/sys/boot/fdt/dts/beaglebone-black.dts
- copied unchanged from r250588, head/sys/boot/fdt/dts/beaglebone-black.dts
user/adrian/net80211_tx/sys/kern/subr_pctrie.c
- copied unchanged from r250588, head/sys/kern/subr_pctrie.c
user/adrian/net80211_tx/sys/sys/_pctrie.h
- copied unchanged from r250588, head/sys/sys/_pctrie.h
user/adrian/net80211_tx/sys/sys/pctrie.h
- copied unchanged from r250588, head/sys/sys/pctrie.h
user/adrian/net80211_tx/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.3
- copied unchanged from r250425, head/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.3
Deleted:
user/adrian/net80211_tx/sys/amd64/compile/.cvsignore
user/adrian/net80211_tx/sys/amd64/conf/.cvsignore
user/adrian/net80211_tx/sys/arm/compile/.cvsignore
user/adrian/net80211_tx/sys/arm/conf/.cvsignore
user/adrian/net80211_tx/sys/i386/compile/.cvsignore
user/adrian/net80211_tx/sys/i386/conf/.cvsignore
user/adrian/net80211_tx/sys/ia64/compile/.cvsignore
user/adrian/net80211_tx/sys/ia64/conf/.cvsignore
user/adrian/net80211_tx/sys/mips/compile/.cvsignore
user/adrian/net80211_tx/sys/mips/conf/.cvsignore
user/adrian/net80211_tx/sys/pc98/compile/.cvsignore
user/adrian/net80211_tx/sys/pc98/conf/.cvsignore
user/adrian/net80211_tx/sys/powerpc/compile/.cvsignore
user/adrian/net80211_tx/sys/powerpc/conf/.cvsignore
user/adrian/net80211_tx/sys/sparc64/compile/.cvsignore
user/adrian/net80211_tx/sys/sparc64/conf/.cvsignore
user/adrian/net80211_tx/tools/regression/geom_uzip/.cvsignore
user/adrian/net80211_tx/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.8
user/adrian/net80211_tx/usr.sbin/makefs/compat/
user/adrian/net80211_tx/usr.sbin/makefs/getid.c
Modified:
user/adrian/net80211_tx/Makefile.inc1
user/adrian/net80211_tx/UPDATING
user/adrian/net80211_tx/bin/dd/args.c
user/adrian/net80211_tx/bin/dd/conv_tab.c
user/adrian/net80211_tx/bin/dd/dd.c
user/adrian/net80211_tx/bin/dd/extern.h
user/adrian/net80211_tx/bin/dd/misc.c
user/adrian/net80211_tx/bin/dd/position.c
user/adrian/net80211_tx/bin/ed/ed.1
user/adrian/net80211_tx/bin/sh/memalloc.c
user/adrian/net80211_tx/bin/sh/memalloc.h
user/adrian/net80211_tx/bin/sh/var.c
user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.fill1.d
user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d
user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c
user/adrian/net80211_tx/cddl/lib/libdtrace/Makefile
user/adrian/net80211_tx/contrib/gcc/ChangeLog.gcc43
user/adrian/net80211_tx/contrib/gcc/c-lex.c
user/adrian/net80211_tx/contrib/gcclibs/libcpp/expr.c
user/adrian/net80211_tx/contrib/gcclibs/libcpp/include/cpplib.h
user/adrian/net80211_tx/etc/periodic/daily/Makefile
user/adrian/net80211_tx/etc/protocols
user/adrian/net80211_tx/lib/libc/gen/posix_spawn_file_actions_addopen.3
user/adrian/net80211_tx/lib/libc/gen/wordexp.c
user/adrian/net80211_tx/lib/libc/posix1e/acl_is_trivial_np.3
user/adrian/net80211_tx/lib/libradius/radius.conf.5
user/adrian/net80211_tx/lib/libtacplus/libtacplus.3
user/adrian/net80211_tx/lib/libtacplus/tacplus.conf.5
user/adrian/net80211_tx/lib/libusb/libusb20.3
user/adrian/net80211_tx/libexec/bootpd/bootptab.5
user/adrian/net80211_tx/sbin/dmesg/dmesg.8
user/adrian/net80211_tx/sbin/dmesg/dmesg.c
user/adrian/net80211_tx/sbin/hastctl/Makefile
user/adrian/net80211_tx/sbin/hastd/Makefile
user/adrian/net80211_tx/sbin/hastd/token.l
user/adrian/net80211_tx/sbin/iscontrol/iscsi.conf.5
user/adrian/net80211_tx/share/examples/ppi/ppilcd.c
user/adrian/net80211_tx/share/man/man5/freebsd-update.conf.5
user/adrian/net80211_tx/share/man/man5/mailer.conf.5
user/adrian/net80211_tx/share/man/man5/portsnap.conf.5
user/adrian/net80211_tx/share/man/man7/c99.7
user/adrian/net80211_tx/share/misc/pci_vendors
user/adrian/net80211_tx/share/syscons/fonts/iso04-wide-8x16.fnt
user/adrian/net80211_tx/share/syscons/fonts/iso05-8x16.fnt
user/adrian/net80211_tx/sys/amd64/amd64/fpu.c
user/adrian/net80211_tx/sys/amd64/amd64/genassym.c
user/adrian/net80211_tx/sys/amd64/amd64/identcpu.c
user/adrian/net80211_tx/sys/amd64/amd64/machdep.c
user/adrian/net80211_tx/sys/amd64/ia32/ia32_signal.c
user/adrian/net80211_tx/sys/amd64/include/pcb.h
user/adrian/net80211_tx/sys/amd64/linux32/linux32_machdep.c
user/adrian/net80211_tx/sys/amd64/linux32/linux32_sysvec.c
user/adrian/net80211_tx/sys/amd64/vmm/io/vlapic.c
user/adrian/net80211_tx/sys/amd64/vmm/vmm_dev.c
user/adrian/net80211_tx/sys/amd64/vmm/vmm_stat.c
user/adrian/net80211_tx/sys/amd64/vmm/vmm_stat.h
user/adrian/net80211_tx/sys/arm/arm/stack_machdep.c
user/adrian/net80211_tx/sys/boot/fdt/dts/am335x.dtsi
user/adrian/net80211_tx/sys/boot/fdt/dts/beaglebone.dts
user/adrian/net80211_tx/sys/cam/ata/ata_da.c
user/adrian/net80211_tx/sys/cam/ata/ata_pmp.c
user/adrian/net80211_tx/sys/cam/ctl/scsi_ctl.c
user/adrian/net80211_tx/sys/cam/scsi/scsi_da.c
user/adrian/net80211_tx/sys/cam/scsi/scsi_pt.c
user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h
user/adrian/net80211_tx/sys/cddl/dev/dtrace/dtrace_ioctl.c
user/adrian/net80211_tx/sys/conf/files
user/adrian/net80211_tx/sys/conf/options
user/adrian/net80211_tx/sys/contrib/octeon-sdk/cvmx-app-init.h
user/adrian/net80211_tx/sys/contrib/octeon-sdk/cvmx-helper-board.c
user/adrian/net80211_tx/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c
user/adrian/net80211_tx/sys/contrib/octeon-sdk/cvmx-mgmt-port.c
user/adrian/net80211_tx/sys/contrib/octeon-sdk/cvmx-pcie.c
user/adrian/net80211_tx/sys/contrib/octeon-sdk/cvmx-rtc.h
user/adrian/net80211_tx/sys/dev/aic7xxx/aic7xxx.h
user/adrian/net80211_tx/sys/dev/ata/ata-lowlevel.c
user/adrian/net80211_tx/sys/dev/ath/if_ath.c
user/adrian/net80211_tx/sys/dev/ath/if_ath_tx_edma.c
user/adrian/net80211_tx/sys/dev/cp/if_cp.c
user/adrian/net80211_tx/sys/dev/ctau/if_ct.c
user/adrian/net80211_tx/sys/dev/cx/csigma.c
user/adrian/net80211_tx/sys/dev/cx/if_cx.c
user/adrian/net80211_tx/sys/dev/e1000/if_em.c
user/adrian/net80211_tx/sys/dev/e1000/if_em.h
user/adrian/net80211_tx/sys/dev/e1000/if_lem.c
user/adrian/net80211_tx/sys/dev/e1000/if_lem.h
user/adrian/net80211_tx/sys/dev/hptmv/entry.c
user/adrian/net80211_tx/sys/dev/isci/scil/scif_sas_domain.c
user/adrian/net80211_tx/sys/dev/netmap/netmap_mem2.c
user/adrian/net80211_tx/sys/dev/nsp/nsp.c
user/adrian/net80211_tx/sys/dev/pci/pci.c
user/adrian/net80211_tx/sys/dev/sfxge/common/efx_mcdi.c
user/adrian/net80211_tx/sys/dev/sn/if_sn.c
user/adrian/net80211_tx/sys/dev/stg/tmc18c30.c
user/adrian/net80211_tx/sys/dev/uart/uart_core.c
user/adrian/net80211_tx/sys/dev/usb/serial/usb_serial.c
user/adrian/net80211_tx/sys/dev/usb/serial/usb_serial.h
user/adrian/net80211_tx/sys/fs/fdescfs/fdesc_vnops.c
user/adrian/net80211_tx/sys/fs/nfsclient/nfs_clvnops.c
user/adrian/net80211_tx/sys/fs/nullfs/null.h
user/adrian/net80211_tx/sys/fs/nullfs/null_subr.c
user/adrian/net80211_tx/sys/fs/nullfs/null_vfsops.c
user/adrian/net80211_tx/sys/fs/nullfs/null_vnops.c
user/adrian/net80211_tx/sys/kern/kern_lock.c
user/adrian/net80211_tx/sys/kern/subr_witness.c
user/adrian/net80211_tx/sys/kern/uipc_syscalls.c
user/adrian/net80211_tx/sys/kern/uipc_usrreq.c
user/adrian/net80211_tx/sys/kern/vfs_subr.c
user/adrian/net80211_tx/sys/kern/vfs_syscalls.c
user/adrian/net80211_tx/sys/mips/conf/OCTEON1
user/adrian/net80211_tx/sys/mips/conf/ROUTERSTATION.hints
user/adrian/net80211_tx/sys/mips/mips/bus_space_fdt.c
user/adrian/net80211_tx/sys/mips/mips/bus_space_generic.c
user/adrian/net80211_tx/sys/mips/mips/stack_machdep.c
user/adrian/net80211_tx/sys/net/if_gre.c
user/adrian/net80211_tx/sys/net80211/ieee80211_ht.c
user/adrian/net80211_tx/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c
user/adrian/net80211_tx/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c
user/adrian/net80211_tx/sys/netinet/if_ether.c
user/adrian/net80211_tx/sys/netinet/ip_gre.c
user/adrian/net80211_tx/sys/netinet/sctp_pcb.c
user/adrian/net80211_tx/sys/netinet6/sctp6_usrreq.c
user/adrian/net80211_tx/sys/netpfil/pf/if_pfsync.c
user/adrian/net80211_tx/sys/netpfil/pf/pf.c
user/adrian/net80211_tx/sys/netpfil/pf/pf_ioctl.c
user/adrian/net80211_tx/sys/ofed/drivers/net/mlx4/eq.c
user/adrian/net80211_tx/sys/sys/buf.h
user/adrian/net80211_tx/sys/sys/bufobj.h
user/adrian/net80211_tx/sys/sys/lock.h
user/adrian/net80211_tx/sys/sys/lockmgr.h
user/adrian/net80211_tx/sys/sys/mount.h
user/adrian/net80211_tx/sys/ufs/ffs/ffs_balloc.c
user/adrian/net80211_tx/sys/vm/vm_page.c
user/adrian/net80211_tx/sys/vm/vm_radix.c
user/adrian/net80211_tx/sys/vm/vm_reserv.c
user/adrian/net80211_tx/sys/vm/vm_reserv.h
user/adrian/net80211_tx/sys/x86/cpufreq/p4tcc.c
user/adrian/net80211_tx/sys/x86/x86/local_apic.c
user/adrian/net80211_tx/tools/build/mk/OptionalObsoleteFiles.inc
user/adrian/net80211_tx/tools/regression/file/dup/dup.c
user/adrian/net80211_tx/usr.bin/calendar/calendars/calendar.freebsd
user/adrian/net80211_tx/usr.bin/gcore/Makefile
user/adrian/net80211_tx/usr.bin/lockf/lockf.1
user/adrian/net80211_tx/usr.bin/lockf/lockf.c
user/adrian/net80211_tx/usr.bin/split/split.1
user/adrian/net80211_tx/usr.bin/split/split.c
user/adrian/net80211_tx/usr.bin/usbhidctl/usbhidctl.1
user/adrian/net80211_tx/usr.bin/xargs/xargs.c
user/adrian/net80211_tx/usr.sbin/arp/arp.4
user/adrian/net80211_tx/usr.sbin/bluetooth/hccontrol/link_control.c
user/adrian/net80211_tx/usr.sbin/bootparamd/bootparamd/bootparamd.8
user/adrian/net80211_tx/usr.sbin/bsdconfig/include/messages.subr
user/adrian/net80211_tx/usr.sbin/bsdconfig/share/media/any.subr
user/adrian/net80211_tx/usr.sbin/bsdconfig/share/packages/categories.subr
user/adrian/net80211_tx/usr.sbin/bsdconfig/share/packages/index.subr
user/adrian/net80211_tx/usr.sbin/bsdconfig/share/packages/packages.subr
user/adrian/net80211_tx/usr.sbin/bsdinstall/distextract/Makefile
user/adrian/net80211_tx/usr.sbin/bsdinstall/distfetch/Makefile
user/adrian/net80211_tx/usr.sbin/bsdinstall/partedit/Makefile
user/adrian/net80211_tx/usr.sbin/bsnmpd/modules/Makefile
user/adrian/net80211_tx/usr.sbin/bsnmpd/modules/snmp_hast/Makefile
user/adrian/net80211_tx/usr.sbin/ctladm/ctladm.c
user/adrian/net80211_tx/usr.sbin/dumpcis/printcis.c
user/adrian/net80211_tx/usr.sbin/freebsd-update/freebsd-update.8
user/adrian/net80211_tx/usr.sbin/makefs/Makefile
user/adrian/net80211_tx/usr.sbin/makefs/makefs.h
user/adrian/net80211_tx/usr.sbin/makefs/walk.c
user/adrian/net80211_tx/usr.sbin/mergemaster/mergemaster.sh
user/adrian/net80211_tx/usr.sbin/newsyslog/newsyslog.c
user/adrian/net80211_tx/usr.sbin/portsnap/portsnap/portsnap.8
user/adrian/net80211_tx/usr.sbin/vidcontrol/vidcontrol.c
user/adrian/net80211_tx/usr.sbin/wake/wake.8
user/adrian/net80211_tx/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c
Directory Properties:
user/adrian/net80211_tx/ (props changed)
user/adrian/net80211_tx/cddl/ (props changed)
user/adrian/net80211_tx/cddl/contrib/opensolaris/ (props changed)
user/adrian/net80211_tx/contrib/gcc/ (props changed)
user/adrian/net80211_tx/lib/libc/ (props changed)
user/adrian/net80211_tx/sbin/ (props changed)
user/adrian/net80211_tx/sys/ (props changed)
user/adrian/net80211_tx/sys/amd64/vmm/ (props changed)
user/adrian/net80211_tx/sys/boot/ (props changed)
user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/ (props changed)
user/adrian/net80211_tx/sys/conf/ (props changed)
user/adrian/net80211_tx/sys/contrib/octeon-sdk/ (props changed)
user/adrian/net80211_tx/usr.bin/calendar/ (props changed)
Modified: user/adrian/net80211_tx/Makefile.inc1
==============================================================================
--- user/adrian/net80211_tx/Makefile.inc1 Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/Makefile.inc1 Mon May 13 04:47:26 2013 (r250589)
@@ -1176,7 +1176,8 @@ _kerberos5_bootstrap_tools= \
kerberos5/lib/libroken \
kerberos5/lib/libvers \
kerberos5/tools/asn1_compile \
- kerberos5/tools/slc
+ kerberos5/tools/slc \
+ usr.bin/compile_et
.endif
# Please document (add comment) why something is in 'bootstrap-tools'.
Modified: user/adrian/net80211_tx/UPDATING
==============================================================================
--- user/adrian/net80211_tx/UPDATING Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/UPDATING Mon May 13 04:47:26 2013 (r250589)
@@ -108,7 +108,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
Due to the use of the new -l option to install(1) during build
and install, you must take care not to directly set the INSTALL
make variable in your /etc/make.conf, /etc/src.conf, or on the
- command line. If you with to use the -C flag for all installs
+ command line. If you wish to use the -C flag for all installs
you may be able to add INSTALL+=-C to /etc/make.conf or
/etc/src.conf.
Modified: user/adrian/net80211_tx/bin/dd/args.c
==============================================================================
--- user/adrian/net80211_tx/bin/dd/args.c Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/bin/dd/args.c Mon May 13 04:47:26 2013 (r250589)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
+#include <signal.h>
#include <stdlib.h>
#include <string.h>
Modified: user/adrian/net80211_tx/bin/dd/conv_tab.c
==============================================================================
--- user/adrian/net80211_tx/bin/dd/conv_tab.c Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/bin/dd/conv_tab.c Mon May 13 04:47:26 2013 (r250589)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
+#include <signal.h>
#include <stdint.h>
#include "dd.h"
Modified: user/adrian/net80211_tx/bin/dd/dd.c
==============================================================================
--- user/adrian/net80211_tx/bin/dd/dd.c Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/bin/dd/dd.c Mon May 13 04:47:26 2013 (r250589)
@@ -81,6 +81,7 @@ size_t cbsz; /* conversion block size
uintmax_t files_cnt = 1; /* # of files to copy */
const u_char *ctab; /* conversion table */
char fill_char; /* Character to fill with if defined */
+volatile sig_atomic_t need_summary;
int
main(int argc __unused, char *argv[])
@@ -89,7 +90,7 @@ main(int argc __unused, char *argv[])
jcl(argv);
setup();
- (void)signal(SIGINFO, summaryx);
+ (void)signal(SIGINFO, siginfo_handler);
(void)signal(SIGINT, terminate);
atexit(summary);
@@ -375,6 +376,9 @@ dd_in(void)
in.dbp += in.dbrcnt;
(*cfunc)();
+ if (need_summary) {
+ summary();
+ }
}
}
Modified: user/adrian/net80211_tx/bin/dd/extern.h
==============================================================================
--- user/adrian/net80211_tx/bin/dd/extern.h Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/bin/dd/extern.h Mon May 13 04:47:26 2013 (r250589)
@@ -43,7 +43,7 @@ void jcl(char **);
void pos_in(void);
void pos_out(void);
void summary(void);
-void summaryx(int);
+void siginfo_handler(int);
void terminate(int);
void unblock(void);
void unblock_close(void);
@@ -61,3 +61,4 @@ extern const u_char e2a_32V[], e2a_POSIX
extern const u_char a2ibm_32V[], a2ibm_POSIX[];
extern u_char casetab[];
extern char fill_char;
+extern volatile sig_atomic_t need_summary;
Modified: user/adrian/net80211_tx/bin/dd/misc.c
==============================================================================
--- user/adrian/net80211_tx/bin/dd/misc.c Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/bin/dd/misc.c Mon May 13 04:47:26 2013 (r250589)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <inttypes.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -57,41 +58,32 @@ summary(void)
{
struct timeval tv;
double secs;
- char buf[100];
(void)gettimeofday(&tv, NULL);
secs = tv.tv_sec + tv.tv_usec * 1e-6 - st.start;
if (secs < 1e-6)
secs = 1e-6;
- /* Use snprintf(3) so that we don't reenter stdio(3). */
- (void)snprintf(buf, sizeof(buf),
+ (void)fprintf(stderr,
"%ju+%ju records in\n%ju+%ju records out\n",
st.in_full, st.in_part, st.out_full, st.out_part);
- (void)write(STDERR_FILENO, buf, strlen(buf));
- if (st.swab) {
- (void)snprintf(buf, sizeof(buf), "%ju odd length swab %s\n",
+ if (st.swab)
+ (void)fprintf(stderr, "%ju odd length swab %s\n",
st.swab, (st.swab == 1) ? "block" : "blocks");
- (void)write(STDERR_FILENO, buf, strlen(buf));
- }
- if (st.trunc) {
- (void)snprintf(buf, sizeof(buf), "%ju truncated %s\n",
+ if (st.trunc)
+ (void)fprintf(stderr, "%ju truncated %s\n",
st.trunc, (st.trunc == 1) ? "block" : "blocks");
- (void)write(STDERR_FILENO, buf, strlen(buf));
- }
- (void)snprintf(buf, sizeof(buf),
+ (void)fprintf(stderr,
"%ju bytes transferred in %.6f secs (%.0f bytes/sec)\n",
st.bytes, secs, st.bytes / secs);
- (void)write(STDERR_FILENO, buf, strlen(buf));
+ need_summary = 0;
}
/* ARGSUSED */
void
-summaryx(int notused __unused)
+siginfo_handler(int signo __unused)
{
- int save_errno = errno;
- summary();
- errno = save_errno;
+ need_summary = 1;
}
/* ARGSUSED */
Modified: user/adrian/net80211_tx/bin/dd/position.c
==============================================================================
--- user/adrian/net80211_tx/bin/dd/position.c Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/bin/dd/position.c Mon May 13 04:47:26 2013 (r250589)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <inttypes.h>
+#include <signal.h>
#include <unistd.h>
#include "dd.h"
@@ -91,6 +92,8 @@ pos_in(void)
}
} else
--cnt;
+ if (need_summary)
+ summary();
continue;
}
Modified: user/adrian/net80211_tx/bin/ed/ed.1
==============================================================================
--- user/adrian/net80211_tx/bin/ed/ed.1 Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/bin/ed/ed.1 Mon May 13 04:47:26 2013 (r250589)
@@ -914,9 +914,9 @@ that line.
.El
.Sh FILES
.Bl -tag -width /tmp/ed.* -compact
-.It /tmp/ed.*
+.It Pa /tmp/ed.*
buffer file
-.It ed.hup
+.It Pa ed.hup
the file to which
.Nm
attempts to write the buffer if the terminal hangs up
Modified: user/adrian/net80211_tx/bin/sh/memalloc.c
==============================================================================
--- user/adrian/net80211_tx/bin/sh/memalloc.c Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/bin/sh/memalloc.c Mon May 13 04:47:26 2013 (r250589)
@@ -124,7 +124,6 @@ struct stack_block {
#define SPACE(sp) ((char*)(sp) + ALIGN(sizeof(struct stack_block)))
static struct stack_block *stackp;
-static struct stackmark *markp;
char *stacknxt;
int stacknleft;
char *sstrend;
@@ -186,8 +185,9 @@ setstackmark(struct stackmark *mark)
mark->stackp = stackp;
mark->stacknxt = stacknxt;
mark->stacknleft = stacknleft;
- mark->marknext = markp;
- markp = mark;
+ /* Ensure this block stays in place. */
+ if (stackp != NULL && stacknxt == SPACE(stackp))
+ stalloc(1);
}
@@ -197,7 +197,6 @@ popstackmark(struct stackmark *mark)
struct stack_block *sp;
INTOFF;
- markp = mark->marknext;
while (stackp != mark->stackp) {
sp = stackp;
stackp = sp->prev;
@@ -229,7 +228,6 @@ growstackblock(int min)
int oldlen;
struct stack_block *sp;
struct stack_block *oldstackp;
- struct stackmark *xmark;
if (min < stacknleft)
min = stacknleft;
@@ -254,18 +252,6 @@ growstackblock(int min)
stacknxt = SPACE(sp);
stacknleft = newlen - (stacknxt - (char*)sp);
sstrend = stacknxt + stacknleft;
-
- /*
- * Stack marks pointing to the start of the old block
- * must be relocated to point to the new block
- */
- xmark = markp;
- while (xmark != NULL && xmark->stackp == oldstackp) {
- xmark->stackp = stackp;
- xmark->stacknxt = stacknxt;
- xmark->stacknleft = stacknleft;
- xmark = xmark->marknext;
- }
INTON;
} else {
newlen -= ALIGN(sizeof(struct stack_block));
Modified: user/adrian/net80211_tx/bin/sh/memalloc.h
==============================================================================
--- user/adrian/net80211_tx/bin/sh/memalloc.h Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/bin/sh/memalloc.h Mon May 13 04:47:26 2013 (r250589)
@@ -39,7 +39,6 @@ struct stackmark {
struct stack_block *stackp;
char *stacknxt;
int stacknleft;
- struct stackmark *marknext;
};
Modified: user/adrian/net80211_tx/bin/sh/var.c
==============================================================================
--- user/adrian/net80211_tx/bin/sh/var.c Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/bin/sh/var.c Mon May 13 04:47:26 2013 (r250589)
@@ -877,7 +877,7 @@ unsetvar(const char *s)
/*
- * Returns true if the two strings specify the same varable. The first
+ * Returns true if the two strings specify the same variable. The first
* variable name is terminated by '='; the second may be terminated by
* either '=' or '\0'.
*/
@@ -898,7 +898,7 @@ varequal(const char *p, const char *q)
* Search for a variable.
* 'name' may be terminated by '=' or a NUL.
* vppp is set to the pointer to vp, or the list head if vp isn't found
- * lenp is set to the number of charactets in 'name'
+ * lenp is set to the number of characters in 'name'
*/
static struct var *
Modified: user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
==============================================================================
--- user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Mon May 13 04:47:26 2013 (r250589)
@@ -23,8 +23,9 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
#include <sys/types.h>
#include <sys/stat.h>
@@ -1409,6 +1410,7 @@ main(int argc, char *argv[])
(void) dtrace_setopt(g_dtp, "bufsize", "4m");
(void) dtrace_setopt(g_dtp, "aggsize", "4m");
#endif
+ (void) dtrace_setopt(g_dtp, "temporal", "yes");
/*
* If -G is specified, enable -xlink=dynamic and -xunodefs to permit
Modified: user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.fill1.d
==============================================================================
--- user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.fill1.d Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.fill1.d Mon May 13 04:47:26 2013 (r250589)
@@ -23,26 +23,29 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
/*
* ASSERTION:
* Positive test for fill buffer policy.
*
* SECTION: Buffers and Buffering/fill Policy;
- * Buffers and Buffering/Buffer Sizes;
+ * Buffers and Buffering/Buffer Sizes;
* Options and Tunables/bufsize;
* Options and Tunables/bufpolicy;
* Options and Tunables/statusrate
*/
/*
- * This is a brute-force way of testing fill buffers. We assume that each
- * printf() stores 8 bytes. Because each fill buffer is per-CPU, we must
- * fill up our buffer in one series of enablings on a single CPU.
+ * This is a brute-force way of testing fill buffers. We assume that
+ * each printf() stores 16 bytes (4x 32-bit words for EPID, timestamp
+ * lo, timestamp hi, and the variable i). Because each fill buffer is
+ * per-CPU, we must fill up our buffer in one series of enablings on a
+ * single CPU.
*/
#pragma D option bufpolicy=fill
-#pragma D option bufsize=64
+#pragma D option bufsize=128
#pragma D option statusrate=10ms
#pragma D option quiet
Copied: user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal.ksh (from r250588, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal.ksh)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal.ksh Mon May 13 04:47:26 2013 (r250589, copy of r250588, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal.ksh)
@@ -0,0 +1,106 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2012 by Delphix. All rights reserved.
+#
+
+############################################################################
+# ASSERTION:
+# temporal option causes output to be sorted
+#
+# SECTION: Pragma
+#
+# NOTES: The temporal option has no effect on a single-CPU system, so
+# this needs to be run on a multi-CPU system to effectively test the
+# temporal option.
+#
+############################################################################
+
+if [ $# != 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
+
+dtrace=$1
+file=/tmp/out.$$
+
+rm -f $file
+
+$dtrace -o $file -c 'sleep 3' -s /dev/stdin <<EOF
+ #pragma D option quiet
+ #pragma D option temporal
+
+ BEGIN
+ {
+ @lines = count();
+ printf("0 begin\n");
+ }
+
+ END
+ {
+ /* Bump @lines every time we print a line. */
+ @lines = count();
+ printf("%u end\n", timestamp);
+ @lines = count();
+ printa("99999999999999999 lines %@u\n", @lines);
+ }
+
+ profile-97hz
+ {
+ @lines = count();
+ printf("%u\n", timestamp);
+ }
+EOF
+
+status=$?
+if [ "$status" -ne 0 ]; then
+ echo $tst: dtrace failed
+ exit $status
+fi
+
+# dtrace outputs a blank line at the end, which will sort to the beginning,
+# so use sed to remove the blank line.
+sed '$d' $file > $file.2
+
+sort -n $file.2 | diff $file.2 -
+status=$?
+if [ "$status" -ne 0 ]; then
+ echo $tst: output is not sorted
+ exit $status
+fi
+
+head -n 1 $file.2 | grep begin >/dev/null
+status=$?
+if [ "$status" -ne 0 ]; then
+ echo $tst: begin probe did not fire
+ exit $status
+fi
+
+tail -n 2 $file.2 | grep end >/dev/null
+status=$?
+if [ "$status" -ne 0 ]; then
+ echo $tst: end probe did not fire
+ exit $status
+fi
+
+if [ $(tail -n 1 $file.2 | cut -f3 -d ' ') -ne \
+ $(wc -l $file.2) ]; then
+ echo $tst: incorrect number of lines output
+ exit 1
+fi
+
+exit $status
Copied: user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal2.ksh (from r250588, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal2.ksh)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal2.ksh Mon May 13 04:47:26 2013 (r250589, copy of r250588, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal2.ksh)
@@ -0,0 +1,102 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2012 by Delphix. All rights reserved.
+#
+
+############################################################################
+# ASSERTION:
+# temporal option causes output to be sorted, even when some
+# buffers are empty
+#
+# SECTION: Pragma
+#
+# NOTES: The temporal option has no effect on a single-CPU system, so
+# this needs to be run on a multi-CPU system to effectively test the
+# temporal option.
+#
+############################################################################
+
+if [ $# != 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
+
+dtrace=$1
+file=/tmp/out.$$
+
+rm -f $file
+
+$dtrace -o $file -s /dev/stdin <<EOF
+ #pragma D option quiet
+ #pragma D option destructive
+ #pragma D option temporal
+ #pragma D option switchrate=1000hz
+
+ /*
+ * Use two enablings of the same probe, so that cpu 0 will always
+ * record its data just a little bit before the other cpus.
+ * We don't want to use the chill() action in the same enabling
+ * that we record the timestamp, because chill() causes the
+ * timestamp to be re-read, and thus not match the timestamp
+ * which libdtrace uses to sort the records.
+ */
+
+ profile-401
+ /cpu == 0/
+ {
+ printf("%d\n", timestamp);
+ }
+
+ profile-401
+ /cpu != 0/
+ {
+ chill(1000); /* one microsecond */
+ }
+
+ profile-401
+ /cpu != 0/
+ {
+ printf("%d\n", timestamp);
+ }
+
+ tick-1s
+ /k++ == 10/
+ {
+ printf("%d\n", timestamp);
+ exit(0);
+ }
+EOF
+
+status=$?
+if [ "$status" -ne 0 ]; then
+ echo $tst: dtrace failed
+ exit $status
+fi
+
+# dtrace outputs a blank line at the end, which will sort to the beginning,
+# so use sed to remove the blank line.
+sed '$d' $file > $file.2
+
+sort -n $file.2 | diff $file.2 -
+status=$?
+if [ "$status" -ne 0 ]; then
+ echo $tst: output is not sorted
+ exit $status
+fi
+
+exit $status
Copied: user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal3.d (from r250588, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal3.d)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal3.d Mon May 13 04:47:26 2013 (r250589, copy of r250588, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal3.d)
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+/*
+ * This test excercises the "remnant" handling of the temporal option.
+ * At the end of one pass of retrieving and printing data from all CPUs,
+ * some unprocessed data will remain, because its timestamp is after the
+ * time covered by all CPUs' buffers. This unprocessed data is
+ * rearranged in a more space-efficient manner. If this is done
+ * incorrectly, an alignment error may occur. To test this, we use a
+ * high-frequency probe so that data will be recorded in subsequent
+ * CPU's buffers after the first CPU's buffer is obtained. The
+ * combination of data traced here (a 8-byte value and a 4-byte value)
+ * is effective to cause alignment problems with an incorrect
+ * implementation.
+ *
+ * This test needs to be run on a multi-CPU system to be effective.
+ */
+
+#pragma D option quiet
+#pragma D option temporal
+
+profile-4997
+{
+ printf("%u %u", 1ULL, 2);
+}
+
+tick-1
+/i++ == 10/
+{
+ exit(0);
+}
Modified: user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d
==============================================================================
--- user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d Mon May 13 04:47:26 2013 (r250589)
@@ -24,7 +24,10 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
/*
* ASSERTION:
@@ -35,17 +38,10 @@
*
* NOTES: This test behaves differently depending on the values
* assigned to bufsize.
- * 1. 0 > bufsize.
- * 2. 0 == bufsize.
- * 3. 0 < bufsize <= 7
- * 4. 8 <= bufsize <= 31
- * 5. 32 <= bufsize <= 47
- * 6. 48 <= bufsize <= 71
- * 7. 72 <= bufsize
*/
#pragma D option quiet
-#pragma D option bufsize=41
+#pragma D option bufsize=49
BEGIN
{
Modified: user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
==============================================================================
--- user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Mon May 13 02:38:05 2013 (r250588)
+++ user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Mon May 13 04:47:26 2013 (r250589)
@@ -25,7 +25,7 @@
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
*/
#include <stdlib.h>
@@ -39,6 +39,7 @@
#include <alloca.h>
#endif
#include <dt_impl.h>
+#include <dt_pq.h>
#if !defined(sun)
#include <libproc_compat.h>
#endif
@@ -443,17 +444,8 @@ dt_flowindent(dtrace_hdl_t *dtp, dtrace_
offs += epd->dtepd_size;
do {
- if (offs >= buf->dtbd_size) {
- /*
- * We're at the end -- maybe. If the oldest
- * record is non-zero, we need to wrap.
- */
- if (buf->dtbd_oldest != 0) {
- offs = 0;
- } else {
- goto out;
- }
- }
+ if (offs >= buf->dtbd_size)
+ goto out;
next = *(uint32_t *)((uintptr_t)buf->dtbd_data + offs);
@@ -2014,26 +2006,27 @@ dt_setopt(dtrace_hdl_t *dtp, const dtrac
}
static int
-dt_consume_cpu(dtrace_hdl_t *dtp, FILE *fp, int cpu, dtrace_bufdesc_t *buf,
+dt_consume_cpu(dtrace_hdl_t *dtp, FILE *fp, int cpu,
+ dtrace_bufdesc_t *buf, boolean_t just_one,
dtrace_consume_probe_f *efunc, dtrace_consume_rec_f *rfunc, void *arg)
{
dtrace_epid_t id;
- size_t offs, start = buf->dtbd_oldest, end = buf->dtbd_size;
+ size_t offs;
int flow = (dtp->dt_options[DTRACEOPT_FLOWINDENT] != DTRACEOPT_UNSET);
int quiet = (dtp->dt_options[DTRACEOPT_QUIET] != DTRACEOPT_UNSET);
int rval, i, n;
- dtrace_epid_t last = DTRACE_EPIDNONE;
uint64_t tracememsize = 0;
dtrace_probedata_t data;
uint64_t drops;
- caddr_t addr;
+ data.dtpda_flow = dtp->dt_flow;
+ data.dtpda_indent = dtp->dt_indent;
+ data.dtpda_prefix = dtp->dt_prefix;
bzero(&data, sizeof (data));
data.dtpda_handle = dtp;
data.dtpda_cpu = cpu;
-again:
- for (offs = start; offs < end; ) {
+ for (offs = buf->dtbd_oldest; offs < buf->dtbd_size; ) {
dtrace_eprobedesc_t *epd;
/*
@@ -2068,7 +2061,8 @@ again:
}
if (flow)
- (void) dt_flowindent(dtp, &data, last, buf, offs);
+ (void) dt_flowindent(dtp, &data, dtp->dt_last_epid,
+ buf, offs);
rval = (*efunc)(&data, arg);
@@ -2087,6 +2081,7 @@ again:
return (dt_set_errno(dtp, EDT_BADRVAL));
for (i = 0; i < epd->dtepd_nrecs; i++) {
+ caddr_t addr;
dtrace_recdesc_t *rec = &epd->dtepd_rec[i];
dtrace_actkind_t act = rec->dtrd_action;
@@ -2458,14 +2453,16 @@ nextrec:
rval = (*rfunc)(&data, NULL, arg);
nextepid:
offs += epd->dtepd_size;
- last = id;
+ dtp->dt_last_epid = id;
+ if (just_one) {
+ buf->dtbd_oldest = offs;
+ break;
+ }
}
- if (buf->dtbd_oldest != 0 && start == buf->dtbd_oldest) {
- end = buf->dtbd_oldest;
- start = 0;
- goto again;
- }
+ dtp->dt_flow = data.dtpda_flow;
+ dtp->dt_indent = data.dtpda_indent;
+ dtp->dt_prefix = data.dtpda_prefix;
if ((drops = buf->dtbd_drops) == 0)
return (0);
@@ -2478,6 +2475,130 @@ nextepid:
return (dt_handle_cpudrop(dtp, cpu, DTRACEDROP_PRINCIPAL, drops));
}
+/*
+ * Reduce memory usage by shrinking the buffer if it's no more than half full.
+ * Note, we need to preserve the alignment of the data at dtbd_oldest, which is
+ * only 4-byte aligned.
+ */
+static void
+dt_realloc_buf(dtrace_hdl_t *dtp, dtrace_bufdesc_t *buf, int cursize)
+{
+ uint64_t used = buf->dtbd_size - buf->dtbd_oldest;
+ if (used < cursize / 2) {
+ int misalign = buf->dtbd_oldest & (sizeof (uint64_t) - 1);
+ char *newdata = dt_alloc(dtp, used + misalign);
+ if (newdata == NULL)
+ return;
+ bzero(newdata, misalign);
+ bcopy(buf->dtbd_data + buf->dtbd_oldest,
+ newdata + misalign, used);
+ dt_free(dtp, buf->dtbd_data);
+ buf->dtbd_oldest = misalign;
+ buf->dtbd_size = used + misalign;
+ buf->dtbd_data = newdata;
+ }
+}
+
+/*
+ * If the ring buffer has wrapped, the data is not in order. Rearrange it
+ * so that it is. Note, we need to preserve the alignment of the data at
+ * dtbd_oldest, which is only 4-byte aligned.
+ */
+static int
+dt_unring_buf(dtrace_hdl_t *dtp, dtrace_bufdesc_t *buf)
+{
+ int misalign;
+ char *newdata, *ndp;
+
+ if (buf->dtbd_oldest == 0)
+ return (0);
+
+ misalign = buf->dtbd_oldest & (sizeof (uint64_t) - 1);
+ newdata = ndp = dt_alloc(dtp, buf->dtbd_size + misalign);
+
+ if (newdata == NULL)
+ return (-1);
+
+ assert(0 == (buf->dtbd_size & (sizeof (uint64_t) - 1)));
+
+ bzero(ndp, misalign);
+ ndp += misalign;
+
+ bcopy(buf->dtbd_data + buf->dtbd_oldest, ndp,
+ buf->dtbd_size - buf->dtbd_oldest);
+ ndp += buf->dtbd_size - buf->dtbd_oldest;
+
+ bcopy(buf->dtbd_data, ndp, buf->dtbd_oldest);
+
+ dt_free(dtp, buf->dtbd_data);
+ buf->dtbd_oldest = 0;
+ buf->dtbd_data = newdata;
+ buf->dtbd_size += misalign;
+
+ return (0);
+}
+
+static void
+dt_put_buf(dtrace_hdl_t *dtp, dtrace_bufdesc_t *buf)
+{
+ dt_free(dtp, buf->dtbd_data);
+ dt_free(dtp, buf);
+}
+
+/*
+ * Returns 0 on success, in which case *cbp will be filled in if we retrieved
+ * data, or NULL if there is no data for this CPU.
+ * Returns -1 on failure and sets dt_errno.
+ */
+static int
+dt_get_buf(dtrace_hdl_t *dtp, int cpu, dtrace_bufdesc_t **bufp)
+{
+ dtrace_optval_t size;
+ dtrace_bufdesc_t *buf = dt_zalloc(dtp, sizeof (*buf));
+ int error;
+
+ if (buf == NULL)
+ return (-1);
+
+ (void) dtrace_getopt(dtp, "bufsize", &size);
+ buf->dtbd_data = dt_alloc(dtp, size);
+ if (buf->dtbd_data == NULL) {
+ dt_free(dtp, buf);
+ return (-1);
+ }
+ buf->dtbd_size = size;
+ buf->dtbd_cpu = cpu;
+
+#if defined(sun)
+ if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
+#else
+ if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &buf) == -1) {
+#endif
+ dt_put_buf(dtp, buf);
+ /*
+ * If we failed with ENOENT, it may be because the
+ * CPU was unconfigured -- this is okay. Any other
+ * error, however, is unexpected.
+ */
+ if (errno == ENOENT) {
+ *bufp = NULL;
+ return (0);
+ }
+
+ return (dt_set_errno(dtp, errno));
+ }
+
+ error = dt_unring_buf(dtp, buf);
+ if (error != 0) {
+ dt_put_buf(dtp, buf);
+ return (error);
+ }
+ dt_realloc_buf(dtp, buf, size);
+
+ *bufp = buf;
+ return (0);
+}
+
typedef struct dt_begin {
dtrace_consume_probe_f *dtbgn_probefunc;
dtrace_consume_rec_f *dtbgn_recfunc;
@@ -2541,7 +2662,7 @@ dt_consume_begin_error(const dtrace_errd
}
static int
-dt_consume_begin(dtrace_hdl_t *dtp, FILE *fp, dtrace_bufdesc_t *buf,
+dt_consume_begin(dtrace_hdl_t *dtp, FILE *fp,
dtrace_consume_probe_f *pf, dtrace_consume_rec_f *rf, void *arg)
{
/*
@@ -2565,33 +2686,19 @@ dt_consume_begin(dtrace_hdl_t *dtp, FILE
* first pass, and that we only process ERROR enablings _not_ induced
* by BEGIN enablings in the second pass.
*/
+
dt_begin_t begin;
processorid_t cpu = dtp->dt_beganon;
- dtrace_bufdesc_t nbuf;
-#if !defined(sun)
- dtrace_bufdesc_t *pbuf;
-#endif
int rval, i;
static int max_ncpus;
- dtrace_optval_t size;
+ dtrace_bufdesc_t *buf;
dtp->dt_beganon = -1;
-#if defined(sun)
- if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
-#else
- if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &buf) == -1) {
-#endif
- /*
- * We really don't expect this to fail, but it is at least
- * technically possible for this to fail with ENOENT. In this
- * case, we just drive on...
- */
- if (errno == ENOENT)
- return (0);
-
- return (dt_set_errno(dtp, errno));
- }
+ if (dt_get_buf(dtp, cpu, &buf) != 0)
+ return (-1);
+ if (buf == NULL)
+ return (0);
if (!dtp->dt_stopped || buf->dtbd_cpu != dtp->dt_endedon) {
/*
@@ -2599,7 +2706,10 @@ dt_consume_begin(dtrace_hdl_t *dtp, FILE
* we are, we actually processed any END probes on another
* CPU. We can simply consume this buffer and return.
*/
- return (dt_consume_cpu(dtp, fp, cpu, buf, pf, rf, arg));
+ rval = dt_consume_cpu(dtp, fp, cpu, buf, B_FALSE,
+ pf, rf, arg);
+ dt_put_buf(dtp, buf);
+ return (rval);
}
begin.dtbgn_probefunc = pf;
@@ -2616,61 +2726,41 @@ dt_consume_begin(dtrace_hdl_t *dtp, FILE
dtp->dt_errhdlr = dt_consume_begin_error;
dtp->dt_errarg = &begin;
- rval = dt_consume_cpu(dtp, fp, cpu, buf, dt_consume_begin_probe,
- dt_consume_begin_record, &begin);
+ rval = dt_consume_cpu(dtp, fp, cpu, buf, B_FALSE,
+ dt_consume_begin_probe, dt_consume_begin_record, &begin);
dtp->dt_errhdlr = begin.dtbgn_errhdlr;
dtp->dt_errarg = begin.dtbgn_errarg;
- if (rval != 0)
+ if (rval != 0) {
+ dt_put_buf(dtp, buf);
return (rval);
-
- /*
- * Now allocate a new buffer. We'll use this to deal with every other
- * CPU.
- */
- bzero(&nbuf, sizeof (dtrace_bufdesc_t));
- (void) dtrace_getopt(dtp, "bufsize", &size);
- if ((nbuf.dtbd_data = malloc(size)) == NULL)
- return (dt_set_errno(dtp, EDT_NOMEM));
+ }
if (max_ncpus == 0)
max_ncpus = dt_sysconf(dtp, _SC_CPUID_MAX) + 1;
for (i = 0; i < max_ncpus; i++) {
- nbuf.dtbd_cpu = i;
-
+ dtrace_bufdesc_t *nbuf;
if (i == cpu)
continue;
-#if defined(sun)
- if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &nbuf) == -1) {
-#else
- pbuf = &nbuf;
- if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &pbuf) == -1) {
-#endif
- /*
- * If we failed with ENOENT, it may be because the
- * CPU was unconfigured -- this is okay. Any other
- * error, however, is unexpected.
- */
- if (errno == ENOENT)
- continue;
-
- free(nbuf.dtbd_data);
-
- return (dt_set_errno(dtp, errno));
+ if (dt_get_buf(dtp, i, &nbuf) != 0) {
+ dt_put_buf(dtp, buf);
+ return (-1);
}
+ if (nbuf == NULL)
+ continue;
- if ((rval = dt_consume_cpu(dtp, fp,
- i, &nbuf, pf, rf, arg)) != 0) {
- free(nbuf.dtbd_data);
+ rval = dt_consume_cpu(dtp, fp, i, nbuf, B_FALSE,
+ pf, rf, arg);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-user
mailing list