10Sstevel@tonic-gate/* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*11102SGavin.Maltby@Sun.COM * Common Development and Distribution License (the "License"). 6*11102SGavin.Maltby@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate/*LINTLIBRARY*/ 220Sstevel@tonic-gate/*PROTOLIB1*/ 230Sstevel@tonic-gate/* 24*11102SGavin.Maltby@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 250Sstevel@tonic-gate * Use is subject to license terms. 260Sstevel@tonic-gate * 270Sstevel@tonic-gate * usr/src/lib/libsysevent/llib-lsysevent 280Sstevel@tonic-gate */ 290Sstevel@tonic-gate 300Sstevel@tonic-gate#include <synch.h> 310Sstevel@tonic-gate#include <thread.h> 320Sstevel@tonic-gate#include "libsysevent.h" 330Sstevel@tonic-gate 340Sstevel@tonic-gateint sysevent_post_event(char *event_class, char *event_subclass, char *vendor, 350Sstevel@tonic-gate char *pub_name, nvlist_t *attr_list, sysevent_id_t *eid); 360Sstevel@tonic-gatesysevent_t *sysevent_dup(sysevent_t *ev); 370Sstevel@tonic-gate 380Sstevel@tonic-gatevoid sysevent_free(sysevent_t *ev); 390Sstevel@tonic-gate 400Sstevel@tonic-gateint sysevent_get_attr_list(sysevent_t *ev, nvlist_t **nvlist); 410Sstevel@tonic-gate 420Sstevel@tonic-gateint sysevent_lookup_attr(sysevent_t *ev, char *name, int datatype, 430Sstevel@tonic-gate sysevent_value_t *se_value); 440Sstevel@tonic-gate 450Sstevel@tonic-gatesysevent_attr_t *sysevent_attr_next(sysevent_t *ev, sysevent_attr_t *attr); 460Sstevel@tonic-gate 470Sstevel@tonic-gatechar *sysevent_attr_name(sysevent_attr_t *attr); 480Sstevel@tonic-gate 490Sstevel@tonic-gateint sysevent_attr_value(sysevent_attr_t *attr, sysevent_value_t *se_value); 500Sstevel@tonic-gate 510Sstevel@tonic-gateint sysevent_get_class(sysevent_t *ev); 520Sstevel@tonic-gate 530Sstevel@tonic-gatechar *sysevent_get_class_name(sysevent_t *ev); 540Sstevel@tonic-gate 550Sstevel@tonic-gateint sysevent_get_subclass(sysevent_t *ev); 560Sstevel@tonic-gate 570Sstevel@tonic-gatechar *sysevent_get_subclass_name(sysevent_t *ev); 580Sstevel@tonic-gate 590Sstevel@tonic-gatechar *sysevent_get_pub(sysevent_t *ev); 600Sstevel@tonic-gate 610Sstevel@tonic-gatechar *sysevent_get_vendor_name(sysevent_t *ev); 620Sstevel@tonic-gate 630Sstevel@tonic-gatechar *sysevent_get_pub_name(sysevent_t *ev); 640Sstevel@tonic-gate 650Sstevel@tonic-gatevoid sysevent_get_pid(sysevent_t *ev, pid_t *pid); 660Sstevel@tonic-gate 670Sstevel@tonic-gateuint64_t sysevent_get_seq(sysevent_t *ev); 680Sstevel@tonic-gate 690Sstevel@tonic-gatevoid sysevent_get_time(sysevent_t *ev, hrtime_t *etime); 700Sstevel@tonic-gate 710Sstevel@tonic-gatesize_t sysevent_get_size(sysevent_t *ev); 720Sstevel@tonic-gate 730Sstevel@tonic-gateint sysevent_send_event(sysevent_handle_t *sysevent_hdl, sysevent_t *ev); 740Sstevel@tonic-gate 750Sstevel@tonic-gatesysevent_t * sysevent_alloc_event(char *event_class, char *event_subclass, 760Sstevel@tonic-gate char *vendor, char *pub_name, nvlist_t *attr_list); 770Sstevel@tonic-gate 780Sstevel@tonic-gatesysevent_handle_t * sysevent_open_channel(const char *channel); 790Sstevel@tonic-gate 800Sstevel@tonic-gatesysevent_handle_t * sysevent_open_channel_alt(const char *channel_path); 810Sstevel@tonic-gate 820Sstevel@tonic-gatevoid sysevent_close_channel(sysevent_handle_t *shp); 830Sstevel@tonic-gate 840Sstevel@tonic-gateint sysevent_bind_subscriber(sysevent_handle_t *shp, 850Sstevel@tonic-gate void (*callback)(sysevent_t *data)); 860Sstevel@tonic-gate 870Sstevel@tonic-gateint sysevent_bind_publisher(sysevent_handle_t *shp); 880Sstevel@tonic-gate 890Sstevel@tonic-gatevoid sysevent_unbind_subscriber(sysevent_handle_t *shp); 900Sstevel@tonic-gate 910Sstevel@tonic-gatevoid sysevent_unbind_publisher(sysevent_handle_t *shp); 920Sstevel@tonic-gate 930Sstevel@tonic-gateint sysevent_register_event(sysevent_handle_t *shp, const char *event_class, 940Sstevel@tonic-gate const char **event_subclass_list, int num_subclasses); 950Sstevel@tonic-gate 960Sstevel@tonic-gatevoid sysevent_unregister_event(sysevent_handle_t *shp, 970Sstevel@tonic-gate const char *event_class); 980Sstevel@tonic-gate 990Sstevel@tonic-gatevoid sysevent_cleanup_publishers(sysevent_handle_t *shp); 1000Sstevel@tonic-gate 1010Sstevel@tonic-gatevoid sysevent_cleanup_subscribers(sysevent_handle_t *shp); 1020Sstevel@tonic-gate 1030Sstevel@tonic-gatesysevent_handle_t *sysevent_bind_handle(void (*event_handler)(sysevent_t *ev)); 1040Sstevel@tonic-gate 1050Sstevel@tonic-gatevoid sysevent_unbind_handle(sysevent_handle_t *shp); 1060Sstevel@tonic-gate 1070Sstevel@tonic-gateint sysevent_subscribe_event(sysevent_handle_t *shp, const char *event_class, 1080Sstevel@tonic-gate const char **event_subclass_list, int num_subclasses); 1090Sstevel@tonic-gate 1100Sstevel@tonic-gatevoid sysevent_unsubscribe_event(sysevent_handle_t *shp, 1110Sstevel@tonic-gate const char *event_class); 1120Sstevel@tonic-gate 1130Sstevel@tonic-gatevoid se_print(FILE *fp, sysevent_t *ev); 1140Sstevel@tonic-gate 1150Sstevel@tonic-gateint sysevent_evc_bind(const char *channel_path, evchan_t **scpp, 1160Sstevel@tonic-gate uint32_t flags); 1170Sstevel@tonic-gate 118*11102SGavin.Maltby@Sun.COMint sysevent_evc_unbind(evchan_t *scp); 1190Sstevel@tonic-gate 1200Sstevel@tonic-gateint sysevent_evc_publish(evchan_t *scp, const char *event_class, 1210Sstevel@tonic-gate const char *event_subclass, const char *vendor, const char *pub_name, 1220Sstevel@tonic-gate nvlist_t *attr_list, uint32_t flags); 1230Sstevel@tonic-gate 1240Sstevel@tonic-gateint sysevent_evc_subscribe(evchan_t *scp, const char *sid, 1250Sstevel@tonic-gate const char *event_class, 1260Sstevel@tonic-gate int (*event_handler)(sysevent_t *ev, void *cookie), 1270Sstevel@tonic-gate void *cookie, uint32_t flags); 128*11102SGavin.Maltby@Sun.COMint sysevent_evc_xsubscribe(evchan_t *scp, const char *sid, 129*11102SGavin.Maltby@Sun.COM const char *event_class, 130*11102SGavin.Maltby@Sun.COM int (*event_handler)(sysevent_t *ev, void *cookie), 131*11102SGavin.Maltby@Sun.COM void *cookie, uint32_t flags, 132*11102SGavin.Maltby@Sun.COM sysevent_subattr_t *xs); 1330Sstevel@tonic-gate 134*11102SGavin.Maltby@Sun.COMint sysevent_evc_unsubscribe(evchan_t *scp, const char *sid); 1350Sstevel@tonic-gate 1360Sstevel@tonic-gateint sysevent_evc_control(evchan_t *scp, int cmd, ...); 137*11102SGavin.Maltby@Sun.COM 138*11102SGavin.Maltby@Sun.COMsysevent_subattr_t *sysevent_subattr_alloc(void); 139*11102SGavin.Maltby@Sun.COMvoid sysevent_subattr_free(sysevent_subattr_t *attr); 140*11102SGavin.Maltby@Sun.COM 141*11102SGavin.Maltby@Sun.COMvoid sysevent_subattr_thrcreate(sysevent_subattr_t *attr, 142*11102SGavin.Maltby@Sun.COM door_xcreate_server_func_t *func, void *cookie); 143*11102SGavin.Maltby@Sun.COMvoid sysevent_subattr_thrsetup(sysevent_subattr_t *attr, 144*11102SGavin.Maltby@Sun.COM door_xcreate_thrsetup_func_t *func, void *cookie); 145*11102SGavin.Maltby@Sun.COM 146*11102SGavin.Maltby@Sun.COMvoid sysevent_subattr_thrattr(sysevent_subattr_t *attr, 147*11102SGavin.Maltby@Sun.COM pthread_attr_t *thrattr); 148*11102SGavin.Maltby@Sun.COM 149