Skip Navigation Links
Exit Print View
| Oracle Solaris Cluster Reference Manual Oracle Solaris Cluster 4.1

Search Scope:

- This Document
- Entire Library

### 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:

handle

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

argc

  Number of arguments that is passed to the calling program.

argv

  Pointer to an argument array passed to the calling program.

## Errors

`SCHA_ERR_NOERR`

  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

`/usr/cluster/include/rgm/libdsdev.h`

  Include file

`/usr/cluster/lib/libdsdev.so`

  Library

## Attributes

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

ATTRIBUTE TYPE | ATTRIBUTE VALUE
--- | ---
Availability | ha-cluster/developer/api
Interface Stability | Evolving

## See Also

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

Copyright © 2000, 2012, Oracle and/or its affiliates. All rights reserved. Legal Notices |