/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <strings.h>
#include <stdlib.h>
#include <netdir.h>
#include <errno.h>
#include <alloca.h>
#include <locale.h>
#include <fmd_adm_impl.h>
#include <fmd_rpc_adm.h>
{
CLIENT *c;
rpcvers_t v;
if (version != FMD_ADM_VERSION) {
return (NULL);
}
if (prog == FMD_ADM_PROGRAM)
return (NULL);
} else {
ap->adm_maxretries = 0;
}
if (c == NULL) {
return (NULL);
}
ap->adm_svcerr = 0;
return (ap);
}
void
{
return; /* permit NULL to simply caller code */
}
static const char *
{
switch (err) {
case FMD_ADM_ERR_NOMEM:
return ("unable to perform request due to allocation failure");
case FMD_ADM_ERR_PERM:
return ("operation requires additional privilege");
case FMD_ADM_ERR_MODSRCH:
return ("specified module is not loaded in fault manager");
case FMD_ADM_ERR_MODBUSY:
return ("module is in use and cannot be unloaded");
case FMD_ADM_ERR_MODFAIL:
return ("module failed and can no longer export statistics");
case FMD_ADM_ERR_MODNOENT:
return ("file missing or cannot be accessed by fault manager");
case FMD_ADM_ERR_MODEXIST:
return ("module using same name is already loaded");
case FMD_ADM_ERR_MODINIT:
return ("module failed to initialize (consult fmd(1M) log)");
case FMD_ADM_ERR_MODLOAD:
return ("module failed to load (consult fmd(1M) log)");
case FMD_ADM_ERR_RSRCSRCH:
return ("specified resource is not cached by fault manager");
case FMD_ADM_ERR_RSRCNOTF:
return ("specified resource is not known to be faulty");
case FMD_ADM_ERR_SERDSRCH:
return ("specified serd engine not present in module");
case FMD_ADM_ERR_SERDFIRED:
return ("specified serd engine has already fired");
case FMD_ADM_ERR_ROTSRCH:
return ("invalid log file name");
case FMD_ADM_ERR_ROTFAIL:
return ("failed to rotate log file (consult fmd(1M) log)");
case FMD_ADM_ERR_ROTBUSY:
return ("log file is too busy to rotate (try again later)");
case FMD_ADM_ERR_CASESRCH:
return ("specified UUID is invalid or has been repaired");
case FMD_ADM_ERR_CASEOPEN:
return ("specified UUID is still being diagnosed");
case FMD_ADM_ERR_XPRTSRCH:
return ("specified transport ID is invalid or has been closed");
case FMD_ADM_ERR_CASEXPRT:
return ("specified UUID is owned by a different fault manager");
case FMD_ADM_ERR_RSRCNOTR:
return ("specified resource has not been replaced");
default:
return ("unknown fault manager error");
}
}
const char *
{
switch (errno) {
case ENOTSUP:
return ("client requires newer libfmd_adm version");
case EPROTO:
return (clnt_spcreateerror("failed to connect to fmd"));
}
}
case EPROTO:
case EREMOTE:
default:
}
}
static int
{
if (err != 0) {
return (-1);
} else {
return (0);
}
}
static int
{
return (-1);
}
static int
{
}
/*
* If the server (fmd) is restarted, this will cause all future door calls to
* fail. Unfortunately, once the server comes back up, we have no way of
* reestablishing the connection. To get around this, if the error indicates
* that the RPC call failed, we reopen the client handle and try again. For
* simplicity we only deal with the door case, as it's unclear whether the
* remote case suffers from the same pathology.
*/
{
CLIENT *c;
return (B_FALSE);
return (B_FALSE);
_fmd_adm_bufsize)) == NULL)
return (B_FALSE);
(*retries)++;
return (B_TRUE);
}
int
{
do {
else
if (cs != RPC_SUCCESS)
}
sizeof (fmd_stat_t), fmd_adm_stats_cmp);
}
return (0);
}
int
{
return (0);
}
static int
{
}
int
{
do {
if (cs != RPC_SUCCESS)
}
}
if (rmi->rmi_faulty)
break;
}
return (0);
}
int
{
int err;
do {
if (cs != RPC_SUCCESS)
}
int
{
int err;
do {
if (cs != RPC_SUCCESS)
}
int
{
int err;
do {
if (cs != RPC_SUCCESS)
}
int
{
int err;
do {
if (cs != RPC_SUCCESS)
}
int
{
do {
if (cs != RPC_SUCCESS)
}
return (0);
}
int
{
do {
if (cs != RPC_SUCCESS)
}
return (0);
}
static int
{
}
int
{
char **fmris, *p;
int i, rv;
do {
if (cs != RPC_SUCCESS)
}
}
/*
* The fmd_adm_rsrclist_1 request returns an opaque XDR buffer that is
* a string table of FMRIs (e.g. "fmriA\0fmriB\0...") where rrl_cnt is
* the number of strings in the table and rrl_buf_val is its address.
* We construct an array of pointers into the string table and sort it.
*/
fmris[i] = p; /* store fmri pointer in array for sorting */
/*
* For each FMRI in the resource cache snapshot, use fmd_adm_rsrcinfo_1
* to get more information and the invoke the callback function. If
* FMD_ADM_ERR_RSRCSRCH is returned, the FMRI has been purged from the
* cache since our snapshot: this error is therefore silently ignored.
*/
retries = 0;
do {
if (cs != RPC_SUCCESS) {
}
}
continue;
}
if (rri.rri_faulty)
if (rri.rri_unusable)
if (rri.rri_invisible)
if (rv != 0)
break;
}
return (0);
}
int
{
int err;
do {
if (cs != RPC_SUCCESS)
}
int
{
int err;
do {
if (cs != RPC_SUCCESS)
}
int
{
int err;
do {
if (cs != RPC_SUCCESS)
}
int
{
int err;
do {
if (cs != RPC_SUCCESS)
}
int
{
int err;
do {
if (cs != RPC_SUCCESS)
}
int
{
int err;
do {
if (cs != RPC_SUCCESS)
}
static int
{
}
static int
{
const char *url;
} else {
/*
* If we're given a token to use in looking up the URL, try
* to use it. Otherwise, or if we don't find it that way,
* use the fallback.
*/
url = _url_fallback;
/*
* We didn't find a translation in the
* dictionary for the current language. Fall
* back to C and try again.
*/
url = _url_fallback;
}
} else {
}
}
}
/*
* Our approach to cases is the same as for resources: we first obtain a
* list of UUIDs, sort them, then obtain the case information for each.
*/
int
void *arg)
{
char **uuids, *p;
int i, rv;
do {
if (cs != RPC_SUCCESS)
}
}
uuids[i] = p;
retries = 0;
do {
if (cs != RPC_SUCCESS) {
}
}
continue;
}
}
}
}
if (rv != 0)
break;
}
return (0);
}
static int
{
}
int
{
char **serds, *p;
int i, rv;
do {
if (cs != RPC_SUCCESS)
}
}
serds[i] = p;
retries = 0;
do {
if (cs != RPC_SUCCESS) {
}
}
continue;
}
if (rv != 0)
break;
}
return (0);
}
int
{
int err;
do {
if (cs != RPC_SUCCESS)
}
int
{
uint_t i;
do {
if (cs != RPC_SUCCESS)
}
return (0);
}
int
{
do {
if (cs != RPC_SUCCESS)
}
return (0);
}
int
{
int err;
do {
if (cs != RPC_SUCCESS)
}
/*
* Custom XDR routine for our API structure fmd_stat_t. This function must
*/
{
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);
}