Print this page
7711 SMF: Finish implementing support for degraded state


   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) 2015, 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


 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))
 153 
 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))
 158 
 159 
 160 extern pthread_mutexattr_t mutex_attrs;
 161 
 162 /*
 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.
 166  */
 167 #define NACTIONS                        6
 168 
 169 typedef enum {
 170         ADMIN_EVENT_DEGRADED = 0x0,
 171         ADMIN_EVENT_MAINT_OFF,
 172         ADMIN_EVENT_MAINT_ON,
 173         ADMIN_EVENT_MAINT_ON_IMMEDIATE,
 174         ADMIN_EVENT_REFRESH,
 175         ADMIN_EVENT_RESTART
 176 } admin_action_t;
 177 
 178 extern const char * const admin_actions[NACTIONS];
 179 extern const int admin_events[NACTIONS];
 180 
 181 #define LOG_DATE_SIZE   32      /* Max size of timestamp in log output */
 182 
 183 extern ssize_t max_scf_name_size;
 184 extern ssize_t max_scf_value_size;
 185 extern ssize_t max_scf_fmri_size;
 186 
 187 extern mode_t fmask;


 327          */
 328         int                             gv_refs;
 329 
 330         int32_t                         gv_stn_tset;
 331         int32_t                         gv_reason;
 332 } graph_vertex_t;
 333 
 334 typedef struct graph_edge {
 335         graph_vertex_t  *ge_vertex;
 336         uu_list_node_t  ge_link;
 337         graph_vertex_t  *ge_parent;
 338 } graph_edge_t;
 339 
 340 int libscf_get_info_events_all(scf_propertygroup_t *);
 341 int32_t libscf_get_stn_tset(scf_instance_t *);
 342 
 343 /*
 344  * Restarter transition outcomes
 345  */
 346 typedef enum {

 347         MAINT_REQUESTED,
 348         START_REQUESTED,
 349         START_FAILED_REPEATEDLY,
 350         START_FAILED_CONFIGURATION,
 351         START_FAILED_FATAL,
 352         START_FAILED_TIMEOUT_FATAL,
 353         START_FAILED_OTHER
 354 } start_outcome_t;
 355 
 356 typedef void (*instance_hook_t)(void);
 357 
 358 typedef struct service_hook_assn {
 359         char    *sh_fmri;
 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;
 364 
 365 /*
 366  * Restarter instance stop reasons.




   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) 2015, Joyent, Inc. All rights reserved.
  25  * Copyright 2017 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


 148 #define safe_scf_iter_create(h)         \
 149         libscf_object_create((void *(*)(scf_handle_t *))scf_iter_create, (h))
 150 #define safe_scf_transaction_create(h)  libscf_object_create(   \
 151         (void *(*)(scf_handle_t *))     scf_transaction_create, (h))
 152 #define safe_scf_entry_create(h)        \
 153         libscf_object_create((void *(*)(scf_handle_t *))scf_entry_create, (h))
 154 
 155 #define startd_alloc(sz)        \
 156         startd_alloc_retry((void *(*)(size_t, int))umem_alloc, (sz))
 157 #define startd_zalloc(sz)       \
 158         startd_alloc_retry((void *(*)(size_t, int))umem_zalloc, (sz))
 159 
 160 
 161 extern pthread_mutexattr_t mutex_attrs;
 162 
 163 /*
 164  * Definitions for administrative actions.
 165  *   Note that the ordering in admin_action_t, admin_actions, and admin_events
 166  *   must match.  admin_actions and admin_events are defined in startd.c.
 167  */
 168 #define NACTIONS                        8
 169 
 170 typedef enum {
 171         ADMIN_EVENT_DEGRADED = 0x0,
 172         ADMIN_EVENT_MAINT_OFF,
 173         ADMIN_EVENT_MAINT_ON,
 174         ADMIN_EVENT_MAINT_ON_IMMEDIATE,
 175         ADMIN_EVENT_REFRESH,
 176         ADMIN_EVENT_RESTART
 177 } admin_action_t;
 178 
 179 extern const char * const admin_actions[NACTIONS];
 180 extern const int admin_events[NACTIONS];
 181 
 182 #define LOG_DATE_SIZE   32      /* Max size of timestamp in log output */
 183 
 184 extern ssize_t max_scf_name_size;
 185 extern ssize_t max_scf_value_size;
 186 extern ssize_t max_scf_fmri_size;
 187 
 188 extern mode_t fmask;


 328          */
 329         int                             gv_refs;
 330 
 331         int32_t                         gv_stn_tset;
 332         int32_t                         gv_reason;
 333 } graph_vertex_t;
 334 
 335 typedef struct graph_edge {
 336         graph_vertex_t  *ge_vertex;
 337         uu_list_node_t  ge_link;
 338         graph_vertex_t  *ge_parent;
 339 } graph_edge_t;
 340 
 341 int libscf_get_info_events_all(scf_propertygroup_t *);
 342 int32_t libscf_get_stn_tset(scf_instance_t *);
 343 
 344 /*
 345  * Restarter transition outcomes
 346  */
 347 typedef enum {
 348         DEGRADE_REQUESTED,
 349         MAINT_REQUESTED,
 350         START_REQUESTED,
 351         START_FAILED_REPEATEDLY,
 352         START_FAILED_CONFIGURATION,
 353         START_FAILED_FATAL,
 354         START_FAILED_TIMEOUT_FATAL,
 355         START_FAILED_OTHER
 356 } start_outcome_t;
 357 
 358 typedef void (*instance_hook_t)(void);
 359 
 360 typedef struct service_hook_assn {
 361         char    *sh_fmri;
 362         instance_hook_t sh_pre_online_hook;
 363         instance_hook_t sh_post_online_hook;
 364         instance_hook_t sh_post_offline_hook;
 365 } service_hook_assn_t;
 366 
 367 /*
 368  * Restarter instance stop reasons.