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() and scds_get_port_list() functions (described in scds_property_functions(3HA)), as follows.
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) { scds_syslog(LOG_ERR, "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.
/* 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.
scds_syslog(LOG_INFO, "Issuing a start request."); err = scds_pmf_start(scds_handle, SCDS_PMF_TYPE_SVC, SCDS_PMF_SINGLE_INSTANCE, cmd, -1); if (err == SCHA_ERR_NOERR) { scds_syslog(LOG_INFO, "Start command completed successfully."); } else { scds_syslog(LOG_ERR, "Failed to start HA-XFS "); }
Note the following points about the call to scds_pmf_start().
The SCDS_PMF_TYPE_SVC parameter identifies the program to start as a data service application—this method can also start a fault monitor or some other type of application.
The SCDS_PMF_SINGLE_INSTANCE parameter identifies this as a single-instance resource.
The cmd parameter is the command line generated previously.
The final parameter, -1, specifies the child monitoring level. The -1 specifies that PMF monitor all children as well as the original process.
Before returning, svc_pmf_start() frees the memory allocated for the portlist structure, as follows.
scds_free_port_list(portlist); return (err); |