OSServices Power API not available in 64bit mode

Originator:onitake
Number:rdar://6267445 Date Originated:03-Oct-2008 06:54 AM
Status:Open Resolved:
Product:Mac OS X Product Version:9F2114
Classification:Other Bug Reproducible:always
 
03-Oct-2008 06:54 AM:
Summary:
When compiling source code that uses the CoreServices/OSServices/Power API, it will fail if compiling in 64bit (x86_64) mode. The documentation states certain functions as deprecated, but not all. And there is no mention of dropped 64bit support.

Steps to Reproduce:
1. Create a .c file containing the following code:
#include <CoreServices/CoreServices.h>
int main(int argc, char **argv) {
	UpdateSystemActivity(UsrActivity);
	return 0;
}
2. Compile using -arch i386 or -arch ppc
3. Compile using -arch x86_64 or -arch ppc64

Expected Results:
2. and 3. should succeed without warning or error.

Actual Results:
3. fails because the UsrActivity constant is unknown. If compiling with -Wall, a warning is thrown because the UpdateSystemActivity function is unknown.

Regression:
According to the documentation of PowerManager, the function UpdateSystemActivity has the following availability:

Available in Mac OS X v10.0 and later.

No mention of deprecation or removal for 64bit apps.

Notes:
A quick check of the OSServices framework in gdb or otool shows that UpdateSystemActivity is available in all architectures (32 and 64bit).

Examination of OSServices.h reveals this:
#if !__LP64__
#ifndef __POWER__
#include <OSServices/Power.h>
#endif

Is this an oversight in the documentation or in the header files?
And what are the alternatives for the aforementioned function? What's the recommended procedure of disabling sleep and the screensaver in 10.5+?

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!