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