Sun Cluster 3.1 Data Services Developer's Guide

Starting the Service

The xfnts_start method calls the svc_start method, defined in xfnts.c to start the xfs daemon. This section describes svc_start.

The command to launch the xfs daemon is as follows.

xfs -config config_directory/fontserver.cfg -port port_number

The Confdir_list extension property identifies the config_directory while the Port_list system property identifies the port_number. When the cluster administrator configures the data service, he provides specific values for these properties.

The xfnts_start method declares these properties as string arrays and obtains the values the administrator sets using the scds_get_ext_confdir_list(3HA) and scds_get_port_list(3HA) functions, as follows.

Example 8–4

scha_str_array_t *confdirs;
scds_port_list_t    *portlist;
scha_err_t   err;

   /* get the configuration directory from the confdir_list property */
   confdirs = scds_get_ext_confdir_list(scds_handle);

   (void) sprintf(xfnts_conf, "%s/fontserver.cfg", confdirs->str_array[0]);

   /* obtain the port to be used by XFS from the Port_list property */
   err = scds_get_port_list(scds_handle, &portlist);
   if (err != SCHA_ERR_NOERR) {
          "Could not access property Port_list.");
      return (1);

Note that the confdirs variable points to the first element (0) of the array.

The xfnts_start method uses sprintf to form the command line for xfs as follows.

Example 8–5

/* Construct the command to start the xfs daemon. */
   (void) sprintf(cmd,
       "/usr/openwin/bin/xfs -config %s -port %d 2>/dev/null",
       xfnts_conf, portlist->ports[0].port);

Note that he output is redirected to dev/null to suppress messages generated by the daemon.

The xfnts_start method passes the xfs command line to scds_pmf_start to start the data service under control of PMF, as follows.

Example 8–6

scds_syslog(LOG_INFO, "Issuing a start request.");
   err = scds_pmf_start(scds_handle, SCDS_PMF_TYPE_SVC,

   if (err == SCHA_ERR_NOERR) {
          "Start command completed successfully.");
   } else {
          "Failed to start HA-XFS ");

Note the following about the call to scds_pmf_start.

Before returning, svc_pmf_start frees the memory allocated for the portlist structure, as follows.

return (err);