Home | History | Annotate | Download | only in man3ha
 te
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 CDDL.txt
or http://www.opensolaris.org/os/licensing.
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 CDDL.txt.
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.
scds_initialize 3HA "13 Aug 2008" "Sun Cluster 3.2" "Sun Cluster HA and Data Services"
NAME
scds_initialize - allocate and initialize DSDL environment
SYNOPSIS

cc [flags.\|.\|.] -I /usr/cluster/include file -L /usr/cluster/lib  -l  dsdev
#include <rgm/libdsdev.h>

scha_err_t scds_initialize(scds_handle_t *handleint argc, char *argv[]);
DESCRIPTION

The scds_initialize() function initializes the DSDL environment. You must call this function once at the beginning of each program or fault monitor that uses any other DSDL functions.

The scds_initialize() function does the following:

Checks and processes the command line arguments (argc and argv[]) that the framework passes to the calling program and that must be passed along to scds_initialize(). No further processing of the command line arguments is required of the calling program. See EXAMPLES.

Sets up internal data structures with information needed by the other functions in the DSDL. It retrieves resource, resource type, and resource group property values and stores them in these data structures. Values for any properties supplied on the command line by means of the argv[] argument take precedence over those retrieved from the RGM. That is, if a new value for a property has been specified in the command line arguments (argv[]) passed to the data service method, then this new value is returned by the function that retrieves that property's value. Otherwise, the existing value retrieved from the RGM is returned.

Initializes the data service fault monitoring information

Initializes the logging environment. All syslog messages are prefixed with: SC[<resourceTypeName>,<resourceGroupName>,<resourceName>,<methodName> Functions that send messages to syslog use the facility returned by scha_cluster_getlogfacility(). These messages can be forwarded to appropriate log files and users. See syslog.conf(4) for more information.

Validates fault monitor probe settings. It verifies that the Retry_interval is greater than or equal to (Thorough_probe_interval * Retry_count). If this is not true, it sends an appropriate message to the syslog facility. You could call scds_initialize() and scds_close() in a VALIDATE method for this validation of the fault monitor probe settings even if you call no other DSDL functions in the VALIDATE method.

If scds_initialize() succeeds, you must call scds_close() before exiting the calling program.

If scds_initialize() fails, you must not call scds_close() to clean up. When scds_initialize() fails, do not call any other DSDL functions. Otherwise, they return SCHA_ERR_INVAL or a NULL value. Instead, call exit() with a non-zero argument.

PARAMETERS

The following parameters are supported:

.na handle .ad A handle initialized by scds_initialize() and used by other DSDL functions.

.na argc .ad Number of arguments that is passed to the calling program.

.na argv .ad Pointer to an argument array passed to the calling program.

ERRORS

.na SCHA_ERR_NOERR .ad The function succeeded.

See scha_calls(3HA) for a description of other error codes.

EXAMPLES

Example 1 Using scds_initialize()

int main(int argc, char *argv[]){
scds_handle_t handle;

if (scds_initialize(&handle, argc, argv) !=
SCHA_ERR_NOERR)
exit(1);
...
/* data service code */
...
scds_close(&handle);
}
FILES

.na /usr/cluster/include/rgm/libdsdev.h .ad Include file

.na /usr/cluster/lib/libdsdev.so .ad Library

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
AvailabilitySUNWscdev
Interface StabilityEvolving
SEE ALSO

scds_close(3HA), scds_property_functions(3HA), scha_calls(3HA), scha_cluster_getlogfacility(3HA), syslog.conf(4), r_properties(5)