#include <sys/ioctl.h>
#include <machine/powioctl.h>
ioctl (fd, POWIOCGPOWERINFO, &powerinfo);
struct x68k_powerinfo powerinfo;
Returns the power switch status etc. in the following structure.
struct x68k_powerinfo {
int pow_switch_boottime;
int pow_switch_current;
time_t pow_boottime;
unsigned int pow_bootcount;
time_t pow_usedtotal;
};
The members of the structure mean:
pow_switch_boottime:
The power switch status at the system start time. The status can be checked by testing for the following definitions with the logical “and” (&):
POW_ALARMSW
True if the system started by the RTC alarm timer
POW_EXTERNALSW
True if the EXPWON signal of the I/O slot is on
POW_FRONTSW
True if the front power switch is on
EXPWON-related information is not tested.
pow_switch_current:
Current power switch status. See above.
pow_boottime:
The time when NetBSD started.
pow_bootcount, pow_usedtotal:
Host's boot information from the system memory switch. Total usage in count (pow_bootcount) and second (pow_usedtotal).