xref: /illumos-gate/usr/src/cmd/dtrace/test/tst/common/sysevent/tst.post.c (revision e04145d08b77ade206d51c2367bebfc06f3e87f8)
1*e04145d0Seschrock /*
2*e04145d0Seschrock  * CDDL HEADER START
3*e04145d0Seschrock  *
4*e04145d0Seschrock  * The contents of this file are subject to the terms of the
5*e04145d0Seschrock  * Common Development and Distribution License (the "License").
6*e04145d0Seschrock  * You may not use this file except in compliance with the License.
7*e04145d0Seschrock  *
8*e04145d0Seschrock  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*e04145d0Seschrock  * or http://www.opensolaris.org/os/licensing.
10*e04145d0Seschrock  * See the License for the specific language governing permissions
11*e04145d0Seschrock  * and limitations under the License.
12*e04145d0Seschrock  *
13*e04145d0Seschrock  * When distributing Covered Code, include this CDDL HEADER in each
14*e04145d0Seschrock  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*e04145d0Seschrock  * If applicable, add the following below this CDDL HEADER, with the
16*e04145d0Seschrock  * fields enclosed by brackets "[]" replaced with your own identifying
17*e04145d0Seschrock  * information: Portions Copyright [yyyy] [name of copyright owner]
18*e04145d0Seschrock  *
19*e04145d0Seschrock  * CDDL HEADER END
20*e04145d0Seschrock  */
21*e04145d0Seschrock /*
22*e04145d0Seschrock  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*e04145d0Seschrock  * Use is subject to license terms.
24*e04145d0Seschrock  */
25*e04145d0Seschrock 
26*e04145d0Seschrock #pragma ident	"%Z%%M%	%I%	%E% SMI"
27*e04145d0Seschrock 
28*e04145d0Seschrock #include <libsysevent.h>
29*e04145d0Seschrock #include <stdio.h>
30*e04145d0Seschrock 
31*e04145d0Seschrock int
32*e04145d0Seschrock main(int argc, char **argv)
33*e04145d0Seschrock {
34*e04145d0Seschrock 	sysevent_id_t id;
35*e04145d0Seschrock 
36*e04145d0Seschrock 	for (;;) {
37*e04145d0Seschrock 		if (sysevent_post_event("class_dtest", "subclass_dtest",
38*e04145d0Seschrock 		    "vendor_dtest", "publisher_dtest", NULL, &id) != 0) {
39*e04145d0Seschrock 			(void) fprintf(stderr, "failed to post sysevent\n");
40*e04145d0Seschrock 			return (1);
41*e04145d0Seschrock 		}
42*e04145d0Seschrock 
43*e04145d0Seschrock 		sleep(1);
44*e04145d0Seschrock 	}
45*e04145d0Seschrock }
46