'\" te .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH sysevent_get_class_name 3SYSEVENT "24 Jul 2009" "SunOS 5.11" "System Event Library Functions" .SH NAME sysevent_get_class_name, sysevent_get_subclass_name, sysevent_get_size, sysevent_get_seq, sysevent_get_time \- get class name, subclass name, ID or buffer size of event .SH SYNOPSIS .LP .nf \fBcc\fR [\fIflag\fR\&.\|.\|.] \fIfile\fR\&.\|.\|. \fB-lsysevent\fR [\fIlibrary\fR\&.\|.\|.] #include \fBchar *\fR\fBsysevent_get_class_name\fR(\fBsysevent_t *\fR\fIev\fR); .fi .LP .nf \fBchar *\fR\fBsysevent_get_subclass_name\fR(\fBsysevent_t *\fR\fIev\fR); .fi .LP .nf \fBint\fR \fBsysevent_get_size\fR(\fBsysevent_t *\fR\fIev\fR); .fi .LP .nf \fBuint64_t\fR \fBsysevent_get_seq\fR(\fBsysevent_t *\fR\fIev\fR); .fi .LP .nf \fBvoid\fR \fBsysevent_get_time\fR(\fBsysevent_t *\fR\fIev\fR, \fBhrtime_t *\fR\fIetimep\fR); .fi .SH PARAMETERS .sp .ne 2 .mk .na \fB\fIev\fR\fR .ad .RS 10n .rt handle to event .RE .sp .ne 2 .mk .na \fB\fIetimep\fR\fR .ad .RS 10n .rt pointer to high resolution event time variable .RE .SH DESCRIPTION .sp .LP The \fBsysevent_get_class_name()\fR and \fBsysevent_get_subclass_name()\fR functions return, respectively, the class and subclass names for the provided event \fIev\fR. .sp .LP The \fBsysevent_get_size()\fR function returns the size of the event buffer, \fIev\fR. .sp .LP The \fBsysevent_get_seq()\fR function returns a unique event sequence number of event \fIev\fR. The sequence number is reset on every system boot. .sp .LP The \fBsysevent_get_time()\fR function writes the time the event was published into the variable pointed to by \fIetimep\fR. The event time is added to the event just before it is put into the kernel internal event queue. .SH EXAMPLES .LP \fBExample 1 \fRParse sysevent header information. .sp .LP The following example parses sysevent header information from an application's event handler. .sp .in +2 .nf hrtime_t last_ev_time; unit64_t last_ev_seq; void event_handler(sysevent_t *ev) { sysevent_t *new_ev; int ev_sz; hrtime_t ev_time; uint64_t ev_seq; /* Filter on class and subclass */ if (strcmp(EC_PRIV, sysevent_get_class_name(ev)) != 0) { return; } else if (strcmp("ESC_MYSUBCLASS, sysevent_get_subclass_name(ev)) != 0) { return; } /* * Check for replayed sysevent, time must * be greater than previously recorded. */ sysevent_get_event_time(ev, &ev_time); ev_seq = sysevent_get_seq(ev); if (ev_time < last_ev_time || (ev_time == last_ev_time && ev_seq <= last_ev_seq)) { return; } last_ev_time = ev_time; last_ev_seq = ev_seq; /* Store event for later processing */ ev_sz = sysevent_get_size(ev): new_ev (sysevent_t *)malloc(ev_sz); bcopy(ev, new_ev, ev_sz); queue_event(new_ev); } .fi .in -2 .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelMT-Safe .TE .SH SEE ALSO .sp .LP \fBattributes\fR(5) .SH NOTES .sp .LP The \fBlibsysevent\fR interfaces do not work at all in non-global zones.