fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
4b31676f89e318c11400fc0c4defc802da29222fsrivijitha dugganapalli * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int svcStart(int, char **, cmdOptions_t *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int svcStop(int, char **, cmdOptions_t *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int online();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * MAJOR - This should only change when there is an incompatible change made
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to the interfaces or the output.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * MINOR - This should change whenever there is a new command or new feature
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * with no incompatible change.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* 10 ms sleep in nanoseconds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* tables set up based on cmdparse instructions */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* add new options here */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Add new subcommands here
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"start", svcStart, NULL, NULL, NULL, OPERAND_NONE, NULL},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"stop", svcStop, NULL, NULL, NULL, OPERAND_NONE, NULL},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* globals */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Offlines the stmf service
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortesvcStop(int operandLen, char *operands[], cmdOptions_t *options,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((stmfRet = stmfOffline()) != STMF_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* wait for service offline */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (state.operationalState == STMF_SERVICE_STATE_OFFLINE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * loadConfig
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Loads the stmf config from the SMF repository
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortesvcStart(int operandLen, char *operands[], cmdOptions_t *options,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((stmfRet = stmfLoadConfig()) != STMF_STATUS_SUCCESS) {
86b7dbefda771542da92c8e031c0153fd809ff01Peter Gill "See /var/adm/messages for details"));
86b7dbefda771542da92c8e031c0153fd809ff01Peter Gill "stmf:default instance to a previously "
86b7dbefda771542da92c8e031c0153fd809ff01Peter Gill "running configuration see the man page "
86b7dbefda771542da92c8e031c0153fd809ff01Peter Gill "for svccfg(1M)"));
86b7dbefda771542da92c8e031c0153fd809ff01Peter Gill "you must clear the service maintenance "
86b7dbefda771542da92c8e031c0153fd809ff01Peter Gill "state. See the man page for svcadm(1M)"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Onlines the stmf service
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((stmfRet = stmfOnline()) != STMF_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* wait for service online */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (state.operationalState == STMF_SERVICE_STATE_ONLINE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * execFullName - exec name of program (argv[0])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * copied from usr/src/cmd/zoneadm/zoneadm.c in OS/Net
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (changed name to lowerCamelCase to keep consistent with this file)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * command name portion of execFullName
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* guard against '/' at end of command invocation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set global command name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(versionString, VERSION_STRING_MAX_LEN, "%s.%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = cmdParse(argc, argv, synTables, subcommandArgs, &funcRet);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* end main */