Unleashed v1.4
[unleashed.git] / usr / src / cmd / svc / startd / protocol.h
blob21642c8a5e5ba6398ac10fab3593ebd548a30c5d
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
22 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
25 #ifndef _PROTOCOL_H
26 #define _PROTOCOL_H
28 #include <startd.h>
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 typedef enum {
35 GRAPH_UPDATE_RELOAD_GRAPH,
36 GRAPH_UPDATE_ADD_INSTANCE,
37 GRAPH_UPDATE_STATE_CHANGE
38 } graph_event_type_t;
40 typedef struct protocol_states {
41 restarter_instance_state_t ps_state;
42 restarter_instance_state_t ps_state_next;
43 restarter_error_t ps_err;
44 restarter_str_t ps_reason;
45 } protocol_states_t;
48 typedef struct graph_protocol_event {
49 char *gpe_inst;
50 size_t gpe_inst_sz;
51 graph_event_type_t gpe_type;
52 protocol_states_t *gpe_data;
54 uu_list_node_t gpe_link;
55 pthread_mutex_t gpe_lock;
56 } graph_protocol_event_t;
58 typedef struct graph_update {
59 pthread_mutex_t gu_lock;
60 pthread_cond_t gu_cv;
61 int gu_wakeup;
63 pthread_mutex_t gu_freeze_lock;
64 pthread_cond_t gu_freeze_cv;
65 int gu_freeze_wakeup;
66 } graph_update_t;
68 typedef struct restarter_protocol_event {
69 char *rpe_inst;
70 restarter_event_type_t rpe_type;
71 int32_t rpe_reason;
73 uu_list_node_t rpe_link;
74 } restarter_protocol_event_t;
76 typedef struct restarter_update {
77 pthread_mutex_t restarter_update_lock;
78 pthread_cond_t restarter_update_cv;
79 int restarter_update_wakeup;
80 } restarter_update_t;
82 extern restarter_update_t *ru;
83 extern graph_update_t *gu;
85 void graph_protocol_init();
86 void graph_protocol_send_event(const char *, graph_event_type_t,
87 protocol_states_t *);
88 graph_protocol_event_t *graph_event_dequeue();
89 void graph_event_requeue(graph_protocol_event_t *);
90 void graph_event_release(graph_protocol_event_t *);
92 void restarter_protocol_init();
93 evchan_t *restarter_protocol_init_delegate(char *);
94 void restarter_protocol_send_event(const char *, evchan_t *,
95 restarter_event_type_t, int32_t);
96 restarter_protocol_event_t *restarter_event_dequeue();
97 void restarter_event_requeue(restarter_protocol_event_t *);
98 void restarter_event_release(restarter_protocol_event_t *);
100 #ifdef __cplusplus
102 #endif
104 #endif /* _PROTOCOL_H */