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) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26 #include <sys/types.h>
27 #include <strings.h>
28 #include <fm/fmd_api.h>
29 #include <sys/fm/protocol.h>
30 #include <sys/fm/util.h>
31 #include <sys/sysevent.h>
32
33 #include "fmevt.h"
34
35 static evchan_t *fmevt_outbound_chan;
36
37 static struct fmevt_outbound_stats {
38 fmd_stat_t recv_calls;
39 fmd_stat_t recv_list;
40 fmd_stat_t recv_ireport;
41 fmd_stat_t recv_other;
42 fmd_stat_t fwd_success;
43 fmd_stat_t fwd_failure;
44 } outbound_stats = {
45 { "outbound_recv_calls", FMD_TYPE_UINT64,
95 nvlist_t *nvl;
96
97 if (fmd_prop_get_int32(hdl, "protocol_forward_disable") == B_TRUE) {
98 fmd_hdl_debug(hdl, "protocol forwarding disabled "
99 "through .conf file setting\n");
100 return;
101 }
102
103 (void) fmd_stat_create(hdl, FMD_STAT_NOALLOC, sizeof (outbound_stats) /
104 sizeof (fmd_stat_t), (fmd_stat_t *)&outbound_stats);
105
106 /*
107 * Allow simulation environment to change outbound channel name.
108 */
109 channel_name = fmd_prop_get_string(hdl, "outbound_channel");
110
111 if (sysevent_evc_bind(channel_name, &fmevt_outbound_chan,
112 EVCH_CREAT | EVCH_HOLD_PEND_INDEF) != 0) {
113 fmd_hdl_abort(hdl, "Unable to bind channel %s",
114 channel_name);
115 return;
116 }
117
118 channel_depth = fmd_prop_get_int32(hdl, "outbound_channel_depth");
119
120 if (sysevent_evc_control(fmevt_outbound_chan, EVCH_SET_CHAN_LEN,
121 (uint32_t)channel_depth) != 0) {
122 fmd_hdl_abort(hdl, "Unable to set depth of channel %s to %d",
123 channel_name, channel_depth);
124 }
125 fmd_prop_free_string(hdl, channel_name);
126
127 nvl = fmd_nvl_alloc(hdl, FMD_SLEEP);
128 (void) nvlist_add_nvlist(nvl, "fmdauth",
129 (nvlist_t *)fmd_hdl_fmauth(hdl));
130 (void) sysevent_evc_setpropnvl(fmevt_outbound_chan, nvl);
131 nvlist_free(nvl);
132
133 }
134
135 /*ARGSUSED*/
|
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) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26 /*
27 * Copyright 2019 Joyent, Inc.
28 */
29
30 #include <sys/types.h>
31 #include <strings.h>
32 #include <fm/fmd_api.h>
33 #include <sys/fm/protocol.h>
34 #include <sys/fm/util.h>
35 #include <sys/sysevent.h>
36
37 #include "fmevt.h"
38
39 static evchan_t *fmevt_outbound_chan;
40
41 static struct fmevt_outbound_stats {
42 fmd_stat_t recv_calls;
43 fmd_stat_t recv_list;
44 fmd_stat_t recv_ireport;
45 fmd_stat_t recv_other;
46 fmd_stat_t fwd_success;
47 fmd_stat_t fwd_failure;
48 } outbound_stats = {
49 { "outbound_recv_calls", FMD_TYPE_UINT64,
99 nvlist_t *nvl;
100
101 if (fmd_prop_get_int32(hdl, "protocol_forward_disable") == B_TRUE) {
102 fmd_hdl_debug(hdl, "protocol forwarding disabled "
103 "through .conf file setting\n");
104 return;
105 }
106
107 (void) fmd_stat_create(hdl, FMD_STAT_NOALLOC, sizeof (outbound_stats) /
108 sizeof (fmd_stat_t), (fmd_stat_t *)&outbound_stats);
109
110 /*
111 * Allow simulation environment to change outbound channel name.
112 */
113 channel_name = fmd_prop_get_string(hdl, "outbound_channel");
114
115 if (sysevent_evc_bind(channel_name, &fmevt_outbound_chan,
116 EVCH_CREAT | EVCH_HOLD_PEND_INDEF) != 0) {
117 fmd_hdl_abort(hdl, "Unable to bind channel %s",
118 channel_name);
119 }
120
121 channel_depth = fmd_prop_get_int32(hdl, "outbound_channel_depth");
122
123 if (sysevent_evc_control(fmevt_outbound_chan, EVCH_SET_CHAN_LEN,
124 (uint32_t)channel_depth) != 0) {
125 fmd_hdl_abort(hdl, "Unable to set depth of channel %s to %d",
126 channel_name, channel_depth);
127 }
128 fmd_prop_free_string(hdl, channel_name);
129
130 nvl = fmd_nvl_alloc(hdl, FMD_SLEEP);
131 (void) nvlist_add_nvlist(nvl, "fmdauth",
132 (nvlist_t *)fmd_hdl_fmauth(hdl));
133 (void) sysevent_evc_setpropnvl(fmevt_outbound_chan, nvl);
134 nvlist_free(nvl);
135
136 }
137
138 /*ARGSUSED*/
|