System Event Library Functions syseventbindhandle(3SYSEVENT)
NAME
syseventbindhandle, syseventunbindhandle - bind or
unbind subscriber handle
SYNOPSIS
cc [flag...] file ... -lsysevent [library ...]
#include
syseventhandlet *syseventbindhandle(void (*eventhandler)
(syseventt *ev));
void syseventunbindhandle(syseventhandlet *syseventhdl);
PARAMETERS
ev pointer to sysevent buffer handle
eventhandler pointer to an event handling function
syseventhdl pointer to a sysevent subscriber handle
DESCRIPTION
The syseventbindhandle() function allocates memory associ-
ated with a subscription handle and binds it to the caller's
eventhandler. The eventhandler is invoked during subse-
quent system event notifications once a subscription has
been made with syseventsubscribeevent(3SYSEVENT).
The system event is represented by the argument ev and is
passed as an argument to the invoked event delivery func-
tion, eventhandler.
Additional threads are created to service communication
between syseventd(1M) and the calling process and to run the
event handler routine, eventhandler.
The syseventunbindhandle() function deallocates memory and
other resources associated with a subscription handle and
deactivates all system event notifications for the calling
process. All event notifications are guaranteed to stop
upon return from syseventunbindhandle().
RETURN VALUES
The syseventbindhandle() function returns a valid sysevent
subscriber handle if the handle is successfully allocated.
SunOS 5.11 Last change: 12 Nov 2001 1
System Event Library Functions syseventbindhandle(3SYSEVENT)
Otherwise, NUL is returned and errno is set to indicate the
error.
The syseventunbindhandle() function returns no value.
ERORS
The syseventbindhandle() function will fail if:
EACES The calling process has an ID other than the
privileged user.
EBUSY There are no resources available.
EINVAL The pointer to the function eventhandler is NUL.
EMFILE The process has too many open descriptors.
ENOMEM There are insufficient resources to allocate the
handle.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Evolving
MT-Level MT-Safe
SEE ALSO
syseventd(1M), syseventsubscribeevent(3SYSEVENT), attri-
butes(5)
NOTES
Event notifications are revoked by syseventd when the bound
process dies. Event notification is suspended if a signal
is caught and handled by the eventhandler thread. Event
notification is also suspended when the calling process
attempts to use fork(2) or fork1(2). Event notifications
might be lost during suspension periods.
SunOS 5.11 Last change: 12 Nov 2001 2
|