2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A * There are 3 parts to librestart. 2N/A * 1) The event protocol from the master restarter to its delegates. 2N/A * 2) A functional interface for updating the repository. 2N/A * 3) Convenience functions for common restarter tasks. 2N/A * We need a reliable event protocol, as there's no way to define 2N/A * restarter events as idempotent. 2N/A * Currently using sysevent channels as the reliable event implementation. 2N/A * This could change if the implementation proves unsuitable, but 2N/A * the API defined here should abstract anything but a change in 2N/A * the fundamental event model. 2N/A * We offer functions to tease apart the event rather than generic 2N/A * nvpair interfaces. This is because each event type has a well- 2N/A * defined set of fields. 2N/A * Some of the functions have external contracted consumers, review contracts 2N/A * when making incompatible changes. 2N/A * Define an event protocol version. In theory, we could use this in 2N/A * the future to support delegated restarters which use an older 2N/A * protocol. In practice, increment RESTARTER_EVENT_VERSION whenever the 2N/A * protocol might have changed. 2N/A * RESTARTER_EVENT_TYPE_ADD_INSTANCE 2N/A * responsible for a new (stopped) instance 2N/A * RESTARTER_EVENT_TYPE_REMOVE_INSTANCE 2N/A * no longer responsible for this instance; stop it and return 2N/A * RESTARTER_EVENT_TYPE_ENABLE 2N/A * no guarantee that dependencies are met; see 2N/A * RESTARTER_EVENT_TYPE_START 2N/A * RESTARTER_EVENT_TYPE_DISABLE 2N/A * no guarantee that instance was running 2N/A * RESTARTER_EVENT_TYPE_ADMIN_DEGRADED 2N/A * RESTARTER_EVENT_TYPE_ADMIN_REFRESH 2N/A * RESTARTER_EVENT_TYPE_ADMIN_RESTART 2N/A * RESTARTER_EVENT_TYPE_ADMIN_MAINT_OFF 2N/A * RESTARTER_EVENT_TYPE_ADMIN_MAINT_ON 2N/A * RESTARTER_EVENT_TYPE_ADMIN_MAINT_ON_IMMEDIATE 2N/A * RESTARTER_EVENT_TYPE_ADMIN_MAINT_OFF 2N/A * RESTARTER_EVENT_TYPE_STOP 2N/A * dependencies are, or are becoming, unsatisfied 2N/A * RESTARTER_EVENT_TYPE_START 2N/A * dependencies have become satisfied 2N/A * RESTARTER_EVENT_TYPE_DEPENDENCY_CYCLE 2N/A * instance caused a dependency cycle 2N/A * RESTARTER_EVENT_TYPE_INVALID_DEPENDENCY 2N/A * instance has an invalid dependency 2N/A * These values are ordered by severity of required restart, as we use 2N/A * integer comparisons to determine error flow. 2N/A * restarter_store_contract() and restarter_remove_contract() types 2N/A * restarter_bind_handle() registers a delegate with svc.startd to 2N/A * begin consuming events. 2N/A * On initial bind, the delgated restarter receives an event for each 2N/A * instance it is responsible for, as if that instance was new. 2N/A * callers must have superuser privileges 2N/A * The event handler can return 0 for success, or EAGAIN to request 2N/A * retry of event delivery. EAGAIN may be returned 3 times before the 2N/A * event is discarded. 2N/A * The following functions work only on certain types of events. 2N/A * They fail with a return of -1 if they're called on an inappropriate event. 2N/A * State transition reasons 2N/A * Functions for updating the repository. 2N/A * When setting state to "maintenance", callers of restarter_set_states() can 2N/A * set aux_state to "service_request" to communicate that another service has 2N/A * requested maintenance state for the target service. 2N/A * Callers should use restarter_inst_validate_aux_fmri() to validate the fmri 2N/A * of the requested service and pass "service_request" for aux_state when 2N/A * calling restarter_set_states(). See inetd and startd for examples. 2N/A * functions for retrieving the state transition reason messages 2N/A char **
env;
/* NULL for no env */ 2N/A * An error structure that contains a message string, and a type 2N/A * that can be used to determine course of action by the reciever 2N/A * of the error structure. 2N/A * type - usually will be an errno equivalent but could contain 2N/A * defined error types for exampe SCF_ERROR_XXX 2N/A * msg - must be at the end of the structure as if the message is 2N/A * longer than EMSGSIZE we will reallocate the structure to 2N/A * handle the overflow 2N/A int destroy;
/* Flag to indicate destruction steps */ 2N/A int type;
/* Type of error for decision making */ 2N/A int size;
/* The size of the error message string */ 2N/A/* instance, restarter name, method name, command line, structure pointer */ 2N/A#
endif /* _LIBRESTART_H */