/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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
* 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"
#include <dt_impl.h>
#include <stddef.h>
#include <errno.h>
#include <assert.h>
#include <time.h>
static const struct {
int dtslt_option;
} _dtrace_sleeptab[] = {
{ DTRACEOPT_MAX, 0 }
};
void
{
int i;
/*
* If the buffering policy is set to anything other than
* "switch", we ignore the aggrate and switchrate -- they're
* meaningless.
*/
if (policy != DTRACEOPT_BUFPOLICY_SWITCH &&
continue;
}
return; /* sleep duration has already past */
}
/*
* Wait for either 'tv' nanoseconds to pass or to receive notification
* that a process is in an interesting state. Regardless of why we
* awaken, iterate over any pending notifications and process them.
*/
if (*err == '\0')
dtp->dt_procarg);
}
}
}
int
{
return (DTRACE_STATUS_NONE);
if (dtp->dt_stopped)
return (DTRACE_STATUS_STOPPED);
if (dtp->dt_laststatus != 0) {
return (DTRACE_STATUS_NONE);
} else {
}
return (-1);
if (!dtp->dt_stopped)
(void) dtrace_stop(dtp);
return (DTRACE_STATUS_EXITED);
}
return (DTRACE_STATUS_OKAY);
return (DTRACE_STATUS_OKAY);
if (!dtp->dt_stopped) {
return (-1);
}
return (DTRACE_STATUS_FILLED);
}
int
{
void *dof;
int err;
/*
* If a dtrace:::ERROR program and callback are registered, enable the
* program before we start tracing. If this fails for a vector open
* with ENOTTY, we permit dtrace_go() to succeed so that vector clients
* such as mdb's dtrace module can execute the rest of dtrace_go() even
* though they do not provide support for the DTRACEIOC_ENABLE ioctl.
*/
return (-1); /* dt_errno has been set for us */
return (-1); /* dt_errno has been set for us */
}
return (dt_aggregate_go(dtp));
}
int
{
if (dtp->dt_stopped)
return (0);
/*
* Now that we're stopped, we're going to get status one final time.
*/
return (-1);
return (0);
}
{
switch (status) {
case DTRACE_STATUS_EXITED:
case DTRACE_STATUS_FILLED:
case DTRACE_STATUS_STOPPED:
/*
* Tracing is stopped. We now want to force dtrace_consume()
* and dtrace_aggregate_snap() to proceed, regardless of
* switchrate and aggrate. We do this by clearing the times.
*/
dtp->dt_lastswitch = 0;
dtp->dt_lastagg = 0;
break;
case DTRACE_STATUS_NONE:
case DTRACE_STATUS_OKAY:
break;
case -1:
return (DTRACE_WORKSTATUS_ERROR);
}
/*
* There either isn't any status or things are fine -- and
* this is a "ring" or "fill" buffer. We don't want to consume
* any of the trace data or snapshot the aggregations; we just
* return.
*/
return (rval);
}
return (DTRACE_WORKSTATUS_ERROR);
return (DTRACE_WORKSTATUS_ERROR);
return (rval);
}