[Previous] [Contents] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

pm_set_property()

Set the value of a property associated with a power managed object

Synopsis:

#include <sys/pm.h>

int pm_set_property(pm_hdl hdl, 
                    pm_property_t id, 
                    void *value, 
                    int size);

Arguments:

hdl
Handle to the power managed object obtained via pm_attach().
id
An integer identifier that specifies the property type.
value
A pointer to where the property value is returned.
size
Size of the property value.

Library:

libpm

Description:

The pm_set_property() function changes the value of the specified property associated with a power managed object.

This property change is notified to the power manager policy, and this may result in policy specific actions based on the new value. For example, user defined properties can be used to implement system specific data used by the policy to evaluate the most appropriate system power mode.

Returns:

0
Success
-1
An error occurred (errno is set)

Errors:

EBADF
hdl is not a valid handle.
EINVAL
No property exists with the specified identifier.
EINVAL
The size of the property value is different to size.
EACCES
Caller is not allowed to add properties to the object (for example, hdl was not opened with O_RDWR access).
EFAULT
A fault occurred accessing value.

Examples:

#include <sys/pm.h>
#include <fcntl.h>
#include <stdlib.h>
// define a property identifier and structure containing property data
#define PROP_ID         (PM_PROPERTY_USER + 1)
struct prop_value {
   int     data1;
   int     data2;
};

int
main()
{
   pm_hdl_t        hdl;
   struct prop_value       value = { 1, 2 };

   hdl = pm_attach("object", O_RDWR);
   if (!pm_valid_hdl(hdl)) {
      perror("pm_attach");
      return EXIT_FAILURE;
   }

   if (pm_set_property(hdl, PROP_ID, &value, sizeof value) == -1) {
      perror("pm_add_property");
      return EXIT_FAILURE;
   }

   return EXIT_SUCCESS;
}

Classification:

Neutrino

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

pm_add_property(), pm_get_property(), pm_properties()


[Previous] [Contents] [Next]