/*
* 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 (c) 1994, by Sun Microsytems, Inc.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#ifndef DEBUG
#endif
#include "tnf_trace.h"
#include "tnf_types.h"
#include "tnf_args.h"
#include <string.h>
#include <assert.h>
/*
* tnf_probe_get_num_args: returns the number of arguments at probe site
* probe_p. This includes the first 2 args (tag and time delta) in the return
* value.
*/
int
{
int count = 0;
while (*tag_p) {
count++;
tag_p++;
}
return (count);
}
/*
* tnf_probe_get_arg_indexed: returns a pointer into the buffer where
* argument i is stored. Returns NULL on error. Argument numbering is
* zero based i.e. to get the 3rd argument, the input value should be 2.
*/
/* ALIGN_ROUNDUP: y has to be one less than a power of 2 eg. 3, 7, 15, etc. */
#define ALIGN_ROUNDUP(x, y) (((x) + (y)) & ~(y))
void *
{
int count = 0;
unsigned long offset = 0;
if (!tag_ppp)
return (NULL);
/* error checking. REMIND: Do we need it ? */
if (!(*tag_ppp))
return (NULL);
if (!tag_p)
return (NULL);
/* get size of current element */
tag_ppp++;
count++;
}
}
/*
* tnf_probe_get_type_indexed: returns the type of the ith argument.
* returns TNF_UNKNOWN on error. Argument numbering is zero based
* i.e. to get the 3rd argument, the input value should be 2.
*/
{
if (!tag_ppp)
return (TNF_UNKNOWN);
if (!(*tag_ppp))
return (TNF_UNKNOWN);
if (!tag_p)
return (TNF_UNKNOWN);
}
/*
* tnf_probe_get_value: returns the start of the value string that is
* associated with the input attribute. The number of characters in the
* value is also returned as the final argument. The size return value
* indicates the length of the string that is valid. Returns NULL on no
* match or error.
*/
const char *
{
const char *val_start;
int separator;
while (attr_start < str_end) {
if (!attr_end) {
/* last attribute */
}
/* LINTED - result <= string length */
/* skip over leading white space */
(*attr_start == '\t'))) {
attr_start++;
}
/* search for match on attribute */
/* make sure next char is a space or semicolon */
if (*val_start == ATTR_SEPARATOR) {
*size = 0;
return (val_start);
} else if (*val_start == VAL_SEPARATOR) {
/* +1 for val separator */
return (val_start + 1);
}
/* a false match - just continue */
}
/* skip to next attribute */
}
/* no match */
return (NULL);
}
/* used by in-process argument reader */
char *
{
char *str_p;
str_p += ARRAY_HDR_SIZE;
return (str_p);
}