xref: /titanic_52/usr/src/lib/librestart/common/librestart.h (revision ac0324d26eb303fa7f174e9ed0543767cca4ad95)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52c65c8b0Srm88369  * Common Development and Distribution License (the "License").
62c65c8b0Srm88369  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22f6e214c7SGavin Maltby  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate #ifndef	_LIBRESTART_H
267c478bd9Sstevel@tonic-gate #define	_LIBRESTART_H
277c478bd9Sstevel@tonic-gate 
282c65c8b0Srm88369 #include <libsysevent.h>
297c478bd9Sstevel@tonic-gate #include <libcontract.h>
307c478bd9Sstevel@tonic-gate #include <libscf.h>
317c478bd9Sstevel@tonic-gate #include <limits.h>
327c478bd9Sstevel@tonic-gate #include <priv.h>
337c478bd9Sstevel@tonic-gate #include <pwd.h>
347c478bd9Sstevel@tonic-gate #include <sys/types.h>
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
377c478bd9Sstevel@tonic-gate extern "C" {
387c478bd9Sstevel@tonic-gate #endif
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * There are 3 parts to librestart.
427c478bd9Sstevel@tonic-gate  *	1) The event protocol from the master restarter to its delegates.
437c478bd9Sstevel@tonic-gate  *	2) A functional interface for updating the repository.
447c478bd9Sstevel@tonic-gate  *	3) Convenience functions for common restarter tasks.
457c478bd9Sstevel@tonic-gate  *
467c478bd9Sstevel@tonic-gate  * Event protocol
477c478bd9Sstevel@tonic-gate  *	We need a reliable event protocol, as there's no way to define
487c478bd9Sstevel@tonic-gate  *	restarter events as idempotent.
497c478bd9Sstevel@tonic-gate  *
507c478bd9Sstevel@tonic-gate  *	Currently using sysevent channels as the reliable event implementation.
517c478bd9Sstevel@tonic-gate  *	This could change if the implementation proves unsuitable, but
527c478bd9Sstevel@tonic-gate  *	the API defined here should abstract anything but a change in
537c478bd9Sstevel@tonic-gate  *	the fundamental event model.
547c478bd9Sstevel@tonic-gate  *
557c478bd9Sstevel@tonic-gate  *	We offer functions to tease apart the event rather than generic
567c478bd9Sstevel@tonic-gate  *	nvpair interfaces. This is because each event type has a well-
577c478bd9Sstevel@tonic-gate  *	defined set of fields.
587c478bd9Sstevel@tonic-gate  */
597c478bd9Sstevel@tonic-gate 
60eb1a3463STruong Nguyen /*
61eb1a3463STruong Nguyen  * Some of the functions have external contracted consumers, review contracts
62eb1a3463STruong Nguyen  * when making incompatible changes.
63eb1a3463STruong Nguyen  */
64eb1a3463STruong Nguyen 
657c478bd9Sstevel@tonic-gate typedef struct restarter_event_handle restarter_event_handle_t;
667c478bd9Sstevel@tonic-gate typedef struct restarter_event restarter_event_t;
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate typedef uint32_t restarter_event_type_t;
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /*
717c478bd9Sstevel@tonic-gate  * Define an event protocol version. In theory, we could use this in
727c478bd9Sstevel@tonic-gate  * the future to support delegated restarters which use an older
737c478bd9Sstevel@tonic-gate  * protocol. In practice, increment RESTARTER_EVENT_VERSION whenever the
747c478bd9Sstevel@tonic-gate  * protocol might have changed.
757c478bd9Sstevel@tonic-gate  */
76f6e214c7SGavin Maltby #define	RESTARTER_EVENT_VERSION		5
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate #define	RESTARTER_FLAG_DEBUG		1
797c478bd9Sstevel@tonic-gate 
80870ad75aSSean Wilcox #define	RESTARTER_ERRMSGSZ		1024
81870ad75aSSean Wilcox 
827c478bd9Sstevel@tonic-gate /*
837c478bd9Sstevel@tonic-gate  * Event types
847c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_ADD_INSTANCE
857c478bd9Sstevel@tonic-gate  *		responsible for a new (stopped) instance
867c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_REMOVE_INSTANCE
877c478bd9Sstevel@tonic-gate  *		no longer responsible for this instance; stop it and return
887c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_ENABLE
897c478bd9Sstevel@tonic-gate  *		no guarantee that dependencies are met; see
907c478bd9Sstevel@tonic-gate  *		RESTARTER_EVENT_TYPE_START
917c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_DISABLE
927c478bd9Sstevel@tonic-gate  *		no guarantee that instance was running
937c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_ADMIN_DEGRADED
947c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_ADMIN_REFRESH
957c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_ADMIN_RESTART
967c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_ADMIN_MAINT_OFF
977c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_ADMIN_MAINT_ON
987c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_ADMIN_MAINT_ON_IMMEDIATE
997c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_ADMIN_MAINT_OFF
1007c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_STOP
1017c478bd9Sstevel@tonic-gate  *		dependencies are, or are becoming, unsatisfied
1027c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_START
1037c478bd9Sstevel@tonic-gate  *		dependencies have become satisfied
1047c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_DEPENDENCY_CYCLE
1057c478bd9Sstevel@tonic-gate  *		instance caused a dependency cycle
1067c478bd9Sstevel@tonic-gate  *	RESTARTER_EVENT_TYPE_INVALID_DEPENDENCY
1077c478bd9Sstevel@tonic-gate  *		instance has an invalid dependency
1087c478bd9Sstevel@tonic-gate  */
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_INVALID			0
1117c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_ADD_INSTANCE		1
1127c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_REMOVE_INSTANCE		2
1137c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_ENABLE			3
1147c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_DISABLE			4
1157c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_ADMIN_DEGRADED		5
1167c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_ADMIN_REFRESH		6
1177c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_ADMIN_RESTART		7
1187c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_ADMIN_MAINT_OFF		8
1197c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_ADMIN_MAINT_ON		9
1207c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_ADMIN_MAINT_ON_IMMEDIATE	10
1217c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_STOP			11
1227c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_START			12
1237c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_DEPENDENCY_CYCLE		13
1247c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_INVALID_DEPENDENCY		14
1257c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_TYPE_ADMIN_DISABLE		15
12616ba0facSSean Wilcox #define	RESTARTER_EVENT_TYPE_STOP_RESET			16
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_ERROR			-1
1297c478bd9Sstevel@tonic-gate 
1307c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_INSTANCE_DISABLED	0
1317c478bd9Sstevel@tonic-gate #define	RESTARTER_EVENT_INSTANCE_ENABLED	1
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate typedef enum {
1347c478bd9Sstevel@tonic-gate 	RESTARTER_STATE_NONE,
1357c478bd9Sstevel@tonic-gate 	RESTARTER_STATE_UNINIT,
1367c478bd9Sstevel@tonic-gate 	RESTARTER_STATE_MAINT,
1377c478bd9Sstevel@tonic-gate 	RESTARTER_STATE_OFFLINE,
1387c478bd9Sstevel@tonic-gate 	RESTARTER_STATE_DISABLED,
1397c478bd9Sstevel@tonic-gate 	RESTARTER_STATE_ONLINE,
1407c478bd9Sstevel@tonic-gate 	RESTARTER_STATE_DEGRADED
1417c478bd9Sstevel@tonic-gate } restarter_instance_state_t;
1427c478bd9Sstevel@tonic-gate 
1437c478bd9Sstevel@tonic-gate /*
1447c478bd9Sstevel@tonic-gate  * These values are ordered by severity of required restart, as we use
1457c478bd9Sstevel@tonic-gate  * integer comparisons to determine error flow.
1467c478bd9Sstevel@tonic-gate  */
1477c478bd9Sstevel@tonic-gate typedef enum {
1487c478bd9Sstevel@tonic-gate 	RERR_UNSUPPORTED = -1,
1497c478bd9Sstevel@tonic-gate 	RERR_NONE = 0,			/* no error, restart, refresh */
1507c478bd9Sstevel@tonic-gate 	RERR_FAULT,			/* fault occurred */
1517c478bd9Sstevel@tonic-gate 	RERR_RESTART,			/* transition due to restart */
1527c478bd9Sstevel@tonic-gate 	RERR_REFRESH			/* transition due to refresh */
1537c478bd9Sstevel@tonic-gate } restarter_error_t;
1547c478bd9Sstevel@tonic-gate /*
1557c478bd9Sstevel@tonic-gate  * restarter_store_contract() and restarter_remove_contract() types
1567c478bd9Sstevel@tonic-gate  */
1577c478bd9Sstevel@tonic-gate typedef enum {
1587c478bd9Sstevel@tonic-gate 	RESTARTER_CONTRACT_PRIMARY,
1597c478bd9Sstevel@tonic-gate 	RESTARTER_CONTRACT_TRANSIENT
1607c478bd9Sstevel@tonic-gate } restarter_contract_type_t;
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate /*
1637c478bd9Sstevel@tonic-gate  * restarter_bind_handle() registers a delegate with svc.startd to
1647c478bd9Sstevel@tonic-gate  * begin consuming events.
1657c478bd9Sstevel@tonic-gate  *
1667c478bd9Sstevel@tonic-gate  * On initial bind, the delgated restarter receives an event for each
1677c478bd9Sstevel@tonic-gate  * instance it is responsible for, as if that instance was new.
1687c478bd9Sstevel@tonic-gate  *
1697c478bd9Sstevel@tonic-gate  * callers must have superuser privileges
1707c478bd9Sstevel@tonic-gate  *
1717c478bd9Sstevel@tonic-gate  * The event handler can return 0 for success, or EAGAIN to request
1727c478bd9Sstevel@tonic-gate  * retry of event delivery. EAGAIN may be returned 3 times before the
1737c478bd9Sstevel@tonic-gate  * event is discarded.
1747c478bd9Sstevel@tonic-gate  */
1757c478bd9Sstevel@tonic-gate int restarter_bind_handle(uint32_t, const char *,
1767c478bd9Sstevel@tonic-gate     int (*event_handler)(restarter_event_t *), int,
1777c478bd9Sstevel@tonic-gate     restarter_event_handle_t **);
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate restarter_event_type_t restarter_event_get_type(restarter_event_t *);
1807c478bd9Sstevel@tonic-gate uint64_t restarter_event_get_seq(restarter_event_t *);
1817c478bd9Sstevel@tonic-gate void restarter_event_get_time(restarter_event_t *, hrtime_t *);
1827c478bd9Sstevel@tonic-gate ssize_t restarter_event_get_instance(restarter_event_t *, char *, size_t);
1837c478bd9Sstevel@tonic-gate restarter_event_handle_t *restarter_event_get_handle(restarter_event_t *);
1847c478bd9Sstevel@tonic-gate 
1857c478bd9Sstevel@tonic-gate /*
1867c478bd9Sstevel@tonic-gate  * The following functions work only on certain types of events.
1877c478bd9Sstevel@tonic-gate  * They fail with a return of -1 if they're called on an inappropriate event.
1887c478bd9Sstevel@tonic-gate  */
1897c478bd9Sstevel@tonic-gate int restarter_event_get_enabled(restarter_event_t *);
1907c478bd9Sstevel@tonic-gate int restarter_event_get_current_states(restarter_event_t *,
1917c478bd9Sstevel@tonic-gate     restarter_instance_state_t *, restarter_instance_state_t *);
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate /*
194f6e214c7SGavin Maltby  * State transition reasons
195f6e214c7SGavin Maltby  */
196f6e214c7SGavin Maltby 
197f6e214c7SGavin Maltby typedef enum {
198f6e214c7SGavin Maltby 	restarter_str_none,
199f6e214c7SGavin Maltby 	restarter_str_administrative_request,
200f6e214c7SGavin Maltby 	restarter_str_bad_repo_state,
201f6e214c7SGavin Maltby 	restarter_str_clear_request,
202f6e214c7SGavin Maltby 	restarter_str_ct_ev_core,
203f6e214c7SGavin Maltby 	restarter_str_ct_ev_exit,
204f6e214c7SGavin Maltby 	restarter_str_ct_ev_hwerr,
205f6e214c7SGavin Maltby 	restarter_str_ct_ev_signal,
206f6e214c7SGavin Maltby 	restarter_str_dependencies_satisfied,
207f6e214c7SGavin Maltby 	restarter_str_dependency_activity,
208f6e214c7SGavin Maltby 	restarter_str_dependency_cycle,
209f6e214c7SGavin Maltby 	restarter_str_disable_request,
210f6e214c7SGavin Maltby 	restarter_str_enable_request,
211f6e214c7SGavin Maltby 	restarter_str_fault_threshold_reached,
212f6e214c7SGavin Maltby 	restarter_str_insert_in_graph,
213f6e214c7SGavin Maltby 	restarter_str_invalid_dependency,
214f6e214c7SGavin Maltby 	restarter_str_invalid_restarter,
215f6e214c7SGavin Maltby 	restarter_str_method_failed,
216f6e214c7SGavin Maltby 	restarter_str_per_configuration,
217f6e214c7SGavin Maltby 	restarter_str_refresh,
218f6e214c7SGavin Maltby 	restarter_str_restart_request,
219f6e214c7SGavin Maltby 	restarter_str_restarting_too_quickly,
220f6e214c7SGavin Maltby 	restarter_str_service_request,
221f6e214c7SGavin Maltby 	restarter_str_startd_restart
222f6e214c7SGavin Maltby } restarter_str_t;
223f6e214c7SGavin Maltby 
224f6e214c7SGavin Maltby struct restarter_state_transition_reason {
225f6e214c7SGavin Maltby 	restarter_str_t	str_key;
226f6e214c7SGavin Maltby 	const char	*str_short;
227f6e214c7SGavin Maltby 	const char	*str_long;
228f6e214c7SGavin Maltby };
229f6e214c7SGavin Maltby 
230f6e214c7SGavin Maltby /*
2317c478bd9Sstevel@tonic-gate  * Functions for updating the repository.
2327c478bd9Sstevel@tonic-gate  */
233eb1a3463STruong Nguyen 
234eb1a3463STruong Nguyen /*
235eb1a3463STruong Nguyen  * When setting state to "maintenance", callers of restarter_set_states() can
236eb1a3463STruong Nguyen  * set aux_state to "service_request" to communicate that another service has
237eb1a3463STruong Nguyen  * requested maintenance state for the target service.
238eb1a3463STruong Nguyen  *
239eb1a3463STruong Nguyen  * Callers should use restarter_inst_validate_aux_fmri() to validate the fmri
240eb1a3463STruong Nguyen  * of the requested service and pass "service_request" for aux_state when
241eb1a3463STruong Nguyen  * calling restarter_set_states(). See inetd and startd for examples.
242eb1a3463STruong Nguyen  */
2437c478bd9Sstevel@tonic-gate int restarter_set_states(restarter_event_handle_t *, const char *,
2447c478bd9Sstevel@tonic-gate     restarter_instance_state_t, restarter_instance_state_t,
2457c478bd9Sstevel@tonic-gate     restarter_instance_state_t, restarter_instance_state_t, restarter_error_t,
246f6e214c7SGavin Maltby     restarter_str_t);
2472c65c8b0Srm88369 int restarter_event_publish_retry(evchan_t *, const char *, const char *,
2482c65c8b0Srm88369     const char *, const char *, nvlist_t *, uint32_t);
2497c478bd9Sstevel@tonic-gate 
250f6e214c7SGavin Maltby /*
251f6e214c7SGavin Maltby  * functions for retrieving the state transition reason messages
252f6e214c7SGavin Maltby  */
253f6e214c7SGavin Maltby 
254f6e214c7SGavin Maltby #define	RESTARTER_STRING_VERSION	1
255f6e214c7SGavin Maltby 
256f6e214c7SGavin Maltby uint32_t restarter_str_version(void);
257f6e214c7SGavin Maltby const char *restarter_get_str_short(restarter_str_t);
258f6e214c7SGavin Maltby const char *restarter_get_str_long(restarter_str_t);
259f6e214c7SGavin Maltby 
2607c478bd9Sstevel@tonic-gate int restarter_store_contract(scf_instance_t *, ctid_t,
2617c478bd9Sstevel@tonic-gate     restarter_contract_type_t);
2627c478bd9Sstevel@tonic-gate int restarter_remove_contract(scf_instance_t *, ctid_t,
2637c478bd9Sstevel@tonic-gate     restarter_contract_type_t);
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate ssize_t restarter_state_to_string(restarter_instance_state_t, char *, size_t);
2667c478bd9Sstevel@tonic-gate restarter_instance_state_t restarter_string_to_state(char *);
2677c478bd9Sstevel@tonic-gate 
268870ad75aSSean Wilcox #define	RESTARTER_METHOD_CONTEXT_VERSION	7
2697c478bd9Sstevel@tonic-gate 
2707c478bd9Sstevel@tonic-gate struct method_context {
2717c478bd9Sstevel@tonic-gate 	/* Stable */
2727c478bd9Sstevel@tonic-gate 	uid_t		uid, euid;
2737c478bd9Sstevel@tonic-gate 	gid_t		gid, egid;
2747c478bd9Sstevel@tonic-gate 	int		ngroups;		/* -1 means use initgroups(). */
27513d8aaa1SSean Wilcox 	gid_t		groups[NGROUPS_MAX];
2767c478bd9Sstevel@tonic-gate 	priv_set_t	*lpriv_set, *priv_set;
2777c478bd9Sstevel@tonic-gate 	char		*corefile_pattern;	/* Optional. */
2787c478bd9Sstevel@tonic-gate 	char		*project;		/* NULL for no change */
2797c478bd9Sstevel@tonic-gate 	char		*resource_pool;		/* NULL for project default */
2807c478bd9Sstevel@tonic-gate 	char		*working_dir;		/* NULL for :default */
2817c478bd9Sstevel@tonic-gate 	char		**env;			/* NULL for no env */
2827c478bd9Sstevel@tonic-gate 	size_t		env_sz;			/* size of env array */
2837c478bd9Sstevel@tonic-gate 
2847c478bd9Sstevel@tonic-gate 	/* Private */
2857c478bd9Sstevel@tonic-gate 	char		*vbuf;
2867c478bd9Sstevel@tonic-gate 	ssize_t		vbuf_sz;
2877c478bd9Sstevel@tonic-gate 	struct passwd	pwd;
2887c478bd9Sstevel@tonic-gate 	char		*pwbuf;
2897c478bd9Sstevel@tonic-gate 	ssize_t		pwbufsz;
2907c478bd9Sstevel@tonic-gate };
2917c478bd9Sstevel@tonic-gate 
292870ad75aSSean Wilcox /*
293870ad75aSSean Wilcox  * An error structure that contains a message string, and a type
294870ad75aSSean Wilcox  * that can be used to determine course of action by the reciever
295870ad75aSSean Wilcox  * of the error structure.
296870ad75aSSean Wilcox  *
297870ad75aSSean Wilcox  * type - usually will be an errno equivalent but could contain
298870ad75aSSean Wilcox  * 	defined error types for exampe SCF_ERROR_XXX
299870ad75aSSean Wilcox  * msg - must be at the end of the structure as if the message is
300870ad75aSSean Wilcox  * 	longer than EMSGSIZE we will reallocate the structure to
301870ad75aSSean Wilcox  * 	handle the overflow
302870ad75aSSean Wilcox  */
303870ad75aSSean Wilcox typedef struct mc_error {
304870ad75aSSean Wilcox 	int	destroy;	/* Flag to indicate destruction steps */
305870ad75aSSean Wilcox 	int	type;		/* Type of error for decision making */
306870ad75aSSean Wilcox 	int	size;		/* The size of the error message string */
307870ad75aSSean Wilcox 	char 	msg[RESTARTER_ERRMSGSZ];
308870ad75aSSean Wilcox } mc_error_t;
309870ad75aSSean Wilcox 
3107c478bd9Sstevel@tonic-gate int restarter_rm_libs_loadable(void);
3117c478bd9Sstevel@tonic-gate /* instance, restarter name, method name, command line, structure pointer */
312870ad75aSSean Wilcox mc_error_t *restarter_get_method_context(uint_t, scf_instance_t *,
3137c478bd9Sstevel@tonic-gate     scf_snapshot_t *, const char *, const char *, struct method_context **);
314870ad75aSSean Wilcox void restarter_mc_error_destroy(mc_error_t *);
3157c478bd9Sstevel@tonic-gate int restarter_set_method_context(struct method_context *, const char **);
3167c478bd9Sstevel@tonic-gate void restarter_free_method_context(struct method_context *);
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate int restarter_is_null_method(const char *);
3207c478bd9Sstevel@tonic-gate int restarter_is_kill_method(const char *);
3217c478bd9Sstevel@tonic-gate int restarter_is_kill_proc_method(const char *);
3227c478bd9Sstevel@tonic-gate 
323eb1a3463STruong Nguyen /* Validate the inst fmri specified in  restarter_actions/auxiliary_fmri */
324eb1a3463STruong Nguyen int restarter_inst_validate_ractions_aux_fmri(scf_instance_t *);
325eb1a3463STruong Nguyen 
326eb1a3463STruong Nguyen /* Delete instance's restarter_actions/auxiliary_fmri property */
327eb1a3463STruong Nguyen int restarter_inst_reset_ractions_aux_fmri(scf_instance_t *);
328eb1a3463STruong Nguyen 
329eb1a3463STruong Nguyen /* Get boolean value from instance's restarter_actions/auxiliary_tty */
330eb1a3463STruong Nguyen int restarter_inst_ractions_from_tty(scf_instance_t *);
331eb1a3463STruong Nguyen 
332eb1a3463STruong Nguyen /* Delete instance's restarter/auxiliary_fmri property */
333eb1a3463STruong Nguyen int restarter_inst_reset_aux_fmri(scf_instance_t *);
334eb1a3463STruong Nguyen 
335*ac0324d2SJerry Jelinek /* Get boolean value from instance's restarter_actions/do_dump */
336*ac0324d2SJerry Jelinek int restarter_inst_dump(scf_instance_t *);
337*ac0324d2SJerry Jelinek 
338eb1a3463STruong Nguyen /*
339eb1a3463STruong Nguyen  * Set instance's restarter/auxiliary_fmri, value come from
340eb1a3463STruong Nguyen  * restarter_actions/auxliary_fmri
341eb1a3463STruong Nguyen  */
342eb1a3463STruong Nguyen int restarter_inst_set_aux_fmri(scf_instance_t *);
343eb1a3463STruong Nguyen 
3447c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3457c478bd9Sstevel@tonic-gate }
3467c478bd9Sstevel@tonic-gate #endif
3477c478bd9Sstevel@tonic-gate 
3487c478bd9Sstevel@tonic-gate #endif	/* _LIBRESTART_H */
349