4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2015, Joyent, Inc. All rights reserved.
31 #include <librestart.h>
32 #include <librestart_priv.h>
34 #include <libsysevent.h>
47 * We want MUTEX_HELD, but we also want pthreads. So we're stuck with this
48 * for the native build, at least until the build machines can catch up
49 * with the latest version of MUTEX_HELD() in <synch.h>.
51 #if defined(NATIVE_BUILD)
53 #define MUTEX_HELD(m) _mutex_held((mutex_t *)(m))
58 #define MUTEX_LOCK(mp) { \
60 if ((err = pthread_mutex_lock((mp))) != 0) { \
61 (void) fprintf(stderr, \
62 "pthread_mutex_lock() failed on %s:%d: %s\n", \
63 __FILE__, __LINE__, strerror(err)); \
68 #define MUTEX_UNLOCK(mp) { \
70 if ((err = pthread_mutex_unlock((mp))) != 0) { \
71 (void) fprintf(stderr, \
72 "pthread_mutex_unlock() failed on %s:%d: %s\n", \
73 __FILE__, __LINE__, strerror(err)); \
80 #define MUTEX_LOCK(mp) (void) pthread_mutex_lock((mp))
81 #define MUTEX_UNLOCK(mp) (void) pthread_mutex_unlock((mp))
85 #define bad_error(func, err) \
86 uu_panic("%s:%d: %s() failed with unexpected " \
87 "error %d. Aborting.\n", __FILE__, __LINE__, (func), (err));
89 #define min(a, b) (((a) < (b)) ? (a) : (b))
91 #define FAULT_COUNT_INCR 0
92 #define FAULT_COUNT_RESET 1
94 #define FAULT_THRESHOLD 3
96 #define MAX_CONFIGD_RETRIES 5
97 #define MAX_EMI_RETRIES 5
98 #define MAX_MOUNT_RETRIES 5
99 #define MAX_SULOGIN_RETRIES 5
101 #define RETURN_SUCCESS 0
102 #define RETURN_RETRY -1
103 #define RETURN_FATAL -2
105 #define LIBSCF_SUCCESS 0
106 #define LIBSCF_PROPERTY_ABSENT -1
107 #define LIBSCF_PGROUP_ABSENT -2
108 #define LIBSCF_PROPERTY_ERROR -3
110 #define METHOD_START 0
111 #define METHOD_STOP 1
112 #define METHOD_REFRESH 2
114 #define METHOD_TIMEOUT_INFINITE 0
117 * Contract cookies used by startd.
119 #define CONFIGD_COOKIE 0x10
120 #define SULOGIN_COOKIE 0x11
121 #define METHOD_START_COOKIE 0x20
122 #define METHOD_OTHER_COOKIE 0x21
123 #define MONITOR_COOKIE 0x30
124 #define EMI_COOKIE 0x31
127 #define ALLOC_RETRY 3
128 #define ALLOC_DELAY 10
129 #define ALLOC_DELAY_MULT 10
131 #define safe_scf_scope_create(h) \
132 libscf_object_create((void *(*)(scf_handle_t *))scf_scope_create, (h))
133 #define safe_scf_service_create(h) \
134 libscf_object_create((void *(*)(scf_handle_t *))scf_service_create, (h))
135 #define safe_scf_instance_create(h) libscf_object_create( \
136 (void *(*)(scf_handle_t *))scf_instance_create, (h))
137 #define safe_scf_snapshot_create(h) libscf_object_create( \
138 (void *(*)(scf_handle_t *))scf_snapshot_create, (h))
139 #define safe_scf_snaplevel_create(h) libscf_object_create( \
140 (void *(*)(scf_handle_t *))scf_snaplevel_create, (h))
141 #define safe_scf_pg_create(h) \
142 libscf_object_create((void *(*)(scf_handle_t *))scf_pg_create, (h))
143 #define safe_scf_property_create(h) libscf_object_create( \
144 (void *(*)(scf_handle_t *))scf_property_create, (h))
145 #define safe_scf_value_create(h) \
146 libscf_object_create((void *(*)(scf_handle_t *))scf_value_create, (h))
147 #define safe_scf_iter_create(h) \
148 libscf_object_create((void *(*)(scf_handle_t *))scf_iter_create, (h))
149 #define safe_scf_transaction_create(h) libscf_object_create( \
150 (void *(*)(scf_handle_t *)) scf_transaction_create, (h))
151 #define safe_scf_entry_create(h) \
152 libscf_object_create((void *(*)(scf_handle_t *))scf_entry_create, (h))
154 #define startd_alloc(sz) \
155 startd_alloc_retry((void *(*)(size_t, int))umem_alloc, (sz))
156 #define startd_zalloc(sz) \
157 startd_alloc_retry((void *(*)(size_t, int))umem_zalloc, (sz))
160 extern pthread_mutexattr_t mutex_attrs
;
163 * Definitions for administrative actions.
164 * Note that the ordering in admin_action_t, admin_actions, and admin_events
165 * must match. admin_actions and admin_events are defined in startd.c.
170 ADMIN_EVENT_DEGRADED
= 0x0,
171 ADMIN_EVENT_MAINT_OFF
,
172 ADMIN_EVENT_MAINT_ON
,
173 ADMIN_EVENT_MAINT_ON_IMMEDIATE
,
178 extern const char * const admin_actions
[NACTIONS
];
179 extern const int admin_events
[NACTIONS
];
181 #define LOG_DATE_SIZE 32 /* Max size of timestamp in log output */
183 extern ssize_t max_scf_name_size
;
184 extern ssize_t max_scf_value_size
;
185 extern ssize_t max_scf_fmri_size
;
190 #define LOG_PREFIX_EARLY "/etc/svc/volatile/"
191 #define LOG_PREFIX_NORMAL "/var/svc/log/"
193 #define LOG_SUFFIX ".log"
195 #define STARTD_DEFAULT_LOG "svc.startd.log"
196 #define EMI_LOG ((const char *) "system-early-manifest-import:default.log")
198 extern const char *log_directory
; /* Current log directory path */
200 #define FS_TIMEZONE_DIR "/usr/share/lib/zoneinfo"
201 #define FS_LOCALE_DIR "/usr/lib/locale"
204 * Simple dictionary representation.
206 typedef struct dictionary
{
207 uu_list_t
*dict_list
;
209 pthread_mutex_t dict_lock
;
212 typedef struct dict_entry
{
215 uu_list_node_t de_link
;
218 extern dictionary_t
*dictionary
;
220 typedef struct timeout_queue
{
222 pthread_mutex_t tq_lock
;
225 typedef struct timeout_entry
{
226 hrtime_t te_timeout
; /* timeout expiration time */
230 volatile int te_fired
;
231 uu_list_node_t te_link
;
234 extern timeout_queue_t
*timeouts
;
249 #define STATE_MAX (STATE_DEGRADED + 1)
251 extern const char * const instance_state_str
[STATE_MAX
];
254 GVT_UNSUPPORTED
= -1,
256 GVT_SVC
, /* service */
257 GVT_INST
, /* instance */
258 GVT_FILE
, /* file: */
259 GVT_GROUP
/* dependency group */
263 DEPGRP_UNSUPPORTED
= -1,
264 DEPGRP_REQUIRE_ANY
= 1,
271 METHOD_RESTART_UNKNOWN
= -1,
272 METHOD_RESTART_ALL
= 0,
273 METHOD_RESTART_EXTERNAL_FAULT
,
274 METHOD_RESTART_ANY_FAULT
,
285 * Graph representation.
287 #define GV_CONFIGURED 0x01 /* Service exists in repository, ready */
288 #define GV_ENABLED 0x02 /* Service should be online */
289 #define GV_ENBLD_NOOVR 0x04 /* GV_ENABLED, ignoring override */
290 #define GV_INSUBGRAPH 0x08 /* Current milestone depends on service */
291 #define GV_DEATHROW 0x10 /* Service is on deathrow */
292 #define GV_TOOFFLINE 0x20 /* Services in subtree to offline */
293 #define GV_TODISABLE 0x40 /* Services in subtree to disable */
295 /* ID must come first to support search */
296 typedef struct graph_vertex
{
299 uu_list_node_t gv_link
;
302 restarter_instance_state_t gv_state
;
306 depgroup_type_t gv_depgroup
;
307 restarter_error_t gv_restart
;
309 void (*gv_start_f
)(struct graph_vertex
*);
310 void (*gv_post_online_f
)(void);
311 void (*gv_post_disable_f
)(void);
314 evchan_t
*gv_restarter_channel
;
316 int gv_delegate_initialized
;
317 evchan_t
*gv_delegate_channel
;
319 uu_list_t
*gv_dependencies
;
320 uu_list_t
*gv_dependents
;
323 * gv_refs represents the number of references besides dependencies.
324 * The vertex cannot be removed when gv_refs > 0.
326 * Currently, only relevant for GVT_SVC and GVT_INST type vertices.
334 typedef struct graph_edge
{
335 graph_vertex_t
*ge_vertex
;
336 uu_list_node_t ge_link
;
337 graph_vertex_t
*ge_parent
;
340 int libscf_get_info_events_all(scf_propertygroup_t
*);
341 int32_t libscf_get_stn_tset(scf_instance_t
*);
344 * Restarter transition outcomes
349 START_FAILED_REPEATEDLY
,
350 START_FAILED_CONFIGURATION
,
352 START_FAILED_TIMEOUT_FATAL
,
356 typedef void (*instance_hook_t
)(void);
358 typedef struct service_hook_assn
{
360 instance_hook_t sh_pre_online_hook
;
361 instance_hook_t sh_post_online_hook
;
362 instance_hook_t sh_post_offline_hook
;
363 } service_hook_assn_t
;
366 * Restarter instance stop reasons.
369 RSTOP_EXIT
= 0x0, /* exited or empty */
370 RSTOP_CORE
, /* core dumped */
371 RSTOP_SIGNAL
, /* external fatal signal received */
372 RSTOP_HWERR
, /* uncorrectable hardware error */
373 RSTOP_DEPENDENCY
, /* dependency activity caused stop */
374 RSTOP_DISABLE
, /* disabled */
375 RSTOP_RESTART
, /* restart requested */
376 RSTOP_ERR_CFG
, /* wait svc exited with a config. error */
377 RSTOP_ERR_EXIT
/* wait svc exited with an error */
381 * Restarter instance maintenance clear reasons.
384 RUNMAINT_CLEAR
= 0x0,
389 * Restarter instance flags
391 #define RINST_CONTRACT 0x00000000 /* progeny constitute inst */
392 #define RINST_TRANSIENT 0x10000000 /* inst operates momentarily */
393 #define RINST_WAIT 0x20000000 /* child constitutes inst */
394 #define RINST_STYLE_MASK 0xf0000000
396 #define RINST_RETAKE_RUNNING 0x01000000 /* pending running snapshot */
397 #define RINST_RETAKE_START 0x02000000 /* pending start snapshot */
399 #define RINST_RETAKE_MASK 0x0f000000
401 #define RINST_START_TIMES 5 /* failures to consider */
402 #define RINST_FAILURE_RATE_NS 600000000000LL /* 1 failure/10 minutes */
403 #define RINST_WT_SVC_FAILURE_RATE_NS NANOSEC /* 1 failure/second */
405 /* Number of events in the queue when we start dropping ADMIN events. */
406 #define RINST_QUEUE_THRESHOLD 100
408 typedef struct restarter_inst
{
410 instance_data_t ri_i
;
411 char *ri_common_name
; /* template localized name */
412 char *ri_C_common_name
; /* C locale name */
414 char *ri_logstem
; /* logfile name */
415 char *ri_utmpx_prefix
;
417 instance_hook_t ri_pre_online_hook
;
418 instance_hook_t ri_post_online_hook
;
419 instance_hook_t ri_post_offline_hook
;
421 hrtime_t ri_start_time
[RINST_START_TIMES
];
422 uint_t ri_start_index
; /* times started */
424 uu_list_node_t ri_link
;
425 pthread_mutex_t ri_lock
;
428 * When we start a thread to we execute a method for this instance, we
429 * put the thread id in ri_method_thread. Threads with ids other than
430 * this which acquire ri_lock while ri_method_thread is nonzero should
431 * wait on ri_method_cv. ri_method_waiters should be incremented while
432 * waiting so the instance won't be deleted.
434 pthread_t ri_method_thread
;
435 pthread_cond_t ri_method_cv
;
436 uint_t ri_method_waiters
;
439 * These fields are provided so functions can operate on this structure
440 * and the repository without worrying about whether the instance has
441 * been deleted from the repository (this is possible because
442 * ri_i.i_fmri names the instance this structure represents -- see
443 * libscf_reget_inst()). ri_m_inst is the scf_instance_t for the
444 * instance, and ri_mi_deleted is true if the instance has been deleted.
446 scf_instance_t
*ri_m_inst
;
447 boolean_t ri_mi_deleted
;
450 * We maintain a pointer to any pending timeout for this instance
451 * for quick reference/deletion.
453 timeout_entry_t
*ri_timeout
;
456 * Instance event queue. Graph events are queued here as a list
457 * of restarter_instance_qentry_t's, and the lock is held separately.
458 * If both ri_lock and ri_queue_lock are grabbed, ri_lock must be
459 * grabbed first. ri_queue_lock protects all ri_queue_* structure
462 pthread_mutex_t ri_queue_lock
;
463 pthread_cond_t ri_queue_cv
;
469 typedef struct restarter_instance_list
{
470 uu_list_t
*ril_instance_list
;
471 pthread_mutex_t ril_lock
;
472 } restarter_instance_list_t
;
474 typedef struct restarter_instance_qentry
{
475 restarter_event_type_t riq_type
;
477 uu_list_node_t riq_link
;
478 } restarter_instance_qentry_t
;
480 typedef struct fork_info
{
483 restarter_error_t sf_event_type
;
484 restarter_str_t sf_reason
;
487 typedef struct wait_info
{
488 uu_list_node_t wi_link
;
490 int wi_fd
; /* psinfo file descriptor */
491 id_t wi_pid
; /* process ID */
492 const char *wi_fmri
; /* instance FMRI */
493 int wi_parent
; /* startd is parent */
494 int wi_ignore
; /* ignore events */
497 #define STARTD_LOG_FILE 0x1
498 #define STARTD_LOG_TERMINAL 0x2
499 #define STARTD_LOG_SYSLOG 0x4
501 #define STARTD_BOOT_QUIET 0x1
502 #define STARTD_BOOT_VERBOSE 0x2
505 * Internal debug flags used to reduce the amount of data sent to the
506 * internal debug buffer. They can be turned on & off dynamically using
507 * internal_debug_flags variable in mdb. By default, they're off.
509 #define DEBUG_DEPENDENCIES 0x1
511 typedef struct startd_state
{
512 /* Logging configuration */
513 char *st_log_prefix
; /* directory prefix */
514 char *st_log_file
; /* startd file in above dir */
515 uint_t st_log_flags
; /* message destination */
516 int st_log_level_min
; /* minimum required to log */
517 int st_log_timezone_known
; /* timezone is available */
518 int st_log_locale_known
; /* locale is available */
519 int st_log_login_reached
; /* login service reached */
521 /* Boot configuration */
522 uint_t st_boot_flags
; /* serial boot, etc. */
523 uint_t st_initial
; /* first startd on system */
525 /* System configuration */
526 char *st_subgraph
; /* milestone subgraph request */
528 uint_t st_load_complete
; /* graph load completed */
529 uint_t st_load_instances
; /* restarter instances to load */
530 pthread_mutex_t st_load_lock
;
531 pthread_cond_t st_load_cv
;
533 /* Repository configuration */
534 pid_t st_configd_pid
; /* PID of our svc.configd */
536 int st_configd_lives
; /* configd started */
537 pthread_mutex_t st_configd_live_lock
;
538 pthread_cond_t st_configd_live_cv
;
542 /* General information */
544 struct timeval st_start_time
; /* effective system start time */
548 extern startd_state_t
*st
;
550 extern boolean_t booting_to_single_user
;
552 extern const char *event_names
[];
555 * Structures for contract to instance hash table, implemented in
556 * contract.c and used by restarter.c and method.c
558 typedef struct contract_entry
{
562 uu_list_node_t ce_link
;
565 extern volatile uint16_t storing_contract
;
567 uu_list_pool_t
*contract_list_pool
;
570 ctid_t
contract_init(void);
571 void contract_abandon(ctid_t
);
572 int contract_kill(ctid_t
, int, const char *);
573 int contract_is_empty(ctid_t
);
574 void contract_hash_init();
575 void contract_hash_store(ctid_t
, int);
576 void contract_hash_remove(ctid_t
);
577 int lookup_inst_by_contract(ctid_t
);
580 void dict_init(void);
581 int dict_lookup_byname(const char *);
582 int dict_insert(const char *);
585 int expand_method_tokens(const char *, scf_instance_t
*,
586 scf_snapshot_t
*, int, char **);
590 char **set_smf_env(char **, size_t, const char *,
591 const restarter_inst_t
*, const char *);
594 int file_ready(graph_vertex_t
*);
597 int fork_mount(char *, char *);
598 void fork_sulogin(boolean_t
, const char *, ...);
599 void fork_rc_script(char, const char *, boolean_t
);
601 void *fork_configd_thread(void *);
603 pid_t
startd_fork1(int *);
604 void fork_with_timeout(const char *, uint_t
, uint_t
);
608 void graph_init(void);
609 void *single_user_thread(void *);
610 void *graph_thread(void *);
611 void *graph_event_thread(void *);
612 void *repository_event_thread(void *);
613 int dgraph_add_instance(const char *, scf_instance_t
*, boolean_t
);
614 void graph_engine_start(void);
615 void graph_enable_by_vertex(graph_vertex_t
*, int, int);
616 int refresh_vertex(graph_vertex_t
*, scf_instance_t
*);
617 void vertex_send_event(graph_vertex_t
*, restarter_event_type_t
);
618 void graph_start_if_satisfied(graph_vertex_t
*);
619 int vertex_subgraph_dependencies_shutdown(scf_handle_t
*, graph_vertex_t
*,
620 restarter_instance_state_t
);
621 void graph_transition_sulogin(restarter_instance_state_t
,
622 restarter_instance_state_t
);
623 void graph_transition_propagate(graph_vertex_t
*, propagate_event_t
,
625 void graph_offline_subtree_leaves(graph_vertex_t
*, void *);
626 void offline_vertex(graph_vertex_t
*);
628 /* libscf.c - common */
629 char *inst_fmri_to_svc_fmri(const char *);
630 void *libscf_object_create(void *(*)(scf_handle_t
*), scf_handle_t
*);
631 int libscf_instance_get_fmri(scf_instance_t
*, char **);
632 int libscf_fmri_get_instance(scf_handle_t
*, const char *, scf_instance_t
**);
633 int libscf_lookup_instance(const char *, scf_instance_t
*);
634 int libscf_set_reconfig(int);
635 scf_snapshot_t
*libscf_get_or_make_running_snapshot(scf_instance_t
*,
636 const char *, boolean_t
);
637 int libscf_inst_set_count_prop(scf_instance_t
*, const char *,
638 const char *pgtype
, uint32_t, const char *, uint64_t);
640 /* libscf.c - used by graph.c */
641 int libscf_get_deathrow(scf_handle_t
*, scf_instance_t
*, int *);
642 int libscf_get_basic_instance_data(scf_handle_t
*, scf_instance_t
*,
643 const char *, int *, int *, char **);
644 int libscf_inst_get_or_add_pg(scf_instance_t
*, const char *, const char *,
645 uint32_t, scf_propertygroup_t
*);
646 int libscf_read_states(const scf_propertygroup_t
*,
647 restarter_instance_state_t
*, restarter_instance_state_t
*);
648 int depgroup_empty(scf_handle_t
*, scf_propertygroup_t
*);
649 gv_type_t
depgroup_read_scheme(scf_handle_t
*, scf_propertygroup_t
*);
650 depgroup_type_t
depgroup_read_grouping(scf_handle_t
*, scf_propertygroup_t
*);
651 restarter_error_t
depgroup_read_restart(scf_handle_t
*, scf_propertygroup_t
*);
652 int libscf_set_enable_ovr(scf_instance_t
*, int);
653 int libscf_set_deathrow(scf_instance_t
*, int);
654 int libscf_delete_enable_ovr(scf_instance_t
*);
655 int libscf_get_milestone(scf_instance_t
*, scf_property_t
*, scf_value_t
*,
657 int libscf_extract_runlevel(scf_property_t
*, char *);
658 int libscf_clear_runlevel(scf_propertygroup_t
*, const char *milestone
);
660 typedef int (*callback_t
)(void *, void *);
662 int walk_dependency_pgs(scf_instance_t
*, callback_t
, void *);
663 int walk_property_astrings(scf_property_t
*, callback_t
, void *);
664 void libscf_reset_start_times(restarter_inst_t
*, int);
666 /* libscf.c - used by restarter.c/method.c/expand.c */
667 char *libscf_get_method(scf_handle_t
*, int, restarter_inst_t
*,
668 scf_snapshot_t
*, method_restart_t
*, uint_t
*, uint8_t *, uint64_t *,
670 void libscf_populate_graph(scf_handle_t
*h
);
671 int update_fault_count(restarter_inst_t
*, int);
672 int libscf_unset_action(scf_handle_t
*, scf_propertygroup_t
*, admin_action_t
,
674 int libscf_get_startd_properties(scf_instance_t
*, scf_snapshot_t
*, uint_t
*,
676 int libscf_get_template_values(scf_instance_t
*, scf_snapshot_t
*, char **,
679 int libscf_read_method_ids(scf_handle_t
*, scf_instance_t
*, const char *,
680 ctid_t
*, ctid_t
*, pid_t
*);
681 int libscf_write_start_pid(scf_instance_t
*, pid_t
);
682 int libscf_write_method_status(scf_instance_t
*, const char *, int);
683 int libscf_note_method_log(scf_instance_t
*, const char *, const char *);
685 scf_handle_t
*libscf_handle_create_bound(scf_version_t
);
686 void libscf_handle_rebind(scf_handle_t
*);
687 scf_handle_t
*libscf_handle_create_bound_loop(void);
689 scf_snapshot_t
*libscf_get_running_snapshot(scf_instance_t
*);
690 int libscf_snapshots_poststart(scf_handle_t
*, const char *, boolean_t
);
691 int libscf_snapshots_refresh(scf_instance_t
*, const char *);
693 int instance_is_transient_style(restarter_inst_t
*);
694 int instance_is_wait_style(restarter_inst_t
*);
696 int libscf_create_self(scf_handle_t
*);
698 void libscf_reget_instance(restarter_inst_t
*);
702 void log_error(int, const char *, ...);
703 void log_framework(int, const char *, ...);
704 void log_framework2(int, int, const char *, ...);
705 void log_console(int, const char *, ...);
706 void log_preexec(void);
707 void setlog(const char *);
708 void log_transition(const restarter_inst_t
*, start_outcome_t
);
709 void log_instance(const restarter_inst_t
*, boolean_t
, const char *, ...);
710 void log_instance_fmri(const char *, const char *, boolean_t
,
714 void *method_thread(void *);
715 void method_remove_contract(restarter_inst_t
*, boolean_t
, boolean_t
);
716 int method_rate_critical(restarter_inst_t
*);
719 void startd_close(int);
720 void startd_fclose(FILE *);
721 int fmri_canonify(const char *, char **, boolean_t
);
722 int fs_is_read_only(char *, ulong_t
*);
723 int fs_remount(char *);
724 void xstr_sanitize(char *);
727 void restarter_init(void);
728 void restarter_start(void);
729 int instance_in_transition(restarter_inst_t
*);
730 int restarter_instance_update_states(scf_handle_t
*, restarter_inst_t
*,
731 restarter_instance_state_t
, restarter_instance_state_t
, restarter_error_t
,
733 int stop_instance_fmri(scf_handle_t
*, const char *, uint_t
);
734 restarter_inst_t
*inst_lookup_by_id(int);
735 void restarter_mark_pending_snapshot(const char *, uint_t
);
736 void *restarter_post_fsminimal_thread(void *);
737 void timeout_insert(restarter_inst_t
*, ctid_t
, uint64_t);
738 void timeout_remove(restarter_inst_t
*, ctid_t
);
739 void timeout_init(void);
740 int is_timeout_ovr(restarter_inst_t
*);
743 void *safe_realloc(void *, size_t);
744 char *safe_strdup(const char *s
);
745 void *startd_alloc_retry(void *(*)(size_t, int), size_t);
746 void startd_free(void *, size_t);
747 uu_list_pool_t
*startd_list_pool_create(const char *, size_t, size_t,
748 uu_compare_fn_t
*, uint32_t);
749 uu_list_t
*startd_list_create(uu_list_pool_t
*, void *, uint32_t);
750 pthread_t
startd_thread_create(void *(*)(void *), void *);
753 void special_null_transition(void);
754 void special_online_hooks_get(const char *, instance_hook_t
*,
755 instance_hook_t
*, instance_hook_t
*);
758 int gt_transition(scf_handle_t
*, graph_vertex_t
*, restarter_error_t
,
759 restarter_instance_state_t
);
762 void utmpx_init(void);
763 void utmpx_clear_old(void);
764 int utmpx_mark_init(pid_t
, char *);
765 void utmpx_mark_dead(pid_t
, int, boolean_t
);
766 char utmpx_get_runlevel(void);
767 void utmpx_set_runlevel(char, char, boolean_t
);
768 void utmpx_write_boottime(void);
769 void utmpx_prefork(void);
770 void utmpx_postfork(void);
773 void wait_init(void);
774 void wait_prefork(void);
775 void wait_postfork(pid_t
);
776 int wait_register(pid_t
, const char *, int, int);
777 void *wait_thread(void *);
778 void wait_ignore_by_fmri(const char *);
781 ctid_t
proc_get_ctid();
784 extern void deathrow_init();
785 extern void deathrow_fini();
786 extern boolean_t
is_fmri_in_deathrow(const char *);
792 #endif /* _STARTD_H */