fps_ereport_mod.c revision 60c45ed01d4f99571d468c42f609d11a099fab1e
/*
* 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
* 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 2008 Sun Microsystems, Inc.
* All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <kstat.h>
#include <libnvpair.h>
#include <libsysevent.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <sys/processor.h>
#include <unistd.h>
#include <fp.h>
#include <fps_defines.h>
#include <fps_ereport.h>
#include <fpst-defines.h>
#define CLASS_HEAD "ereport.cpu"
#define CLASS_TAIL "fpu.fpscrub"
/* nvlist */
static nvlist_t *fps_nvlist_create();
/* ereport piece generators */
/* cpu check and name convert */
static char *fps_convert_cpu_brand(char *brand);
/* ereport struct functions */
/*
* fps_nvlist_create() allocates the memory for an
* nvlist.
*/
static nvlist_t *
{
int nr_malloc;
nr_malloc = 0;
nr_malloc++;
}
return (nvl);
}
/*
* fps_ena_generate(uint64_t timestamp, processorid_t cpuid,
* uchar_t format)creates the ENA for the ereport.
*/
static uint64_t
{
switch (format) {
case FM_ENA_FMT1:
if (timestamp) {
((cpuid << ENA_FMT1_CPUID_SHFT) &
((timestamp << ENA_FMT1_TIME_SHFT) &
} else {
((cpuid << ENA_FMT1_CPUID_SHFT) &
((gethrtime() << ENA_FMT1_TIME_SHFT) &
}
break;
case FM_ENA_FMT2:
break;
default:
break;
}
return (ena);
}
/*
* fps_fmri_svc_set(nvlist_t *fmri_svc, const char *svc_fmri)
* adds the detector data to fmri_svc.
*/
static int
{
return (1);
return (1);
return (1);
FM_FMRI_SCHEME_SVC) != 0)
return (1);
svc_fmri) != 0)
return (1);
return (0);
}
/*
* fps_fmri_cpu_set(nvlist_t *fmri_cpu, uint32_t cpu_id)
* adds the resource data to fmri_cpu.
*/
static int
{
return (1);
FM_CPU_SCHEME_VERSION) != 0)
return (1);
FM_FMRI_SCHEME_CPU) != 0)
return (1);
return (1);
return (0);
}
/*
* fps_post_ereport(nvlist_t *ereport) posts an
* ereport to the sysevent error channel. The error
* channel is assumed to be established by fps-transport.so.
*/
static int
{
return (1);
}
return (1);
}
(void) sleep(1);
return (0);
}
/*
* fps_convert_cpu_brand(char *brand) changes
* the kstat data to match the ereport class
* names.
*/
static char *
fps_convert_cpu_brand(char *brand)
{
return (NULL);
return (USIII);
return (USIIIi);
return (USIIIP);
return (USIV);
return (USIVP);
else
return (NULL);
}
/*
* get_cpu_brand(uint32_t cpu_id)gets the
* brand of the CPU and returns the CPU
* name to use in the ereport class name.
*/
static char *
{
char *brand;
kc = kstat_open();
return (NULL);
}
/* LINTED */
return (NULL);
}
return (NULL);
}
return (NULL);
}
return (NULL);
return (brand);
}
/*
* fps_generate_ereport_struct(struct fps_test_ereport *report)
* takes report and constructs an nvlist that will be used
* for the ereport.
*/
int
{
char class_name[FM_MAX_CLASS];
char *cpu_brand;
char *string_data;
int detector_available;
int expect_size;
int is_valid_cpu;
int mask;
int observe_size;
int ret;
return (1);
detector_available = 1;
/* allocate nvlists */
detector_available = 0;
}
/* setup class */
/* setup ena */
ereport_time = gethrtime();
/* setup detector */
detector_available = 0;
}
/* setup fps-version */
/* setup resource */
if (is_valid_cpu) {
}
} else {
}
/* put it together */
if (ena != 0) {
} else
if (detector_available) {
}
expect, expect_size) != 0)
observe, observe_size) != 0)
if (mask & IS_EREPORT_INFO) {
string_data) != 0)
}
if (is_valid_cpu) {
}
/* publish */
if (fps_post_ereport(ereport)) {
}
/* free nvlists */
return (ret);
}
/*
* initialize_fps_test_struct(struct fps_test_ereport *init_me)
* creates the initial values for the init_me.
*/
void
{
return;
init_me->observed_size = 0;
init_me->expected_size = 0;
}
/*
* setup_fps_test_struct(int mask, struct fps_test_ereport *rep,
* ...) takes a variable amount of input and stores it in rep
* based on mask provided.
*/
void
{
char *data;
int i;
return;
/* begin parsing args */
/* test id */
/* observed */
/* expected */
/* observed size */
/* expected size */
/* copy arrays of observed and expected */
return;
return;
for (i = 0; i < rep->observed_size; i++)
for (i = 0; i < rep->expected_size; i++)
/* copy string data if there */
if (mask & IS_EREPORT_INFO) {
return;
}
}
}