Receive notification when the status pf a power managed object
changes
#include <sys/pm.h>
int pm_notify(pm_hdl_t hdl,
unsigned flags,
const struct sigevent *event);
- hdl
- Handle to the power managed object obtained by pm_attach().
- flags
- Specify the changes of interest.
- event
- Pointer to a sigevent structure delivered when the requested
change occurs, or NULL to cancel notifications
libpm
The pm_notify() receives notification when the status of a power
managed object changes.
flags specifies the changes of interest:
- PM_CHANGE_START
- Receive notification at the start of a power mode change.
- PM_CHANGE_DONE
- Receive notification on completion of a power mode change.
- PM_DRIVER_ATTACH
- Receive notification when a driver registers to manage the
power managed object.
- PM_DRIVER_DETACH
- Receive notification when the driver managing the object
detaches (both normal and abnormal termination of the driver).
When one of the requested changes occurs, the specified event will be
delivered.
The requested notification remains in effect until it explicitly canceled.
This cancellation occurs if:
- a subsequent pm_notify() is called with flags set
to 0
- a subsequent pm_notify() is called with a NULL event.
- pm_detach() is called to close the connection to the power
manager.
A call to pm_notify() replaces any notification set by a previous
call and enable only the set of notifications specified by the new call.
- 0
- Success.
- -1
- An error occurred (errno is set).
- EBADF
- hdl is not a valid handle.
- EINVAL
- flags contains an invalid combination of flags.
- EFAULT
- A fault occurred accessing event.
- ENOMEM
- Insufficient memory for allocating power manager data structures.
Neutrino
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
pm_attach(),
pm_detach()