17c478bd9Sstevel@tonic-gate/* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*49b225e1SGavin Maltby * Common Development and Distribution License (the "License"). 6*49b225e1SGavin Maltby * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate/*LINTLIBRARY*/ 227c478bd9Sstevel@tonic-gate/*PROTOLIB1*/ 237c478bd9Sstevel@tonic-gate/* 24*49b225e1SGavin Maltby * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 257c478bd9Sstevel@tonic-gate * Use is subject to license terms. 267c478bd9Sstevel@tonic-gate * 277c478bd9Sstevel@tonic-gate * usr/src/lib/libsysevent/llib-lsysevent 287c478bd9Sstevel@tonic-gate */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate#include <synch.h> 317c478bd9Sstevel@tonic-gate#include <thread.h> 327c478bd9Sstevel@tonic-gate#include "libsysevent.h" 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gateint sysevent_post_event(char *event_class, char *event_subclass, char *vendor, 357c478bd9Sstevel@tonic-gate char *pub_name, nvlist_t *attr_list, sysevent_id_t *eid); 367c478bd9Sstevel@tonic-gatesysevent_t *sysevent_dup(sysevent_t *ev); 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gatevoid sysevent_free(sysevent_t *ev); 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gateint sysevent_get_attr_list(sysevent_t *ev, nvlist_t **nvlist); 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gateint sysevent_lookup_attr(sysevent_t *ev, char *name, int datatype, 437c478bd9Sstevel@tonic-gate sysevent_value_t *se_value); 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gatesysevent_attr_t *sysevent_attr_next(sysevent_t *ev, sysevent_attr_t *attr); 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gatechar *sysevent_attr_name(sysevent_attr_t *attr); 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gateint sysevent_attr_value(sysevent_attr_t *attr, sysevent_value_t *se_value); 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gateint sysevent_get_class(sysevent_t *ev); 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gatechar *sysevent_get_class_name(sysevent_t *ev); 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gateint sysevent_get_subclass(sysevent_t *ev); 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gatechar *sysevent_get_subclass_name(sysevent_t *ev); 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gatechar *sysevent_get_pub(sysevent_t *ev); 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gatechar *sysevent_get_vendor_name(sysevent_t *ev); 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gatechar *sysevent_get_pub_name(sysevent_t *ev); 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gatevoid sysevent_get_pid(sysevent_t *ev, pid_t *pid); 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gateuint64_t sysevent_get_seq(sysevent_t *ev); 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gatevoid sysevent_get_time(sysevent_t *ev, hrtime_t *etime); 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gatesize_t sysevent_get_size(sysevent_t *ev); 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gateint sysevent_send_event(sysevent_handle_t *sysevent_hdl, sysevent_t *ev); 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gatesysevent_t * sysevent_alloc_event(char *event_class, char *event_subclass, 767c478bd9Sstevel@tonic-gate char *vendor, char *pub_name, nvlist_t *attr_list); 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gatesysevent_handle_t * sysevent_open_channel(const char *channel); 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gatesysevent_handle_t * sysevent_open_channel_alt(const char *channel_path); 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gatevoid sysevent_close_channel(sysevent_handle_t *shp); 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gateint sysevent_bind_subscriber(sysevent_handle_t *shp, 857c478bd9Sstevel@tonic-gate void (*callback)(sysevent_t *data)); 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gateint sysevent_bind_publisher(sysevent_handle_t *shp); 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gatevoid sysevent_unbind_subscriber(sysevent_handle_t *shp); 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gatevoid sysevent_unbind_publisher(sysevent_handle_t *shp); 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gateint sysevent_register_event(sysevent_handle_t *shp, const char *event_class, 947c478bd9Sstevel@tonic-gate const char **event_subclass_list, int num_subclasses); 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gatevoid sysevent_unregister_event(sysevent_handle_t *shp, 977c478bd9Sstevel@tonic-gate const char *event_class); 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gatevoid sysevent_cleanup_publishers(sysevent_handle_t *shp); 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gatevoid sysevent_cleanup_subscribers(sysevent_handle_t *shp); 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gatesysevent_handle_t *sysevent_bind_handle(void (*event_handler)(sysevent_t *ev)); 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gatevoid sysevent_unbind_handle(sysevent_handle_t *shp); 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gateint sysevent_subscribe_event(sysevent_handle_t *shp, const char *event_class, 1087c478bd9Sstevel@tonic-gate const char **event_subclass_list, int num_subclasses); 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gatevoid sysevent_unsubscribe_event(sysevent_handle_t *shp, 1117c478bd9Sstevel@tonic-gate const char *event_class); 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gatevoid se_print(FILE *fp, sysevent_t *ev); 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gateint sysevent_evc_bind(const char *channel_path, evchan_t **scpp, 1167c478bd9Sstevel@tonic-gate uint32_t flags); 1177c478bd9Sstevel@tonic-gate 118*49b225e1SGavin Maltbyint sysevent_evc_unbind(evchan_t *scp); 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gateint sysevent_evc_publish(evchan_t *scp, const char *event_class, 1217c478bd9Sstevel@tonic-gate const char *event_subclass, const char *vendor, const char *pub_name, 1227c478bd9Sstevel@tonic-gate nvlist_t *attr_list, uint32_t flags); 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gateint sysevent_evc_subscribe(evchan_t *scp, const char *sid, 1257c478bd9Sstevel@tonic-gate const char *event_class, 1267c478bd9Sstevel@tonic-gate int (*event_handler)(sysevent_t *ev, void *cookie), 1277c478bd9Sstevel@tonic-gate void *cookie, uint32_t flags); 128*49b225e1SGavin Maltbyint sysevent_evc_xsubscribe(evchan_t *scp, const char *sid, 129*49b225e1SGavin Maltby const char *event_class, 130*49b225e1SGavin Maltby int (*event_handler)(sysevent_t *ev, void *cookie), 131*49b225e1SGavin Maltby void *cookie, uint32_t flags, 132*49b225e1SGavin Maltby sysevent_subattr_t *xs); 1337c478bd9Sstevel@tonic-gate 134*49b225e1SGavin Maltbyint sysevent_evc_unsubscribe(evchan_t *scp, const char *sid); 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gateint sysevent_evc_control(evchan_t *scp, int cmd, ...); 137*49b225e1SGavin Maltby 138*49b225e1SGavin Maltbysysevent_subattr_t *sysevent_subattr_alloc(void); 139*49b225e1SGavin Maltbyvoid sysevent_subattr_free(sysevent_subattr_t *attr); 140*49b225e1SGavin Maltby 141*49b225e1SGavin Maltbyvoid sysevent_subattr_thrcreate(sysevent_subattr_t *attr, 142*49b225e1SGavin Maltby door_xcreate_server_func_t *func, void *cookie); 143*49b225e1SGavin Maltbyvoid sysevent_subattr_thrsetup(sysevent_subattr_t *attr, 144*49b225e1SGavin Maltby door_xcreate_thrsetup_func_t *func, void *cookie); 145*49b225e1SGavin Maltby 146*49b225e1SGavin Maltbyvoid sysevent_subattr_thrattr(sysevent_subattr_t *attr, 147*49b225e1SGavin Maltby pthread_attr_t *thrattr); 148*49b225e1SGavin Maltby 149