fmd_rpc_adm.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <strings.h>
#include <limits.h>
#include <unistd.h>
#include <stdlib.h>
#include <alloca.h>
#include <fmd_rpc_adm.h>
#include <fmd_rpc.h>
#include <fmd_module.h>
#include <fmd_ustat.h>
#include <fmd_error.h>
#include <fmd_asru.h>
#include <fmd_ckpt.h>
#include <fmd_case.h>
#include <fmd_fmri.h>
#include <fmd.h>
{
struct fmd_rpc_modinfo *rmi;
if (fmd_rpc_deny(req)) {
return (TRUE);
}
break;
}
/*
* If mod_info is NULL, the module is in the middle of loading:
* do not report its presence to observability tools yet.
*/
continue;
}
break;
}
}
return (TRUE);
}
fmd_adm_modcstat_1_svc(char *name,
{
if (fmd_rpc_deny(req)) {
return (TRUE);
}
return (TRUE);
}
} else if (errno == EFMD_HDL_ABORT) {
} else
return (TRUE);
}
fmd_adm_moddstat_1_svc(char *name,
{
if (fmd_rpc_deny(req)) {
return (TRUE);
}
return (TRUE);
}
return (TRUE);
}
/*
* Note: the bcopy() here is valid only if no FMD_TYPE_STRING stats
* are present in mp->mod_stats. We don't use any for the daemon-
* maintained stats and provide this function in order to reduce the
* overhead of the fmstat(1M) default view, where these minimal stats
* must be retrieved for all of the active modules.
*/
sizeof (fmd_modstat_t));
} else {
}
return (TRUE);
}
{
if (fmd_rpc_deny(req)) {
/*
* Note: the bcopy() here is valid only if no FMD_TYPE_STRING
* stats are present in fmd.d_stats (see definition in fmd.c).
*/
} else {
}
return (TRUE);
}
{
const char *p;
int err = 0;
if (fmd_rpc_deny(req)) {
*rvp = FMD_ADM_ERR_PERM;
return (TRUE);
}
/*
* Before we endure the expense of constructing a module and attempting
* to load it, do a quick check to see if the pathname is valid.
*/
return (TRUE);
}
else
switch (errno) {
case EFMD_MOD_LOADED:
break;
case EFMD_MOD_INIT:
break;
default:
break;
}
}
return (TRUE);
}
{
int err = 0;
if (fmd_rpc_deny(req))
return (TRUE);
}
{
int err = 0;
if (fmd_rpc_deny(req))
if (err == 0)
if (errno == EFMD_MOD_INIT)
else
}
return (TRUE);
}
{
int err = 0;
if (fmd_rpc_deny(req))
else {
}
return (TRUE);
}
/*
* Unlike our other RPC callbacks, fmd_adm_rsrclist_1 can return large amounts
* of data that may exceed the underlying RPC transport buffer size if the
* To minimize the likelihood of running out of RPC buffer space and having to
* fail the client request, fmd_adm_rsrclist_1 returns a snapshot of the
* relevant FMRI strings only: the client can use fmd_adm_rsrcinfo_1 on an
* individual FMRI if more information is needed. To further reduce the XDR
* overhead, the string list is represented as XDR-opaque data where the
* entire list is returned as a string table (e.g. "fmriA\0fmriB\0...").
*/
static void
{
void *p;
/*
* If rrl_all is false, we take a quick look at asru_flags with no lock
* held to see if the ASRU is either not faulty or invisible. If so,
* we don't want to report it by default and can just skip this ASRU.
* This helps keep overhead low in the common case, as the call to
* fmd_asru_getstate() can be expensive depending on the scheme.
*/
return;
return; /* error has occurred or resource is in 'ok' state */
/*
* Lock the ASRU and reallocate rrl_buf[] to be large enough to hold
* another string, doubling it as needed. Then copy the new string
* on to the end, and increment rrl_len to indicate the used space.
*/
else
} else {
break;
}
}
}
}
{
if (fmd_rpc_deny(req))
else
return (TRUE);
}
fmd_adm_rsrcinfo_1_svc(char *fmri,
{
fmd_asru_t *ap;
int state;
if (fmd_rpc_deny(req)) {
return (TRUE);
}
return (TRUE);
}
return (TRUE);
}
{
if (fmd_rpc_deny(req))
*rvp = FMD_ADM_ERR_PERM;
else
*rvp = 0;
return (TRUE);
}
static int
{
fmd_case_t *cp;
char *cid;
return (FMD_ADM_ERR_RSRCNOTF);
}
return (0);
}
static void
{
(void) fmd_adm_repair(ee);
}
{
int err = 0;
if (fmd_rpc_deny(req))
/*
* We've located the requested ASRU, and have repaired it. Now
* traverse the ASRU cache, looking for any faulty entries that
* are contained by this one. If we find any, repair them too.
*/
}
return (TRUE);
}
static void
{
const fmd_serd_elem_t *oep;
return;
}
else
}
fmd_adm_serdinfo_1_svc(char *name,
{
if (fmd_rpc_deny(req)) {
return (TRUE);
}
return (TRUE);
}
return (TRUE);
}
{
int err = 0;
if (fmd_rpc_deny(req)) {
*rvp = FMD_ADM_ERR_PERM;
return (TRUE);
}
return (TRUE);
}
if (fmd_serd_eng_fired(sgp)) {
} else {
}
} else
return (TRUE);
}
{
if (fmd_rpc_deny(req)) {
*rvp = FMD_ADM_ERR_PERM;
return (TRUE);
}
else {
return (TRUE);
}
/*
* To rotate a log file, grab d_log_lock as writer to make sure no
* one else can discover the current log pointer. Then try to rotate
* the log. If we're successful, release the old log pointer.
*/
do {
if (try > 1)
}
*rvp = 0;
else if (errno == EFMD_LOG_ROTBUSY)
else
return (TRUE);
}
struct fmd_adm_repair {
const char *rep_uuid; /* case uuid that we are using to match */
char *rep_buf; /* buffer in which to store case ids */
};
static void
{
return;
/*
* If the UUID of the case associated with this ASRU matches, close all
* ASRUs contained by 'ap' and trigger appropriate case close events.
*/
/*
* We can call fmd_asru_clrflags() here rather than fmd_adm_repair()
* because if the case was still open, fmd_case_repair() closed it.
*/
}
{
int err = 0;
if (fmd_rpc_deny(req))
else if (fmd_case_repair(cp) != 0)
/*
* If the case is not found, it could be already closed (i.e. the ASRU
* was successfully offlined). Check all ASRUs for a matching UUID and
* try to repair them. If any are found, set err to indicate success.
* If the case is found, we also check all ASRUs so that any ASRUs
* contained by those that have been repaired are repaired recursively.
*/
struct fmd_adm_repair r;
r.rep_cnt = 0;
err = 0; /* one or more ASRUs had matching case IDs */
}
return (TRUE);
}
int
{
return (TRUE);
}
/*
* Custom XDR routine for our API structure fmd_stat_t. This function must
* match the definition of fmd_stat_t in <fmd_api.h> and must also match
*/
{
case FMD_TYPE_BOOL:
break;
case FMD_TYPE_INT32:
break;
case FMD_TYPE_UINT32:
break;
case FMD_TYPE_INT64:
break;
case FMD_TYPE_UINT64:
case FMD_TYPE_TIME:
case FMD_TYPE_SIZE:
break;
case FMD_TYPE_STRING:
break;
}
return (rv);
}