1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
'\" te
.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2015, Joyent, 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_VENDOR_NAME 3SYSEVENT "Jun 29, 2015"
.SH NAME
sysevent_get_vendor_name, sysevent_get_pub_name, sysevent_get_pid \- get vendor
name, publisher name or processor ID of event
.SH SYNOPSIS
.LP
.nf
\fBcc \fR [\fIflag \&.\|.\|.\fR] \fIfile\fR\&.\|.\|. \fB-lsysevent\fR [\fIlibrary \&.\|.\|.\fR]
#include <libsysevent.h>
\fBchar *\fR\fBsysevent_get_vendor_name\fR(\fBsysevent_t *\fR\fIev\fR);
.fi
.LP
.nf
\fBchar *\fR\fBsysevent_get_pub_name\fR(\fBsysevent_t *\fR\fIev\fR);
.fi
.LP
.nf
\fBvoid\fR \fBsysevent_get_pid\fR(\fBsysevent_t *\fR\fIev\fR, \fBpid_t *\fR\fIpid\fR);
.fi
.SH PARAMETERS
.ne 2
.na
\fB\fIev\fR\fR
.ad
.RS 6n
handle to a system event object
.RE
.SH DESCRIPTION
.LP
The \fBsysevent_get_pub_name()\fR function returns the publisher name for the
sysevent handle, \fIev\fR. The publisher name identifies the name of the
publishing application or kernel subsystem of the sysevent.
.sp
.LP
The \fBsysevent_get_pid()\fR function sets the process ID \fIpid\fR to that of
the publishing application or \fBSE_KERN_PID\fR for sysevents originating in the
kernel. The publisher name and PID are useful for implementing event
acknowledgement.
.sp
.LP
The \fBsysevent_get_vendor_name()\fR function returns the vendor string for the
publishing application or kernel subsystem. A vendor string is the company's
stock symbol that provided the application or kernel subsystem that generated
the system event. This information is useful for filtering sysevents for one
or more vendors.
.sp
.LP
The interface manages the allocation of the vendor and publisher name strings,
but it is the caller's responsibility to free the strings when they are no
longer needed by calling \fBfree\fR(3MALLOC). If the new vendor and publisher
name strings cannot be created, \fBsysevent_get_vendor_name()\fR and
\fBsysevent_get_pub_name()\fR return a null pointer and may set errno to
\fBENOMEM\fR to indicate that the storage space available is insufficient.
.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
char *vendor;
char *pub;
pid_t pid;
void
event_handler(sysevent_t *ev)
{
if (strcmp(EC_PRIV, sysevent_get_class_name(ev)) != 0) {
return;
}
vendor = sysevent_get_vendor_name(ev);
if (strcmp("SUNW", vendor) != 0) {
free(vendor);
return;
}
pub = sysevent_get_pub_name(ev);
if (strcmp("test_daemon", pub) != 0) {
free(vendor);
free(pub);
return;
}
sysevent_get_pid(ev, &pid);
(void) kill(pid, SIGUSR1);
free(vendor);
free(pub);
}
.fi
.in -2
.SH ATTRIBUTES
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp
.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE ATTRIBUTE VALUE
_
Interface Stability Committed
_
MT-Level MT-Safe
.TE
.SH SEE ALSO
.LP
.BR malloc (3MALLOC),
.BR attributes (7)
.SH NOTES
.LP
The \fBlibsysevent\fR interfaces do not work at all in non-global zones.
|