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
594501b61Sskamm  * Common Development and Distribution License (the "License").
694501b61Sskamm  * 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 /*
22*7b209c2cSacruz  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _INETD_IMPL_H
277c478bd9Sstevel@tonic-gate #define	_INETD_IMPL_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate /*
337c478bd9Sstevel@tonic-gate  * Header file containing inetd's shared types/data structures and
347c478bd9Sstevel@tonic-gate  * function declarations.
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #ifdef __cplusplus
387c478bd9Sstevel@tonic-gate extern "C" {
397c478bd9Sstevel@tonic-gate #endif
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #include <sys/types.h>
427c478bd9Sstevel@tonic-gate #include <sys/socket.h>
437c478bd9Sstevel@tonic-gate #include <stdarg.h>
447c478bd9Sstevel@tonic-gate #include <rpc/rpc.h>
457c478bd9Sstevel@tonic-gate #include <assert.h>
467c478bd9Sstevel@tonic-gate #include <libscf.h>
477c478bd9Sstevel@tonic-gate #include <libinetutil.h>
487c478bd9Sstevel@tonic-gate #include <inetsvc.h>
497c478bd9Sstevel@tonic-gate #include <librestart.h>
507c478bd9Sstevel@tonic-gate #include <libuutil.h>
517c478bd9Sstevel@tonic-gate #include <wordexp.h>
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate /*
557c478bd9Sstevel@tonic-gate  * Number of consecutive retries of a repository operation that failed due
567c478bd9Sstevel@tonic-gate  * to a broken connection performed before giving up and failing.
577c478bd9Sstevel@tonic-gate  */
587c478bd9Sstevel@tonic-gate #define	REP_OP_RETRIES 10
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate /* retryable SMF method error */
617c478bd9Sstevel@tonic-gate #define	SMF_EXIT_ERR_OTHER 1
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /* inetd's syslog ident string */
647c478bd9Sstevel@tonic-gate #define	SYSLOG_IDENT    "inetd"
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate /* Is this instance currently executing a method ? */
677c478bd9Sstevel@tonic-gate #define	INST_IN_TRANSITION(i)	((i)->next_istate != IIS_NONE)
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /* Names of properties that inetd uses to store instance state. */
707c478bd9Sstevel@tonic-gate #define	PR_NAME_NON_START_PID	"non_start_pid"
717c478bd9Sstevel@tonic-gate #define	PR_NAME_START_PIDS	"start_pids"
727c478bd9Sstevel@tonic-gate #define	PR_NAME_CUR_INT_STATE	"cur_state"
737c478bd9Sstevel@tonic-gate #define	PR_NAME_NEXT_INT_STATE	"next_state"
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate /*
767c478bd9Sstevel@tonic-gate  * Instance states used internal to svc.inetd.
777c478bd9Sstevel@tonic-gate  * NOTE: The states table in cmd/cmd-inetd/inetd/inetd.c relies on the
787c478bd9Sstevel@tonic-gate  * ordering of this enumeration, so take care if modifying it.
797c478bd9Sstevel@tonic-gate  */
807c478bd9Sstevel@tonic-gate typedef enum {
817c478bd9Sstevel@tonic-gate 	IIS_UNINITIALIZED,
827c478bd9Sstevel@tonic-gate 	IIS_ONLINE,
837c478bd9Sstevel@tonic-gate 	IIS_IN_ONLINE_METHOD,
847c478bd9Sstevel@tonic-gate 	IIS_OFFLINE,
857c478bd9Sstevel@tonic-gate 	IIS_IN_OFFLINE_METHOD,
867c478bd9Sstevel@tonic-gate 	IIS_DISABLED,
877c478bd9Sstevel@tonic-gate 	IIS_IN_DISABLE_METHOD,
887c478bd9Sstevel@tonic-gate 	IIS_IN_REFRESH_METHOD,
897c478bd9Sstevel@tonic-gate 	IIS_MAINTENANCE,
907c478bd9Sstevel@tonic-gate 	IIS_OFFLINE_CONRATE,
917c478bd9Sstevel@tonic-gate 	IIS_OFFLINE_BIND,
927c478bd9Sstevel@tonic-gate 	IIS_OFFLINE_COPIES,
937c478bd9Sstevel@tonic-gate 	IIS_DEGRADED,
947c478bd9Sstevel@tonic-gate 	IIS_NONE
957c478bd9Sstevel@tonic-gate } internal_inst_state_t;
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate /*
987c478bd9Sstevel@tonic-gate  * inetd's instance methods.
997c478bd9Sstevel@tonic-gate  * NOTE: The methods table in cmd/cmd-inetd/inetd/util.c relies on the
1007c478bd9Sstevel@tonic-gate  * ordering of this enumeration, so take care if modifying it.
1017c478bd9Sstevel@tonic-gate  */
1027c478bd9Sstevel@tonic-gate typedef enum {
1037c478bd9Sstevel@tonic-gate 	IM_START,
1047c478bd9Sstevel@tonic-gate 	IM_ONLINE,
1057c478bd9Sstevel@tonic-gate 	IM_OFFLINE,
1067c478bd9Sstevel@tonic-gate 	IM_DISABLE,
1077c478bd9Sstevel@tonic-gate 	IM_REFRESH,
1087c478bd9Sstevel@tonic-gate 	NUM_METHODS,
1097c478bd9Sstevel@tonic-gate 	IM_NONE
1107c478bd9Sstevel@tonic-gate } instance_method_t;
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate /* Collection of information pertaining to a method */
1137c478bd9Sstevel@tonic-gate typedef struct {
1147c478bd9Sstevel@tonic-gate 	char *exec_path;	/* path passed to exec() */
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate 	/*
1177c478bd9Sstevel@tonic-gate 	 * Structure returned from wordexp(3c) that contains an expansion of the
1187c478bd9Sstevel@tonic-gate 	 * exec property into a form suitable for exec(2).
1197c478bd9Sstevel@tonic-gate 	 */
1207c478bd9Sstevel@tonic-gate 	wordexp_t	exec_args_we;
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate 	/*
1237c478bd9Sstevel@tonic-gate 	 * Copy of the first argument of the above wordexp_t structure in the
1247c478bd9Sstevel@tonic-gate 	 * event that an alternate arg0 is provided, and we replace the first
1257c478bd9Sstevel@tonic-gate 	 * argument with the alternate arg0. This is necessary so the
1267c478bd9Sstevel@tonic-gate 	 * contents of the wordexp_t structure can be returned to their
1277c478bd9Sstevel@tonic-gate 	 * original form as returned from wordexp(3c), which is a requirement
1287c478bd9Sstevel@tonic-gate 	 * for calling wordfree(3c), wordexp()'s associated cleanup routine.
1297c478bd9Sstevel@tonic-gate 	 */
1307c478bd9Sstevel@tonic-gate 	const char	*wordexp_arg0_backup;
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate 	/* time a method can run for before being considered broken */
1337c478bd9Sstevel@tonic-gate 	int		timeout;
1347c478bd9Sstevel@tonic-gate } method_info_t;
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate typedef struct {
1377c478bd9Sstevel@tonic-gate 	basic_cfg_t	*basic;
1387c478bd9Sstevel@tonic-gate 	method_info_t	*methods[NUM_METHODS];
1397c478bd9Sstevel@tonic-gate } instance_cfg_t;
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate /*
1427c478bd9Sstevel@tonic-gate  * Structure used to construct a list of int64_t's and their associated
1437c478bd9Sstevel@tonic-gate  * scf values. Used to store lists of process ids, internal states, and to
1447c478bd9Sstevel@tonic-gate  * store the associated scf value used when writing the values back to the
1457c478bd9Sstevel@tonic-gate  * repository.
1467c478bd9Sstevel@tonic-gate  */
1477c478bd9Sstevel@tonic-gate typedef struct {
1487c478bd9Sstevel@tonic-gate 	int64_t		val;
1497c478bd9Sstevel@tonic-gate 	scf_value_t	*scf_val;
1507c478bd9Sstevel@tonic-gate 	uu_list_node_t	link;
1517c478bd9Sstevel@tonic-gate } rep_val_t;
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate /* Structure containing the state and configuration of a service instance. */
1547c478bd9Sstevel@tonic-gate typedef struct {
1557c478bd9Sstevel@tonic-gate 	char			*fmri;
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate 	/* fd we're going to take a connection on */
1587c478bd9Sstevel@tonic-gate 	int			conn_fd;
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate 	/* number of copies of this instance active */
1617c478bd9Sstevel@tonic-gate 	int64_t			copies;
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate 	/* connection rate counters */
1647c478bd9Sstevel@tonic-gate 	int64_t			conn_rate_count;
1657c478bd9Sstevel@tonic-gate 	time_t			conn_rate_start;
1667c478bd9Sstevel@tonic-gate 
1677c478bd9Sstevel@tonic-gate 	/* failure rate counters */
1687c478bd9Sstevel@tonic-gate 	int64_t			fail_rate_count;
1697c478bd9Sstevel@tonic-gate 	time_t			fail_rate_start;
1707c478bd9Sstevel@tonic-gate 	/* bind failure count */
1717c478bd9Sstevel@tonic-gate 	int64_t			bind_fail_count;
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate 	/* pids of currently running methods */
1747c478bd9Sstevel@tonic-gate 	uu_list_t		*non_start_pid;
1757c478bd9Sstevel@tonic-gate 	uu_list_t		*start_pids;
1767c478bd9Sstevel@tonic-gate 
17794501b61Sskamm 	/* ctids of currently running start methods */
17894501b61Sskamm 	uu_list_t		*start_ctids;
17994501b61Sskamm 
1807c478bd9Sstevel@tonic-gate 	/* remote address, used for TCP tracing */
1817c478bd9Sstevel@tonic-gate 	struct sockaddr_storage	remote_addr;
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate 	internal_inst_state_t	cur_istate;
1847c478bd9Sstevel@tonic-gate 	internal_inst_state_t	next_istate;
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate 	/* repository compatible versions of the above 2 states */
1877c478bd9Sstevel@tonic-gate 	uu_list_t		*cur_istate_rep;
1887c478bd9Sstevel@tonic-gate 	uu_list_t		*next_istate_rep;
1897c478bd9Sstevel@tonic-gate 
1907c478bd9Sstevel@tonic-gate 	/*
1917c478bd9Sstevel@tonic-gate 	 * Current instance configuration resulting from its repository
1927c478bd9Sstevel@tonic-gate 	 * configuration.
1937c478bd9Sstevel@tonic-gate 	 */
1947c478bd9Sstevel@tonic-gate 	instance_cfg_t		*config;
1957c478bd9Sstevel@tonic-gate 
1967c478bd9Sstevel@tonic-gate 	/*
1977c478bd9Sstevel@tonic-gate 	 * Soon to be applied instance configuration. This configuration was
1987c478bd9Sstevel@tonic-gate 	 * read during a refresh when this instance was online, and the
1997c478bd9Sstevel@tonic-gate 	 * instance needed taking offline for this configuration to be applied.
2007c478bd9Sstevel@tonic-gate 	 * The instance is currently on its way offline, and this configuration
2017c478bd9Sstevel@tonic-gate 	 * will become the current configuration when it arrives there.
2027c478bd9Sstevel@tonic-gate 	 */
2037c478bd9Sstevel@tonic-gate 	instance_cfg_t		*new_config;
2047c478bd9Sstevel@tonic-gate 
2057c478bd9Sstevel@tonic-gate 	/* current pending conrate-offline/method timer; -1 if none pending */
2067c478bd9Sstevel@tonic-gate 	iu_timer_id_t		timer_id;
2077c478bd9Sstevel@tonic-gate 
2087c478bd9Sstevel@tonic-gate 	/* current pending bind retry timer; -1 if none pending */
2097c478bd9Sstevel@tonic-gate 	iu_timer_id_t		bind_timer_id;
2107c478bd9Sstevel@tonic-gate 
2117c478bd9Sstevel@tonic-gate 	/*
2127c478bd9Sstevel@tonic-gate 	 * Flags that assist in the fanout of an instance arriving in the
2137c478bd9Sstevel@tonic-gate 	 * offline state on-route to some other state.
2147c478bd9Sstevel@tonic-gate 	 */
2157c478bd9Sstevel@tonic-gate 	boolean_t		disable_req;
2167c478bd9Sstevel@tonic-gate 	boolean_t		maintenance_req;
2177c478bd9Sstevel@tonic-gate 	boolean_t		conn_rate_exceeded;
2187c478bd9Sstevel@tonic-gate 	boolean_t		bind_retries_exceeded;
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate 	/*
2217c478bd9Sstevel@tonic-gate 	 * Event waiting to be processed. RESTARTER_EVENT_TYPE_INVALID is used
2227c478bd9Sstevel@tonic-gate 	 * to mean no event waiting.
2237c478bd9Sstevel@tonic-gate 	 */
2247c478bd9Sstevel@tonic-gate 	restarter_event_type_t	pending_rst_event;
2257c478bd9Sstevel@tonic-gate 
2267c478bd9Sstevel@tonic-gate 	/* link to next instance in list */
2277c478bd9Sstevel@tonic-gate 	uu_list_node_t		link;
2287c478bd9Sstevel@tonic-gate } instance_t;
2297c478bd9Sstevel@tonic-gate 
2307c478bd9Sstevel@tonic-gate 
2317c478bd9Sstevel@tonic-gate /* Structure used to store information pertaining to instance method types. */
2327c478bd9Sstevel@tonic-gate typedef struct {
2337c478bd9Sstevel@tonic-gate 	instance_method_t	method;
2347c478bd9Sstevel@tonic-gate 	const char		*name;
2357c478bd9Sstevel@tonic-gate 	internal_inst_state_t	dst_state;
2367c478bd9Sstevel@tonic-gate } method_type_info_t;
2377c478bd9Sstevel@tonic-gate 
2387c478bd9Sstevel@tonic-gate 
2397c478bd9Sstevel@tonic-gate extern uu_list_t *instance_list;
2407c478bd9Sstevel@tonic-gate extern struct pollfd *poll_fds;
2417c478bd9Sstevel@tonic-gate extern nfds_t num_pollfds;
2427c478bd9Sstevel@tonic-gate extern method_type_info_t methods[];
2437c478bd9Sstevel@tonic-gate extern iu_tq_t *timer_queue;
2447c478bd9Sstevel@tonic-gate extern uu_list_pool_t *conn_ind_pool;
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate /*
2477c478bd9Sstevel@tonic-gate  * util.c
2487c478bd9Sstevel@tonic-gate  */
2497c478bd9Sstevel@tonic-gate extern void msg_init(void);
2507c478bd9Sstevel@tonic-gate extern void msg_fini(void);
2517c478bd9Sstevel@tonic-gate /* PRINTFLIKE1 */
2527c478bd9Sstevel@tonic-gate extern void debug_msg(const char *, ...);
2537c478bd9Sstevel@tonic-gate /* PRINTFLIKE1 */
2547c478bd9Sstevel@tonic-gate extern void error_msg(const char *, ...);
2557c478bd9Sstevel@tonic-gate /* PRINTFLIKE1 */
2567c478bd9Sstevel@tonic-gate extern void warn_msg(const char *, ...);
2577c478bd9Sstevel@tonic-gate extern void poll_fini(void);
2587c478bd9Sstevel@tonic-gate extern boolean_t isset_pollfd(int);
2597c478bd9Sstevel@tonic-gate extern void clear_pollfd(int);
2607c478bd9Sstevel@tonic-gate extern int set_pollfd(int, uint16_t);
2617c478bd9Sstevel@tonic-gate extern struct pollfd *find_pollfd(int);
2627c478bd9Sstevel@tonic-gate extern int safe_read(int, void *, size_t);
2637c478bd9Sstevel@tonic-gate extern boolean_t copies_limit_exceeded(instance_t *);
2647c478bd9Sstevel@tonic-gate extern void cancel_inst_timer(instance_t *);
2657c478bd9Sstevel@tonic-gate extern void cancel_bind_timer(instance_t *);
2667c478bd9Sstevel@tonic-gate extern void enable_blocking(int);
2677c478bd9Sstevel@tonic-gate extern void disable_blocking(int);
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate /*
2707c478bd9Sstevel@tonic-gate  * tlx.c
2717c478bd9Sstevel@tonic-gate  */
2727c478bd9Sstevel@tonic-gate extern rpc_info_t *create_rpc_info(const char *, const char *, const char *,
2737c478bd9Sstevel@tonic-gate     int, int);
2747c478bd9Sstevel@tonic-gate extern void destroy_rpc_info(rpc_info_t *);
2757c478bd9Sstevel@tonic-gate extern boolean_t rpc_info_equal(const rpc_info_t *, const rpc_info_t *);
2767c478bd9Sstevel@tonic-gate extern int register_rpc_service(const char *, const rpc_info_t *);
2777c478bd9Sstevel@tonic-gate extern void unregister_rpc_service(const char *, const rpc_info_t *);
278fff9db26Svp extern int create_bound_endpoint(const instance_t *, tlx_info_t *);
2797c478bd9Sstevel@tonic-gate extern void close_net_fd(instance_t *, int);
2807c478bd9Sstevel@tonic-gate extern int tlx_accept(const char *, tlx_info_t *, struct sockaddr_storage *);
2817c478bd9Sstevel@tonic-gate extern struct t_call *dequeue_conind(uu_list_t *);
2827c478bd9Sstevel@tonic-gate extern int queue_conind(uu_list_t *, struct t_call *);
2837c478bd9Sstevel@tonic-gate extern void tlx_fini(void);
2847c478bd9Sstevel@tonic-gate extern int tlx_init(void);
2857c478bd9Sstevel@tonic-gate extern boolean_t tlx_info_equal(const tlx_info_t *, const tlx_info_t *,
2867c478bd9Sstevel@tonic-gate     boolean_t);
2877c478bd9Sstevel@tonic-gate extern void consume_wait_data(instance_t *, int);
2887c478bd9Sstevel@tonic-gate 
2897c478bd9Sstevel@tonic-gate /*
2907c478bd9Sstevel@tonic-gate  * config.c
2917c478bd9Sstevel@tonic-gate  */
2927c478bd9Sstevel@tonic-gate extern int config_init(void);
2937c478bd9Sstevel@tonic-gate extern void config_fini(void);
2947c478bd9Sstevel@tonic-gate extern boolean_t socket_info_equal(const socket_info_t *, const socket_info_t *,
2957c478bd9Sstevel@tonic-gate     boolean_t);
2967c478bd9Sstevel@tonic-gate extern boolean_t method_info_equal(const method_info_t *,
2977c478bd9Sstevel@tonic-gate     const method_info_t *);
2987c478bd9Sstevel@tonic-gate extern struct method_context *read_method_context(const char *, const char *,
2997c478bd9Sstevel@tonic-gate     const char *, const char **);
3007c478bd9Sstevel@tonic-gate extern void destroy_instance_cfg(instance_cfg_t *);
3017c478bd9Sstevel@tonic-gate extern instance_cfg_t *read_instance_cfg(const char *);
3027c478bd9Sstevel@tonic-gate extern boolean_t bind_config_equal(const basic_cfg_t *, const basic_cfg_t *);
3037c478bd9Sstevel@tonic-gate extern int read_enable_merged(const char *, boolean_t *);
3047c478bd9Sstevel@tonic-gate 
3057c478bd9Sstevel@tonic-gate /*
3067c478bd9Sstevel@tonic-gate  * repval.c
3077c478bd9Sstevel@tonic-gate  */
3087c478bd9Sstevel@tonic-gate extern void repval_fini(void);
3097c478bd9Sstevel@tonic-gate extern int repval_init(void);
3107c478bd9Sstevel@tonic-gate extern uu_list_t *create_rep_val_list(void);
3117c478bd9Sstevel@tonic-gate extern void destroy_rep_val_list(uu_list_t *);
3127c478bd9Sstevel@tonic-gate extern scf_error_t store_rep_vals(uu_list_t *, const char *, const char *);
3137c478bd9Sstevel@tonic-gate extern scf_error_t retrieve_rep_vals(uu_list_t *, const char *, const char *);
3147c478bd9Sstevel@tonic-gate extern rep_val_t *find_rep_val(uu_list_t *, int64_t);
3157c478bd9Sstevel@tonic-gate extern int set_single_rep_val(uu_list_t *, int64_t);
3167c478bd9Sstevel@tonic-gate extern int64_t get_single_rep_val(uu_list_t *);
3177c478bd9Sstevel@tonic-gate extern int add_rep_val(uu_list_t *, int64_t);
3187c478bd9Sstevel@tonic-gate extern void remove_rep_val(uu_list_t *, int64_t);
3197c478bd9Sstevel@tonic-gate extern void empty_rep_val_list(uu_list_t *);
3207c478bd9Sstevel@tonic-gate extern int make_handle_bound(scf_handle_t *);
32194501b61Sskamm extern int add_remove_contract(instance_t *, boolean_t, ctid_t);
32294501b61Sskamm extern int iterate_repository_contracts(instance_t *, int);
3237c478bd9Sstevel@tonic-gate 
3247c478bd9Sstevel@tonic-gate /*
3257c478bd9Sstevel@tonic-gate  * contracts.c
3267c478bd9Sstevel@tonic-gate  */
3277c478bd9Sstevel@tonic-gate extern int contract_init(void);
3287c478bd9Sstevel@tonic-gate extern void contract_fini(void);
3297c478bd9Sstevel@tonic-gate void contract_postfork(void);
330*7b209c2cSacruz int contract_prefork(const char *, int);
3317c478bd9Sstevel@tonic-gate extern int get_latest_contract(ctid_t *cid);
3327c478bd9Sstevel@tonic-gate extern int adopt_contract(ctid_t, const char *);
3337c478bd9Sstevel@tonic-gate extern int abandon_contract(ctid_t);
3347c478bd9Sstevel@tonic-gate 
3357c478bd9Sstevel@tonic-gate /*
3367c478bd9Sstevel@tonic-gate  * inetd.c
3377c478bd9Sstevel@tonic-gate  */
3387c478bd9Sstevel@tonic-gate extern void process_offline_inst(instance_t *);
3397c478bd9Sstevel@tonic-gate extern void process_non_start_term(instance_t *, int);
3407c478bd9Sstevel@tonic-gate extern void process_start_term(instance_t *);
3417c478bd9Sstevel@tonic-gate extern void remove_method_ids(instance_t *, pid_t, ctid_t, instance_method_t);
3427c478bd9Sstevel@tonic-gate 
3437c478bd9Sstevel@tonic-gate /*
3447c478bd9Sstevel@tonic-gate  * env.c
3457c478bd9Sstevel@tonic-gate  */
3467c478bd9Sstevel@tonic-gate char **set_smf_env(struct method_context *, instance_t *, const char *);
3477c478bd9Sstevel@tonic-gate 
3487c478bd9Sstevel@tonic-gate /*
3497c478bd9Sstevel@tonic-gate  * wait.c
3507c478bd9Sstevel@tonic-gate  */
3517c478bd9Sstevel@tonic-gate extern int register_method(instance_t *, pid_t, ctid_t cid, instance_method_t);
3527c478bd9Sstevel@tonic-gate extern int method_init(void);
3537c478bd9Sstevel@tonic-gate extern void method_fini(void);
3547c478bd9Sstevel@tonic-gate extern void process_terminated_methods(void);
3557c478bd9Sstevel@tonic-gate extern void unregister_instance_methods(const instance_t *);
3567c478bd9Sstevel@tonic-gate extern void method_preexec(void);
3577c478bd9Sstevel@tonic-gate 
3587c478bd9Sstevel@tonic-gate #ifdef __cplusplus
3597c478bd9Sstevel@tonic-gate }
3607c478bd9Sstevel@tonic-gate #endif
3617c478bd9Sstevel@tonic-gate 
3627c478bd9Sstevel@tonic-gate #endif /* _INETD_IMPL_H */
363