Print this page
7246 SMF stops dependents in the wrong order
7267 SMF is fast and loose with optional dependencies


   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   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.
  12  *
  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]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2013, Joyent, Inc. All rights reserved.

  25  */
  26 
  27 #ifndef _STARTD_H
  28 #define _STARTD_H
  29 
  30 #include <sys/time.h>
  31 #include <librestart.h>
  32 #include <librestart_priv.h>
  33 #include <libscf.h>
  34 #include <libsysevent.h>
  35 #include <libuutil.h>
  36 #include <pthread.h>
  37 #include <synch.h>
  38 #include <stdio.h>
  39 #include <syslog.h>
  40 #include <umem.h>
  41 
  42 #ifdef  __cplusplus
  43 extern "C" {
  44 #endif


 614 /* graph.c */
 615 void graph_init(void);
 616 void *single_user_thread(void *);
 617 void *graph_thread(void *);
 618 void *graph_event_thread(void *);
 619 void *repository_event_thread(void *);
 620 int dgraph_add_instance(const char *, scf_instance_t *, boolean_t);
 621 void graph_engine_start(void);
 622 void graph_enable_by_vertex(graph_vertex_t *, int, int);
 623 int refresh_vertex(graph_vertex_t *, scf_instance_t *);
 624 void vertex_send_event(graph_vertex_t *, restarter_event_type_t);
 625 void graph_start_if_satisfied(graph_vertex_t *);
 626 int vertex_subgraph_dependencies_shutdown(scf_handle_t *, graph_vertex_t *,
 627     restarter_instance_state_t);
 628 void graph_transition_sulogin(restarter_instance_state_t,
 629     restarter_instance_state_t);
 630 void graph_transition_propagate(graph_vertex_t *, propagate_event_t,
 631     restarter_error_t);
 632 void graph_offline_subtree_leaves(graph_vertex_t *, void *);
 633 void offline_vertex(graph_vertex_t *);

 634 
 635 /* libscf.c - common */
 636 char *inst_fmri_to_svc_fmri(const char *);
 637 void *libscf_object_create(void *(*)(scf_handle_t *), scf_handle_t *);
 638 int libscf_instance_get_fmri(scf_instance_t *, char **);
 639 int libscf_fmri_get_instance(scf_handle_t *, const char *, scf_instance_t **);
 640 int libscf_lookup_instance(const char *, scf_instance_t *);
 641 int libscf_set_reconfig(int);
 642 scf_snapshot_t *libscf_get_or_make_running_snapshot(scf_instance_t *,
 643     const char *, boolean_t);
 644 int libscf_inst_set_count_prop(scf_instance_t *, const char *,
 645     const char *pgtype, uint32_t, const char *, uint64_t);
 646 
 647 /* libscf.c - used by graph.c */
 648 int libscf_get_deathrow(scf_handle_t *, scf_instance_t *, int *);
 649 int libscf_get_basic_instance_data(scf_handle_t *, scf_instance_t *,
 650     const char *, int *, int *, char **);
 651 int libscf_inst_get_or_add_pg(scf_instance_t *, const char *, const char *,
 652     uint32_t, scf_propertygroup_t *);
 653 int libscf_read_states(const scf_propertygroup_t *,




   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   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.
  12  *
  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]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  25  * Copyright 2016 RackTop Systems.
  26  */
  27 
  28 #ifndef _STARTD_H
  29 #define _STARTD_H
  30 
  31 #include <sys/time.h>
  32 #include <librestart.h>
  33 #include <librestart_priv.h>
  34 #include <libscf.h>
  35 #include <libsysevent.h>
  36 #include <libuutil.h>
  37 #include <pthread.h>
  38 #include <synch.h>
  39 #include <stdio.h>
  40 #include <syslog.h>
  41 #include <umem.h>
  42 
  43 #ifdef  __cplusplus
  44 extern "C" {
  45 #endif


 615 /* graph.c */
 616 void graph_init(void);
 617 void *single_user_thread(void *);
 618 void *graph_thread(void *);
 619 void *graph_event_thread(void *);
 620 void *repository_event_thread(void *);
 621 int dgraph_add_instance(const char *, scf_instance_t *, boolean_t);
 622 void graph_engine_start(void);
 623 void graph_enable_by_vertex(graph_vertex_t *, int, int);
 624 int refresh_vertex(graph_vertex_t *, scf_instance_t *);
 625 void vertex_send_event(graph_vertex_t *, restarter_event_type_t);
 626 void graph_start_if_satisfied(graph_vertex_t *);
 627 int vertex_subgraph_dependencies_shutdown(scf_handle_t *, graph_vertex_t *,
 628     restarter_instance_state_t);
 629 void graph_transition_sulogin(restarter_instance_state_t,
 630     restarter_instance_state_t);
 631 void graph_transition_propagate(graph_vertex_t *, propagate_event_t,
 632     restarter_error_t);
 633 void graph_offline_subtree_leaves(graph_vertex_t *, void *);
 634 void offline_vertex(graph_vertex_t *);
 635 boolean_t insubtree_dependents_down(graph_vertex_t *);
 636 
 637 /* libscf.c - common */
 638 char *inst_fmri_to_svc_fmri(const char *);
 639 void *libscf_object_create(void *(*)(scf_handle_t *), scf_handle_t *);
 640 int libscf_instance_get_fmri(scf_instance_t *, char **);
 641 int libscf_fmri_get_instance(scf_handle_t *, const char *, scf_instance_t **);
 642 int libscf_lookup_instance(const char *, scf_instance_t *);
 643 int libscf_set_reconfig(int);
 644 scf_snapshot_t *libscf_get_or_make_running_snapshot(scf_instance_t *,
 645     const char *, boolean_t);
 646 int libscf_inst_set_count_prop(scf_instance_t *, const char *,
 647     const char *pgtype, uint32_t, const char *, uint64_t);
 648 
 649 /* libscf.c - used by graph.c */
 650 int libscf_get_deathrow(scf_handle_t *, scf_instance_t *, int *);
 651 int libscf_get_basic_instance_data(scf_handle_t *, scf_instance_t *,
 652     const char *, int *, int *, char **);
 653 int libscf_inst_get_or_add_pg(scf_instance_t *, const char *, const char *,
 654     uint32_t, scf_propertygroup_t *);
 655 int libscf_read_states(const scf_propertygroup_t *,