From f215e02bf85f68d3a6106c2a1f4f7f063f819064 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 11 Apr 2024 10:17:27 +0200 Subject: Adding upstream version 7.0.14-dfsg. Signed-off-by: Daniel Baumann --- .../cmd/dtrace/test/tst/common/proc/Makefile.kup | 0 .../cmd/dtrace/test/tst/common/proc/tst.create.ksh | 67 +++++++++++++++ .../dtrace/test/tst/common/proc/tst.discard.ksh | 74 +++++++++++++++++ .../cmd/dtrace/test/tst/common/proc/tst.exec.ksh | 73 +++++++++++++++++ .../test/tst/common/proc/tst.execfail.ENOENT.ksh | 84 +++++++++++++++++++ .../dtrace/test/tst/common/proc/tst.execfail.ksh | 86 ++++++++++++++++++++ .../dtrace/test/tst/common/proc/tst.exitcore.ksh | 95 ++++++++++++++++++++++ .../dtrace/test/tst/common/proc/tst.exitexit.ksh | 67 +++++++++++++++ .../dtrace/test/tst/common/proc/tst.exitkilled.ksh | 75 +++++++++++++++++ .../cmd/dtrace/test/tst/common/proc/tst.signal.ksh | 84 +++++++++++++++++++ .../cmd/dtrace/test/tst/common/proc/tst.sigwait.c | 75 +++++++++++++++++ .../cmd/dtrace/test/tst/common/proc/tst.sigwait.d | 41 ++++++++++ .../dtrace/test/tst/common/proc/tst.startexit.ksh | 89 ++++++++++++++++++++ 13 files changed, 910 insertions(+) create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/Makefile.kup create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.create.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.discard.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exec.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.execfail.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitcore.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitexit.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.signal.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.sigwait.c create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.sigwait.d create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.startexit.ksh (limited to 'src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc') diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/Makefile.kup new file mode 100644 index 00000000..e69de29b diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.create.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.create.ksh new file mode 100644 index 00000000..5b484cf0 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.create.ksh @@ -0,0 +1,67 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" + +# +# This script tests that the proc:::create probe fires with the proper +# arguments. +# +# If this fails, the script will run indefinitely; it relies on the harness +# to time it out. +# +script() +{ + $dtrace -s /dev/stdin <pr_ppid == $child && pid == $child/ + { + exit(0); + } +EOF +} + +sleeper() +{ + while true; do + /usr/bin/sleep 1 + done +} + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 + +sleeper & +child=$! + +script +status=$? + +kill $child +exit $status diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.discard.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.discard.ksh new file mode 100644 index 00000000..5595c24a --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.discard.ksh @@ -0,0 +1,74 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" + +# +# This script tests that the proc:::signal-discard probe fires correctly +# and with the correct arguments. +# +# If this fails, the script will run indefinitely; it relies on the harness +# to time it out. +# +script() +{ + $dtrace -s /dev/stdin <pr_pid == $child && + args[1]->pr_psargs == "$longsleep" && args[2] == SIGHUP/ + { + exit(0); + } +EOF +} + +killer() +{ + while true; do + sleep 1 + /usr/bin/kill -HUP $child + done +} + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +longsleep="/usr/bin/sleep 10000" + +/usr/bin/nohup $longsleep & +child=$! + +killer & +killer=$! +script +status=$? + +kill $child +kill $killer + +exit $status diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exec.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exec.ksh new file mode 100644 index 00000000..0318ae6d --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exec.ksh @@ -0,0 +1,73 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" + +# +# This script tests that the proc:::exec probe fires, followed by the +# proc:::exec-success probe (in a successful exec(2)). +# +# If this fails, the script will run indefinitely; it relies on the harness +# to time it out. +# +script() +{ + $dtrace -s /dev/stdin <pr_ppid == $child && args[0] == "/usr/bin/sleep"/ + { + self->exec = 1; + } + + proc:::exec-success + /self->exec/ + { + exit(0); + } +EOF +} + +sleeper() +{ + while true; do + /usr/bin/sleep 1 + done +} + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 + +sleeper & +child=$! + +script +status=$? + +kill $child +exit $status diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh new file mode 100644 index 00000000..fb1efc54 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh @@ -0,0 +1,84 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" + +# +# This script is identical to tst.execfail.ksh -- but it additionally checks +# that errno is set to ENOENT in the case that an interpreter can't be +# found. +# +# If this fails, the script will run indefinitely; it relies on the harness +# to time it out. +# +script() +{ + $dtrace -s /dev/stdin <pr_ppid == $child && args[0] == "$badexec"/ + { + self->exec = 1; + } + + proc:::exec-failure + /self->exec && args[0] == ENOENT/ + { + exit(0); + } +EOF +} + +sleeper() +{ + while true; do + /usr/bin/sleep 1 + $badexec + done +} + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +badexec=/tmp/execfail.ENOENT.ksh.$$ +dtrace=$1 + +cat > $badexec <pr_ppid == $child && args[0] == "$badexec"/ + { + self->exec = 1; + } + + proc:::exec-failure + /self->exec/ + { + exit(0); + } +EOF +} + +sleeper() +{ + while true; do + /usr/bin/sleep 1 + $badexec + done +} + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +badexec=/tmp/execfail.ksh.$$ +dtrace=$1 + +cat > $badexec <pr_ppid == $child && + curpsinfo->pr_psargs == "$longsleep" && args[0] == CLD_DUMPED/ + { + exit(0); + } + + proc:::exit + /curpsinfo->pr_ppid == $child && + curpsinfo->pr_psargs == "$longsleep" && args[0] != CLD_DUMPED/ + { + printf("Child process could not dump core. Check coreadm(1M)"); + printf(" settings; either per-process or global core dumps "); + printf("must be enabled for this test to work properly."); + exit(1); + } +EOF +} + +sleeper() +{ + /usr/bin/coreadm -p $corefile + while true; do + $longsleep & + /usr/bin/sleep 1 + kill -SEGV $! + done + /usr/bin/rm -f $corefile +} + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +longsleep="/usr/bin/sleep 10000" +corefile=/tmp/core.$$ + +sleeper & +child=$! + +script +status=$? + +pstop $child +pkill -P $child +kill $child +prun $child + +/usr/bin/rm -f $corefile +exit $status diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitexit.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitexit.ksh new file mode 100644 index 00000000..13af911c --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitexit.ksh @@ -0,0 +1,67 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" + +# +# This script tests that the proc:::exit probe fires with the correct argument +# when the process explicitly exits. +# +# If this fails, the script will run indefinitely; it relies on the harness +# to time it out. +# +script() +{ + $dtrace -s /dev/stdin <pr_ppid == $child && args[0] == CLD_EXITED/ + { + exit(0); + } +EOF +} + +sleeper() +{ + while true; do + /usr/bin/sleep 1 + done +} + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 + +sleeper & +child=$! + +script +status=$? + +kill $child +exit $status diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh new file mode 100644 index 00000000..8040ade6 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh @@ -0,0 +1,75 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" + +# +# This script tests that the proc:::exit probe fires with the correct argument +# when the process is killed. +# +# If this fails, the script will run indefinitely; it relies on the harness +# to time it out. +# +script() +{ + $dtrace -s /dev/stdin <pr_ppid == $child && + curpsinfo->pr_psargs == "$longsleep" && args[0] == CLD_KILLED/ + { + exit(0); + } +EOF +} + +sleeper() +{ + while true; do + $longsleep & + /usr/bin/sleep 1 + kill -9 $! + done +} + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +longsleep="/usr/bin/sleep 10000" + +sleeper & +child=$! + +script +status=$? + +pstop $child +pkill -P $child +kill $child +prun $child + +exit $status diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.signal.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.signal.ksh new file mode 100644 index 00000000..cd3c7918 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.signal.ksh @@ -0,0 +1,84 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" + +# +# This script tests that the proc:::signal-send and proc:::signal-handle +# probes fire correctly and with the correct arguments. +# +# If this fails, the script will run indefinitely; it relies on the harness +# to time it out. +# +script() +{ + $dtrace -s /dev/stdin <pr_ppid == $child && + args[1]->pr_psargs == "$longsleep" && args[2] == SIGUSR1/ + { + /* + * This is guaranteed to not race with signal-handle. + */ + target = args[1]->pr_pid; + } + + proc:::signal-handle + /target == pid && args[0] == SIGUSR1/ + { + exit(0); + } +EOF +} + +sleeper() +{ + while true; do + $longsleep & + sleep 1 + /usr/bin/kill -USR1 $! + done +} + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +longsleep="/usr/bin/sleep 10000" + +sleeper & +child=$! + +script +status=$? + +pstop $child +pkill -P $child +kill $child +prun $child + +exit $status diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.sigwait.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.sigwait.c new file mode 100644 index 00000000..8f6231bd --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.sigwait.c @@ -0,0 +1,75 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include +#include +#include +#include +#include +#include + +int +main(int argc, char **argv) +{ + struct sigevent ev; + struct itimerspec ts; + sigset_t set; + timer_t tid; + char *cmd = argv[0]; + + ev.sigev_notify = SIGEV_SIGNAL; + ev.sigev_signo = SIGUSR1; + + if (timer_create(CLOCK_REALTIME, &ev, &tid) == -1) { + (void) fprintf(stderr, "%s: cannot create CLOCK_HIGHRES " + "timer: %s\n", cmd, strerror(errno)); + exit(EXIT_FAILURE); + } + + (void) sigemptyset(&set); + (void) sigaddset(&set, SIGUSR1); + (void) sigprocmask(SIG_BLOCK, &set, NULL); + + ts.it_value.tv_sec = 1; + ts.it_value.tv_nsec = 0; + ts.it_interval.tv_sec = 0; + ts.it_interval.tv_nsec = NANOSEC / 2; + + if (timer_settime(tid, TIMER_RELTIME, &ts, NULL) == -1) { + (void) fprintf(stderr, "%s: timer_settime() failed: %s\n", + cmd, strerror(errno)); + exit(EXIT_FAILURE); + } + + for (;;) { + (void) sigwait(&set); + } + + /*NOTREACHED*/ + return (0); +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.sigwait.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.sigwait.d new file mode 100644 index 00000000..851fa262 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.sigwait.d @@ -0,0 +1,41 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#pragma D option destructive + +proc:::signal-send +/pid == 0 && args[1]->pr_pid == $1 && args[2] == SIGUSR1/ +{ + sent = 1; +} + +proc:::signal-clear +/pid == $1 && args[0] == SIGUSR1 && sent/ +{ + exit(0); +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.startexit.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.startexit.ksh new file mode 100644 index 00000000..42917380 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.startexit.ksh @@ -0,0 +1,89 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" + +# +# This script tests that the firing order of probes in a process is: +# +# 1. proc:::start +# 2. proc:::lwp-start +# 3. proc:::lwp-exit +# 4. proc:::exit +# +# If this fails, the script will run indefinitely; it relies on the harness +# to time it out. +# +script() +{ + $dtrace -s /dev/stdin <pr_ppid == $child/ + { + self->start = 1; + } + + proc:::lwp-start + /self->start/ + { + self->lwp_start = 1; + } + + proc:::lwp-exit + /self->lwp_start/ + { + self->lwp_exit = 1; + } + + proc:::exit + /self->lwp_exit == 1/ + { + exit(0); + } +EOF +} + +sleeper() +{ + while true; do + /usr/bin/sleep 1 + done +} + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 + +sleeper & +child=$! + +script +status=$? + +kill $child +exit $status -- cgit v1.2.3