From owner-svn-src-all@FreeBSD.ORG Tue Jun 3 01:06:34 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B474AD10; Tue, 3 Jun 2014 01:06:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E9D827E0; Tue, 3 Jun 2014 01:06:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5316YmS033728; Tue, 3 Jun 2014 01:06:34 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5316V2f033705; Tue, 3 Jun 2014 01:06:31 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201406030106.s5316V2f033705@svn.freebsd.org> From: Mark Johnston Date: Tue, 3 Jun 2014 01:06:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r266987 - vendor-sys/illumos/dist/uts/common/dtrace vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs vendor/illumos/dist/cmd/dtrace/test/tst/co... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jun 2014 01:06:34 -0000 Author: markj Date: Tue Jun 3 01:06:31 2014 New Revision: 266987 URL: http://svnweb.freebsd.org/changeset/base/266987 Log: 4477 DTrace should speak JSON illumos/illumos-gate@f497f9fe231e0e400f339c84a7d80c4aae2ac4d5 Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/json/ vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.general.d (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.general.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.strsize.d (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.strsize.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.usdt.c (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.usdt.d (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.usdt.d.out vendor/illumos/dist/cmd/dtrace/test/tst/common/json/usdt.d (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/strtoll/ vendor/illumos/dist/cmd/dtrace/test/tst/common/strtoll/err.BaseTooLarge.d (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/strtoll/err.BaseTooSmall.d (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d.out Modified: vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs/tst.subr.d vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh vendor/illumos/dist/lib/libdtrace/common/dt_open.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/dtrace/dtrace.c vendor-sys/illumos/dist/uts/common/sys/dtrace.h Modified: vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs/tst.subr.d ============================================================================== --- vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs/tst.subr.d Tue Jun 3 00:55:15 2014 (r266986) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs/tst.subr.d Tue Jun 3 01:06:31 2014 (r266987) @@ -22,6 +22,7 @@ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ #include @@ -99,6 +100,8 @@ STRFUNC(inet_ntop(AF_INET, (void *)alloc STRFUNC(toupper("foo")) STRFUNC(tolower("BAR")) INTFUNC(getf(0)) +INTFUNC(strtoll("0x12EE5D5", 16)) +STRFUNC(json("{\"systemtap\": false}", "systemtap")) BEGIN /subr == DIF_SUBR_MAX + 1/ Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.general.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.general.d Tue Jun 3 01:06:31 2014 (r266987) @@ -0,0 +1,179 @@ +/* + * 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 2012, Joyent, Inc. All rights reserved. + */ + +/* + * General functional tests of JSON parser for json(). + */ + +#pragma D option quiet +#pragma D option strsize=1k + +#define TST(name) \ + printf("\ntst |%s|\n", name) +#define IN2(vala, valb) \ + in = strjoin(vala, valb); \ + printf("in |%s|\n", in) +#define IN(val) \ + in = val; \ + printf("in |%s|\n", in) +#define SEL(ss) \ + out = json(in, ss); \ + printf("sel |%s|\nout |%s|\n", ss, \ + out != NULL ? out : "") + +BEGIN +{ + TST("empty array"); + IN("[]"); + SEL("0"); + + TST("one-element array: integer"); + IN("[1]"); + SEL("0"); + SEL("1"); + SEL("100"); + SEL("-1"); + + TST("one-element array: hex integer (not in spec, not supported)"); + IN("[0x1000]"); + SEL("0"); + + TST("one-element array: float"); + IN("[1.5001]"); + SEL("0"); + + TST("one-element array: float + exponent"); + IN("[16.3e10]"); + SEL("0"); + + TST("one-element array: integer + whitespace"); + IN("[ \t 5\t]"); + SEL("0"); + + TST("one-element array: integer + exponent + whitespace"); + IN("[ \t \t 16E10 \t ]"); + SEL("0"); + + TST("one-element array: string"); + IN("[\"alpha\"]"); + SEL("0"); + + TST("alternative first-element indexing"); + IN("[1,5,10,15,20]"); + SEL("[0]"); + SEL("[3]"); + SEL("[4]"); + SEL("[5]"); + + TST("one-element array: object"); + IN("[ { \"first\": true, \"second\": false }]"); + SEL("0.first"); + SEL("0.second"); + SEL("0.third"); + + TST("many-element array: integers"); + IN("[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377]"); + SEL("10"); /* F(10) = 55 */ + SEL("14"); /* F(14) = 377 */ + SEL("19"); + + TST("many-element array: multiple types"); + IN2("[\"string\",32,true,{\"a\":9,\"b\":false},100.3e10,false,200.5,", + "{\"key\":\"val\"},null]"); + SEL("0"); + SEL("0.notobject"); + SEL("1"); + SEL("2"); + SEL("3"); + SEL("3.a"); + SEL("3.b"); + SEL("3.c"); + SEL("4"); + SEL("5"); + SEL("6"); + SEL("7"); + SEL("7.key"); + SEL("7.key.notobject"); + SEL("7.nonexist"); + SEL("8"); + SEL("9"); + + TST("many-element array: multiple types + whitespace"); + IN2("\n[\t\"string\" ,\t32 , true\t,\t {\"a\": 9,\t\"b\": false},\t\t", + "100.3e10, false, 200.5,{\"key\" \t:\n \"val\"},\t\t null ]\t\t"); + SEL("0"); + SEL("0.notobject"); + SEL("1"); + SEL("2"); + SEL("3"); + SEL("3.a"); + SEL("3.b"); + SEL("3.c"); + SEL("4"); + SEL("5"); + SEL("6"); + SEL("7"); + SEL("7.key"); + SEL("7.key.notobject"); + SEL("7.nonexist"); + SEL("8"); + SEL("9"); + + TST("two-element array: various string escape codes"); + IN2("[\"abcd \\\" \\\\ \\/ \\b \\f \\n \\r \\t \\u0000 \\uf00F \", ", + "\"final\"]"); + SEL("0"); + SEL("1"); + + TST("three-element array: broken escape code"); + IN("[\"fine here\", \"dodgey \\u00AZ\", \"wont get here\"]"); + SEL("0"); + SEL("1"); + SEL("2"); + + TST("nested objects"); + IN2("{ \"top\": { \"mid\" : { \"legs\": \"feet\" }, \"number\": 9, ", + "\"array\":[0,1,{\"a\":true,\"bb\":[1,2,false,{\"x\":\"yz\"}]}]}}"); + SEL("top"); + SEL("fargo"); + SEL("top.mid"); + SEL("top.centre"); + SEL("top.mid.legs"); + SEL("top.mid.number"); + SEL("top.mid.array"); + SEL("top.number"); + SEL("top.array"); + SEL("top.array[0]"); + SEL("top.array[1]"); + SEL("top.array[2]"); + SEL("top.array[2].a"); + SEL("top.array[2].b"); + SEL("top.array[2].bb"); + SEL("top.array[2].bb[0]"); + SEL("top.array[2].bb[1]"); + SEL("top.array[2].bb[2]"); + SEL("top.array[2].bb[3]"); + SEL("top.array[2].bb[3].x"); + SEL("top.array[2].bb[3].x.nofurther"); + SEL("top.array[2].bb[4]"); + SEL("top.array[3]"); + + exit(0); +} + +ERROR +{ + exit(1); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.general.d.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.general.d.out Tue Jun 3 01:06:31 2014 (r266987) @@ -0,0 +1,218 @@ + +tst |empty array| +in |[]| +sel |0| +out || + +tst |one-element array: integer| +in |[1]| +sel |0| +out |1| +sel |1| +out || +sel |100| +out || +sel |-1| +out || + +tst |one-element array: hex integer (not in spec, not supported)| +in |[0x1000]| +sel |0| +out || + +tst |one-element array: float| +in |[1.5001]| +sel |0| +out |1.5001| + +tst |one-element array: float + exponent| +in |[16.3e10]| +sel |0| +out |16.3e10| + +tst |one-element array: integer + whitespace| +in |[ 5 ]| +sel |0| +out |5| + +tst |one-element array: integer + exponent + whitespace| +in |[ 16E10 ]| +sel |0| +out |16E10| + +tst |one-element array: string| +in |["alpha"]| +sel |0| +out |alpha| + +tst |alternative first-element indexing| +in |[1,5,10,15,20]| +sel |[0]| +out |1| +sel |[3]| +out |15| +sel |[4]| +out |20| +sel |[5]| +out || + +tst |one-element array: object| +in |[ { "first": true, "second": false }]| +sel |0.first| +out |true| +sel |0.second| +out |false| +sel |0.third| +out || + +tst |many-element array: integers| +in |[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377]| +sel |10| +out |55| +sel |14| +out |377| +sel |19| +out || + +tst |many-element array: multiple types| +in |["string",32,true,{"a":9,"b":false},100.3e10,false,200.5,{"key":"val"},null]| +sel |0| +out |string| +sel |0.notobject| +out || +sel |1| +out |32| +sel |2| +out |true| +sel |3| +out |{"a":9,"b":false}| +sel |3.a| +out |9| +sel |3.b| +out |false| +sel |3.c| +out || +sel |4| +out |100.3e10| +sel |5| +out |false| +sel |6| +out |200.5| +sel |7| +out |{"key":"val"}| +sel |7.key| +out |val| +sel |7.key.notobject| +out || +sel |7.nonexist| +out || +sel |8| +out |null| +sel |9| +out || + +tst |many-element array: multiple types + whitespace| +in | +[ "string" , 32 , true , {"a": 9, "b": false}, 100.3e10, false, 200.5,{"key" : + "val"}, null ] | +sel |0| +out |string| +sel |0.notobject| +out || +sel |1| +out |32| +sel |2| +out |true| +sel |3| +out |{"a": 9, "b": false}| +sel |3.a| +out |9| +sel |3.b| +out |false| +sel |3.c| +out || +sel |4| +out |100.3e10| +sel |5| +out |false| +sel |6| +out |200.5| +sel |7| +out |{"key" : + "val"}| +sel |7.key| +out |val| +sel |7.key.notobject| +out || +sel |7.nonexist| +out || +sel |8| +out |null| +sel |9| +out || + +tst |two-element array: various string escape codes| +in |["abcd \" \\ \/ \b \f \n \r \t \u0000 \uf00F ", "final"]| +sel |0| +out |abcd \" \\ \/ \b \f \n \r \t \u0000 \uf00F | +sel |1| +out |final| + +tst |three-element array: broken escape code| +in |["fine here", "dodgey \u00AZ", "wont get here"]| +sel |0| +out |fine here| +sel |1| +out || +sel |2| +out || + +tst |nested objects| +in |{ "top": { "mid" : { "legs": "feet" }, "number": 9, "array":[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]}}| +sel |top| +out |{ "mid" : { "legs": "feet" }, "number": 9, "array":[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]}| +sel |fargo| +out || +sel |top.mid| +out |{ "legs": "feet" }| +sel |top.centre| +out || +sel |top.mid.legs| +out |feet| +sel |top.mid.number| +out || +sel |top.mid.array| +out || +sel |top.number| +out |9| +sel |top.array| +out |[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]| +sel |top.array[0]| +out |0| +sel |top.array[1]| +out |1| +sel |top.array[2]| +out |{"a":true,"bb":[1,2,false,{"x":"yz"}]}| +sel |top.array[2].a| +out |true| +sel |top.array[2].b| +out || +sel |top.array[2].bb| +out |[1,2,false,{"x":"yz"}]| +sel |top.array[2].bb[0]| +out |1| +sel |top.array[2].bb[1]| +out |2| +sel |top.array[2].bb[2]| +out |false| +sel |top.array[2].bb[3]| +out |{"x":"yz"}| +sel |top.array[2].bb[3].x| +out |yz| +sel |top.array[2].bb[3].x.nofurther| +out || +sel |top.array[2].bb[4]| +out || +sel |top.array[3]| +out || + Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.strsize.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.strsize.d Tue Jun 3 01:06:31 2014 (r266987) @@ -0,0 +1,51 @@ +/* + * 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 2012, Joyent, Inc. All rights reserved. + */ + +/* + * ASSERTION: + * json() run time must be bounded above by strsize. This test makes strsize + * small and deliberately overflows it to prove we bail and return NULL in + * the event that we run off the end of the string. + * + */ + +#pragma D option quiet +#pragma D option strsize=18 + +BEGIN +{ + in = "{\"a\": 1024}"; /* length == 19 */ + out = json(in, "a"); + printf("|%s|\n%s\n\n", in, out != NULL ? out : ""); + + in = "{\"a\": 1024}"; /* length == 11 */ + out = json(in, "a"); + printf("|%s|\n%s\n\n", in, out != NULL ? out : ""); + + in = "{\"a\":false,\"b\":true}"; /* length == 20 */ + out = json(in, "b"); + printf("|%s|\n%s\n\n", in, out != NULL ? out : ""); + + in = "{\"a\":false,\"b\":20}"; /* length == 18 */ + out = json(in, "b"); + printf("|%s|\n%s\n\n", in, out != NULL ? out : ""); + + exit(0); +} + +ERROR +{ + exit(1); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.strsize.d.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.strsize.d.out Tue Jun 3 01:06:31 2014 (r266987) @@ -0,0 +1,13 @@ +|{"a": 1024| + + +|{"a": 1024}| +1024 + +|{"a":false,"b":tru| + + +|{"a":false,"b":20}| +20 + + Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.usdt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.usdt.c Tue Jun 3 01:06:31 2014 (r266987) @@ -0,0 +1,61 @@ +/* + * 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 2012 (c), Joyent, Inc. All rights reserved. + */ + +#include +#include "usdt.h" + +#define FMT "{" \ + " \"sizes\": [ \"first\", 2, %f ]," \ + " \"index\": %d," \ + " \"facts\": {" \ + " \"odd\": \"%s\"," \ + " \"even\": \"%s\"" \ + " }," \ + " \"action\": \"%s\"" \ + "}\n" + +int +waiting(volatile int *a) +{ + return (*a); +} + +int +main(int argc, char **argv) +{ + volatile int a = 0; + int idx; + double size = 250.5; + + while (waiting(&a) == 0) + continue; + + for (idx = 0; idx < 10; idx++) { + char *odd, *even, *json, *action; + + size *= 1.78; + odd = idx % 2 == 1 ? "true" : "false"; + even = idx % 2 == 0 ? "true" : "false"; + action = idx == 7 ? "ignore" : "print"; + + asprintf(&json, FMT, size, idx, odd, even, action); + BUNYAN_FAKE_LOG_DEBUG(json); + free(json); + } + + BUNYAN_FAKE_LOG_DEBUG("{\"finished\": true}"); + + return (0); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.usdt.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.usdt.d Tue Jun 3 01:06:31 2014 (r266987) @@ -0,0 +1,65 @@ +/* + * 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) 2012, Joyent, Inc. All rights reserved. + */ + +#pragma D option strsize=4k +#pragma D option quiet +#pragma D option destructive + +/* + * This test reads a JSON string from a USDT probe, roughly simulating the + * primary motivating use case for the json() subroutine: filtering + * JSON-formatted log messages from a logging subsystem like node-bunyan. + */ + +pid$1:a.out:waiting:entry +{ + this->value = (int *)alloca(sizeof (int)); + *this->value = 1; + copyout(this->value, arg0, sizeof (int)); +} + +bunyan*$1:::log-* +{ + this->j = copyinstr(arg0); +} + +bunyan*$1:::log-* +/json(this->j, "finished") == NULL && json(this->j, "action") != "ignore"/ +{ + this->index = strtoll(json(this->j, "index")); + this->size = json(this->j, "sizes[2]"); + this->odd = json(this->j, "facts.odd"); + this->even = json(this->j, "facts.even"); + printf("[%d] sz %s odd %s even %s\n", this->index, this->size, + this->odd, this->even); +} + +bunyan*$1:::log-* +/json(this->j, "finished") != NULL/ +{ + printf("FINISHED!\n"); + exit(0); +} + +tick-10s +{ + printf("ERROR: Timed out before finish message!\n"); + exit(1); +} + +ERROR +{ + exit(1); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.usdt.d.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/json/tst.usdt.d.out Tue Jun 3 01:06:31 2014 (r266987) @@ -0,0 +1,11 @@ +[0] sz 445.890000 odd false even true +[1] sz 793.684200 odd true even false +[2] sz 1412.757876 odd false even true +[3] sz 2514.709019 odd true even false +[4] sz 4476.182054 odd false even true +[5] sz 7967.604057 odd true even false +[6] sz 14182.335221 odd false even true +[8] sz 44935.310914 odd false even true +[9] sz 79984.853427 odd true even false +FINISHED! + Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/json/usdt.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/json/usdt.d Tue Jun 3 01:06:31 2014 (r266987) @@ -0,0 +1,27 @@ +/* + * 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 2012, Joyent, Inc. All rights reserved. + */ + +/* + * Sets up a fake node-bunyan-like USDT provider for use from C. + */ + +provider bunyan_fake { + probe log__trace(char *msg); + probe log__debug(char *msg); + probe log__info(char *msg); + probe log__warn(char *msg); + probe log__error(char *msg); + probe log__fatal(char *msg); +}; Modified: vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh ============================================================================== --- vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh Tue Jun 3 00:55:15 2014 (r266986) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh Tue Jun 3 01:06:31 2014 (r266987) @@ -22,8 +22,8 @@ # # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. +# Copyright (c) 2012, Joyent, Inc. All rights reserved. # -#ident "%Z%%M% %I% %E% SMI" ppriv -s A=basic,dtrace_proc,dtrace_user $$ @@ -31,7 +31,7 @@ ppriv -s A=basic,dtrace_proc,dtrace_user BEGIN { errorcount = 0; - expected_errorcount = 23; + expected_errorcount = 27; } BEGIN { trace(mutex_owned(&`pidlock)); } @@ -55,6 +55,8 @@ BEGIN { trace(strtok(`initname, "/")); } BEGIN { trace(strtok(NULL, "/")); } BEGIN { trace(strtok("foo/bar", `initname)); } BEGIN { trace(strtok(NULL, `initname)); } +BEGIN { trace(strtoll(`initname)); } +BEGIN { trace(strtoll(`initname, 10)); } BEGIN { trace(substr(`initname, 2, 3)); } BEGIN { trace(ddi_pathname(`top_devinfo, 1)); } @@ -63,6 +65,9 @@ BEGIN { trace(strjoin("foo", `initname)) BEGIN { trace(dirname(`initname)); } BEGIN { trace(cleanpath(`initname)); } +BEGIN { j = "{\"/sbin/init\":\"uh oh\"}"; trace(json(j, `initname)); } +BEGIN { trace(json(`initname, "x")); } + ERROR { errorcount++; } Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/strtoll/err.BaseTooLarge.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/strtoll/err.BaseTooLarge.d Tue Jun 3 01:06:31 2014 (r266987) @@ -0,0 +1,35 @@ +/* + * 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) 2012, Joyent, Inc. All rights reserved. + */ + +/* + * ASSERTION: + * The largest base we will accept is Base 36 -- i.e. using all of 0-9 and + * A-Z as numerals. + * + * SECTION: Actions and Subroutines/strtoll() + */ + +#pragma D option quiet + +BEGIN +{ + printf("%d\n", strtoll("0", 37)); + exit(0); +} + +ERROR +{ + exit(1); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/strtoll/err.BaseTooSmall.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/strtoll/err.BaseTooSmall.d Tue Jun 3 01:06:31 2014 (r266987) @@ -0,0 +1,34 @@ +/* + * 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) 2012, Joyent, Inc. All rights reserved. + */ + +/* + * ASSERTION: + * The smallest base we will accept is Base 2. + * + * SECTION: Actions and Subroutines/strtoll() + */ + +#pragma D option quiet + +BEGIN +{ + printf("%d\n", strtoll("0", 1)); + exit(0); +} + +ERROR +{ + exit(1); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d Tue Jun 3 01:06:31 2014 (r266987) @@ -0,0 +1,66 @@ +/* + * 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) 2012, Joyent, Inc. All rights reserved. + */ + +/* + * ASSERTION: + * Test the strtoll() subroutine. + * + * SECTION: Actions and Subroutines/strtoll() + */ + +#pragma D option quiet + +BEGIN +{ + + /* minimum base (2) and maximum base (36): */ + printf("%d\n", strtoll("0", 2)); + printf("%d\n", strtoll("1", 36)); + + /* simple tests: */ + printf("%d\n", strtoll("0x20", 16)); + printf("%d\n", strtoll("-32", 10)); + printf("%d\n", strtoll("010", 8)); + printf("%d\n", strtoll("101010", 2)); + + /* INT64_MIN and INT64_MAX: */ + printf("%d\n", strtoll("9223372036854775807")); + printf("%d\n", strtoll("-9223372036854775808")); + printf("%d\n", strtoll("0777777777777777777777", 8)); + printf("%d\n", strtoll("-01000000000000000000000", 8)); + + /* wrapping: */ + printf("%d\n", strtoll("1000000000000000000000", 8)); + printf("%d\n", strtoll("-1000000000000000000001", 8)); + + /* hex without prefix: */ + printf("%d\n", strtoll("baddcafe", 16)); + + /* stopping at first out-of-base character: */ + printf("%d\n", strtoll("12j", 10)); + printf("%d\n", strtoll("102", 2)); + + /* base 36: */ + printf("%d\n", strtoll("-0DTrace4EverZ", 36)); + + /* base 10 is assumed: */ + printf("%d\n", strtoll("1985")); + printf("%d\n", strtoll("-2012")); + + /* empty string: */ + printf("%d\n", strtoll("")); + + exit(0); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d.out Tue Jun 3 01:06:31 2014 (r266987) @@ -0,0 +1,20 @@ +0 +1 +32 +-32 +8 +42 +9223372036854775807 +-9223372036854775808 +9223372036854775807 +-9223372036854775808 +-9223372036854775808 +9223372036854775807 +3135097598 +12 +2 +-1819882045752187535 +1985 +-2012 +0 + Modified: vendor/illumos/dist/lib/libdtrace/common/dt_open.c ============================================================================== --- vendor/illumos/dist/lib/libdtrace/common/dt_open.c Tue Jun 3 00:55:15 2014 (r266986) +++ vendor/illumos/dist/lib/libdtrace/common/dt_open.c Tue Jun 3 01:06:31 2014 (r266987) @@ -112,8 +112,9 @@ #define DT_VERS_1_9 DT_VERSION_NUMBER(1, 9, 0) #define DT_VERS_1_9_1 DT_VERSION_NUMBER(1, 9, 1) #define DT_VERS_1_10 DT_VERSION_NUMBER(1, 10, 0) -#define DT_VERS_LATEST DT_VERS_1_10 -#define DT_VERS_STRING "Sun D 1.10" +#define DT_VERS_1_11 DT_VERSION_NUMBER(1, 11, 0) +#define DT_VERS_LATEST DT_VERS_1_11 +#define DT_VERS_STRING "Sun D 1.11" const dt_version_t _dtrace_versions[] = { DT_VERS_1_0, /* D API 1.0.0 (PSARC 2001/466) Solaris 10 FCS */ @@ -136,6 +137,7 @@ const dt_version_t _dtrace_versions[] = DT_VERS_1_9, /* D API 1.9 */ DT_VERS_1_9_1, /* D API 1.9.1 */ DT_VERS_1_10, /* D API 1.10 */ + DT_VERS_1_11, /* D API 1.11 */ 0 }; @@ -265,6 +267,8 @@ static const dt_ident_t _dtrace_globals[ DT_VERS_1_5, &dt_idops_func, "string(int, void *)" }, { "ipl", DT_IDENT_SCALAR, 0, DIF_VAR_IPL, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "uint_t" }, +{ "json", DT_IDENT_FUNC, 0, DIF_SUBR_JSON, DT_ATTR_STABCMN, DT_VERS_1_11, + &dt_idops_func, "string(const char *, const char *)" }, { "jstack", DT_IDENT_ACTFUNC, 0, DT_ACT_JSTACK, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_func, "stack(...)" }, { "lltostr", DT_IDENT_FUNC, 0, DIF_SUBR_LLTOSTR, DT_ATTR_STABCMN, DT_VERS_1_0, @@ -379,6 +383,8 @@ static const dt_ident_t _dtrace_globals[ &dt_idops_func, "string(const char *, const char *)" }, { "strtok", DT_IDENT_FUNC, 0, DIF_SUBR_STRTOK, DT_ATTR_STABCMN, DT_VERS_1_1, &dt_idops_func, "string(const char *, const char *)" }, +{ "strtoll", DT_IDENT_FUNC, 0, DIF_SUBR_STRTOLL, DT_ATTR_STABCMN, DT_VERS_1_11, + &dt_idops_func, "int64_t(const char *, [int])" }, { "substr", DT_IDENT_FUNC, 0, DIF_SUBR_SUBSTR, DT_ATTR_STABCMN, DT_VERS_1_1, &dt_idops_func, "string(const char *, int, [int])" }, { "sum", DT_IDENT_AGGFUNC, 0, DTRACEAGG_SUM, DT_ATTR_STABCMN, DT_VERS_1_0,