1e04145d0Seschrock /*
2e04145d0Seschrock * CDDL HEADER START
3e04145d0Seschrock *
4e04145d0Seschrock * The contents of this file are subject to the terms of the
5e04145d0Seschrock * Common Development and Distribution License (the "License").
6e04145d0Seschrock * You may not use this file except in compliance with the License.
7e04145d0Seschrock *
8e04145d0Seschrock * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e04145d0Seschrock * or http://www.opensolaris.org/os/licensing.
10e04145d0Seschrock * See the License for the specific language governing permissions
11e04145d0Seschrock * and limitations under the License.
12e04145d0Seschrock *
13e04145d0Seschrock * When distributing Covered Code, include this CDDL HEADER in each
14e04145d0Seschrock * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15e04145d0Seschrock * If applicable, add the following below this CDDL HEADER, with the
16e04145d0Seschrock * fields enclosed by brackets "[]" replaced with your own identifying
17e04145d0Seschrock * information: Portions Copyright [yyyy] [name of copyright owner]
18e04145d0Seschrock *
19e04145d0Seschrock * CDDL HEADER END
20e04145d0Seschrock */
21e04145d0Seschrock /*
22*49b225e1SGavin Maltby * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23e04145d0Seschrock * Use is subject to license terms.
24e04145d0Seschrock */
25e04145d0Seschrock
26e04145d0Seschrock #include <libsysevent.h>
27e04145d0Seschrock #include <stdio.h>
28e04145d0Seschrock
29e04145d0Seschrock int
main(int argc,char ** argv)30e04145d0Seschrock main(int argc, char **argv)
31e04145d0Seschrock {
32e04145d0Seschrock evchan_t *ch;
33e04145d0Seschrock
34e04145d0Seschrock if (sysevent_evc_bind("channel_dtest", &ch,
35e04145d0Seschrock EVCH_CREAT | EVCH_HOLD_PEND) != 0) {
36e04145d0Seschrock (void) fprintf(stderr, "failed to bind to sysevent channel\n");
37e04145d0Seschrock return (1);
38e04145d0Seschrock }
39e04145d0Seschrock
40e04145d0Seschrock for (;;) {
41e04145d0Seschrock if (sysevent_evc_publish(ch, "class_dtest", "subclass_dtest",
42e04145d0Seschrock "vendor_dtest", "publisher_dtest", NULL, EVCH_SLEEP) != 0) {
43*49b225e1SGavin Maltby (void) sysevent_evc_unbind(ch);
44e04145d0Seschrock (void) fprintf(stderr, "failed to publisth sysevent\n");
45e04145d0Seschrock return (1);
46e04145d0Seschrock }
47e04145d0Seschrock sleep(1);
48e04145d0Seschrock }
49e04145d0Seschrock }
50