System Event Library Functions
syseventgetvendorname(3SYSEVENT)
NAME
syseventgetvendorname, syseventgetpubname,
syseventgetpid - get vendor name, publisher name or pro-
cessor ID of event
SYNOPSIS
cc [flag ...] file ...-lsysevent [library ...]
#include
char *syseventgetvendorname(syseventt *ev);
char *syseventgetpubname(syseventt *ev);
pidt syseventgetpid(syseventt *ev);
PARAMETERS
ev handle to a system event object
DESCRIPTION
The syseventgetpubname() function returns the publisher
name for the sysevent handle, ev. The publisher name iden-
tifies the name of the publishing application or kernel sub-
system of the sysevent.
The syseventgetpid() function returns the process ID for
the publishing application or SEKERNPID for sysevents ori-
ginating in the kernel. The publisher name and PID are use-
ful for implementing event acknowledgement.
The syseventgetvendorname() 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 sys-
tem event. This information is useful for filtering
sysevents for one or more vendors.
The interface manages the allocation of the vendor and pub-
lisher name strings, but it is the caller's responsibility
to free the strings when they are no longer needed by cal-
ling free(3MALOC). If the new vendor and publisher name
strings cannot be created, syseventgetvendorname() and
syseventgetpubname() return a null pointer and may set
errno to ENOMEM to indicate that the storage space available
is insufficient.
SunOS 5.11 Last change: 17 Mar 2004 1
System Event Library Functions
syseventgetvendorname(3SYSEVENT)
EXAMPLES
Example 1 Parse sysevent header information.
The following example parses sysevent header information
from an application's event handler.
char *vendor;
char *pub;
void
eventhandler(syseventt *ev)
{
if (strcmp(ECPRIV, syseventgetclassname(ev)) != 0) {
return;
}
vendor = syseventgetvendorname(ev);
if (strcmp("SUNW", vendor) != 0) {
free(vendor);
return;
}
pub = syseventgetpubname(ev);
if (strcmp("testdaemon", pub) != 0) {
free(vendor);
free(pub);
return;
}
(void) kill(syseventgetpid(ev), SIGUSR1);
free(vendor);
free(pub);
}
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 17 Mar 2004 2
System Event Library Functions
syseventgetvendorname(3SYSEVENT)
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Evolving
MT-Level MT-Safe
SEE ALSO
malloc(3MALOC), attributes(5)
SunOS 5.11 Last change: 17 Mar 2004 3
System Event Library Functions
syseventgetvendorname(3SYSEVENT)
SunOS 5.11 Last change: 17 Mar 2004 4
|