7297 clear() on llquantize aggregation causes dtrace to exit

7298 printa() of multiple aggregations can fail for llquantize()

illumos/illumos-gate@0ddc0ebb74

Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Adam Leventhal <adam.leventhal@gmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Bryan Cantrill <bryan@joyent.com>
This commit is contained in:
Mark Johnston 2016-08-26 20:51:09 +00:00
parent 9d4cd9e2d9
commit 2e27b48e02
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/illumos/dist/; revision=304861
5 changed files with 81 additions and 8 deletions

View File

@ -0,0 +1,23 @@
/*
* 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.
*/
/*
* Copyright (c) 2016, Joyent, Inc. All rights reserved.
*/
#pragma D option quiet
BEGIN
{
@ = llquantize(0, 10, 0, 6, 20);
clear(@);
exit(0);
}

View File

@ -0,0 +1,6 @@
value ------------- Distribution ------------- count
< 1 | 0
1 | 0

View File

@ -0,0 +1,24 @@
/*
* 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.
*/
/*
* Copyright (c) 2016, Joyent, Inc. All rights reserved.
*/
#pragma D option quiet
BEGIN
{
@sfo["tabs"] = llquantize(10000, 10, 0, 6, 20);
@yvr["spaces"] = count();
printa(@sfo, @yvr);
exit(0);
}

View File

@ -0,0 +1,13 @@
spaces
value ------------- Distribution ------------- count
< 1 | 0
1 | 0
1
tabs
value ------------- Distribution ------------- count
9500 | 0
10000 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
15000 | 0
0

View File

@ -25,7 +25,7 @@
*/
/*
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
* Copyright (c) 2016, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@ -1145,7 +1145,13 @@ dt_aggwalk_rval(dtrace_hdl_t *dtp, dt_ahashent_t *h, int rval)
size = rec->dtrd_size;
data = &h->dtahe_data;
if (rec->dtrd_action == DTRACEAGG_LQUANTIZE) {
if (rec->dtrd_action == DTRACEAGG_LQUANTIZE ||
rec->dtrd_action == DTRACEAGG_LLQUANTIZE) {
/*
* For lquantize() and llquantize(), we want to be
* sure to not zero the aggregation parameters; step
* over them and adjust our size accordingly.
*/
offs = sizeof (uint64_t);
size -= sizeof (uint64_t);
}
@ -1894,12 +1900,13 @@ dtrace_aggregate_walk_joined(dtrace_hdl_t *dtp, dtrace_aggvarid_t *aggvars,
rec = &aggdesc->dtagd_rec[aggdesc->dtagd_nrecs - 1];
/*
* Now for the more complicated part. If (and only if) this
* is an lquantize() aggregating action, zero-filled data is
* not equivalent to an empty record: we must also get the
* parameters for the lquantize().
* Now for the more complicated part. For the lquantize() and
* llquantize() aggregating actions, zero-filled data is not
* equivalent to an empty record: we must also get the
* parameters for the lquantize()/llquantize().
*/
if (rec->dtrd_action == DTRACEAGG_LQUANTIZE) {
if (rec->dtrd_action == DTRACEAGG_LQUANTIZE ||
rec->dtrd_action == DTRACEAGG_LLQUANTIZE) {
if (aggdata->dtada_data != NULL) {
/*
* The easier case here is if we actually have
@ -1920,7 +1927,7 @@ dtrace_aggregate_walk_joined(dtrace_hdl_t *dtp, dtrace_aggvarid_t *aggvars,
* -- either directly or indirectly.) So as
* gross as it is, we'll grovel around in the
* compiler-generated information to find the
* lquantize() parameters.
* lquantize()/llquantize() parameters.
*/
dtrace_stmtdesc_t *sdp;
dt_ident_t *aid;