/*
* 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
*/
/*
*/
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
#include <unistd.h>
#include <libintl.h>
#include <errno.h>
#include <time.h>
#include <string.h>
#include <assert.h>
#include <getopt.h>
#include <cmdparse.h>
#include <libstmf.h>
#include <signal.h>
#include <pthread.h>
#include <locale.h>
static int svcStart(int, char **, cmdOptions_t *, void *);
static int svcStop(int, char **, cmdOptions_t *, void *);
static int online();
/*
* MAJOR - This should only change when there is an incompatible change made
* to the interfaces or the output.
*
* MINOR - This should change whenever there is a new command or new feature
* with no incompatible change.
*/
/* 10 ms sleep in nanoseconds */
/* tables set up based on cmdparse instructions */
/* add new options here */
{NULL, 0, 0, 0}
};
/*
* Add new subcommands here
*/
};
/* globals */
char *cmdName;
/*
* svcStop
*
* Offlines the stmf service
*
*/
/*ARGSUSED*/
static int
void *args)
{
int stmfRet;
int ret = 0;
switch (stmfRet) {
case STMF_ERROR_PERM:
gettext("permission denied"));
break;
gettext("STMF service not found"));
break;
gettext("STMF service already offline"));
break;
default:
gettext("unable to offline service"));
break;
}
return (1);
}
/* wait for service offline */
while (!serviceOffline) {
if (stmfRet != STMF_STATUS_SUCCESS) {
ret = 1;
break;
}
} else {
}
}
return (ret);
}
/*
* loadConfig
*
* Loads the stmf config from the SMF repository
*
*/
/*ARGSUSED*/
static int
void *args)
{
int stmfRet;
int ret = 0;
(void) stmfLoadStmfProps();
switch (stmfRet) {
case STMF_ERROR_PERM:
gettext("permission denied"));
break;
gettext("STMF service not found"));
break;
gettext("STMF service must be offline"));
break;
default:
gettext("Unable to load the configuration. "
gettext("For information on reverting the "
"stmf:default instance to a previously "
"running configuration see the man page "
"for svccfg(1M)"));
gettext("After reverting the instance "
"you must clear the service maintenance "
"state. See the man page for svcadm(1M)"));
break;
}
return (1);
}
return (ret);
}
/*
* online
*
* Onlines the stmf service
*
*/
/*ARGSUSED*/
static int
online()
{
int stmfRet;
int ret = 0;
switch (stmfRet) {
case STMF_ERROR_PERM:
gettext("permission denied"));
break;
gettext("STMF service not found"));
break;
gettext("STMF service already online"));
break;
default:
gettext("unable to online service"));
break;
}
return (1);
}
/* wait for service online */
while (!serviceOnline) {
if (stmfRet != STMF_STATUS_SUCCESS) {
ret = 1;
break;
}
} else {
}
}
return (ret);
}
/*
* input:
* execFullName - exec name of program (argv[0])
*
* (changed name to lowerCamelCase to keep consistent with this file)
*
* Returns:
* command name portion of execFullName
*/
static char *
{
/* guard against '/' at end of command invocation */
for (;;) {
break;
} else {
if (*execBasename == '\0') {
*lastSlash = '\0';
continue;
}
break;
}
}
return (execBasename);
}
int
{
int ret;
int funcRet;
/* set global command name */
if (ret != 0) {
return (ret);
}
return (funcRet);
} /* end main */