[DTrace-devel] [PATCH] Squash to "Manage clause flags"

Kris Van Hees kris.van.hees at oracle.com
Wed Apr 7 10:17:18 PDT 2021


On Wed, Apr 07, 2021 at 11:59:57AM -0400, eugene.loh at oracle.com wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> The following paragraph can be added to the commit message:
> 
>     One change -- between the old dt_stmt_append() and the new
>     dt_cg_clsflags() -- is that destructive actions have become
>     data-recording clauses.  Thus, a new funcs/tst.freopen-single.sh
>     test checks this case.
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>

... I will merge it into the clause flags patch as I move all other reviewed
patch there.

> ---
>  libdtrace/dt_cg.c                         | 10 ------
>  test/unittest/funcs/tst.freopen-single.r  |  2 ++
>  test/unittest/funcs/tst.freopen-single.sh | 38 +++++++++++++++++++++++
>  3 files changed, 40 insertions(+), 10 deletions(-)
>  create mode 100644 test/unittest/funcs/tst.freopen-single.r
>  create mode 100755 test/unittest/funcs/tst.freopen-single.sh
> 
> diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
> index c6443b63..41da0131 100644
> --- a/libdtrace/dt_cg.c
> +++ b/libdtrace/dt_cg.c
> @@ -843,16 +843,6 @@ dt_cg_clsflags(dt_pcb_t *pcb, dtrace_actkind_t kind, const dt_node_t *dnp)
>  			    "exit( ) may not follow speculate( )\n");
>  	}
>  
> -	/*
> -	 * Exclude all non data-recording actions.
> -	 */
> -#ifdef FIXME
> -	if (dt_action_destructive(ap) || kind == DTRACEACT_DISCARD)
> -#else
> -	if (DTRACEACT_ISDESTRUCTIVE(kind) || kind == DTRACEACT_DISCARD)
> -#endif
> -		return;
> -
>  #ifdef FIXME
>  	if (kind == DTRACEACT_DIFEXPR &&
>  	    ap->dtad_difo->dtdo_rtype.dtdt_kind == DIF_TYPE_CTF &&
> diff --git a/test/unittest/funcs/tst.freopen-single.r b/test/unittest/funcs/tst.freopen-single.r
> new file mode 100644
> index 00000000..f4f6f740
> --- /dev/null
> +++ b/test/unittest/funcs/tst.freopen-single.r
> @@ -0,0 +1,2 @@
> +the quick brown fox jumped over the lazy dog
> +
> diff --git a/test/unittest/funcs/tst.freopen-single.sh b/test/unittest/funcs/tst.freopen-single.sh
> new file mode 100755
> index 00000000..26ab3ae2
> --- /dev/null
> +++ b/test/unittest/funcs/tst.freopen-single.sh
> @@ -0,0 +1,38 @@
> +#!/bin/bash
> +#
> +# Oracle Linux DTrace.
> +# Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
> +# Licensed under the Universal Permissive License v 1.0 as shown at
> +# http://oss.oracle.com/licenses/upl.
> +#
> +
> +#
> +# ASSERTION: freopen should work even if it is the only action in the clause.
> +#
> +
> +dtrace=$1
> +
> +$dtrace $dt_flags -wqn '
> +tick-600ms
> +{
> +	freopen("/dev/null");
> +}
> +tick-700ms
> +{
> +	printf("hello world\n");
> +}
> +tick-800ms
> +{
> +	freopen("");
> +}
> +tick-900ms
> +{
> +	printf("the quick brown fox jumped over the lazy dog\n");
> +	exit(0);
> +}'
> +
> +if [ $? -ne 0 ]; then
> +	echo DTrace failed
> +	exit 1
> +fi
> +
> -- 
> 2.18.4
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list