int ACPI_read(hwd_context_t *ctx, hwd_control_state_t *ctrl, long long **events, int flags)
{
	static int failed = 0;

	if (failed ||
		(((ACPI_control_state_t *)ctrl)->counts[0] = (long long)get_load_value()) < 0 ||
		(((ACPI_control_state_t *)ctrl)->counts[1] = (long long)get_temperature_value()) < 0)
		goto fail;
	
	*events=((ACPI_control_state_t *)ctrl)->counts;
	return 0;

fail:
	failed = 1;
	return -1;
}
示例#2
0
int
ACPI_read( hwd_context_t * ctx, hwd_control_state_t * ctrl, long long **events,
           int flags )
{
    ( void ) ctx;			 /*unused */
    ( void ) flags;			 /*unused */
    static int failed = 0;

    if ( failed ||
            ( ( ( ACPI_control_state_t * ) ctrl )->counts[0] =
                  ( long long ) get_load_value(  ) ) == INVALID_VALUE ||
            ( ( ( ACPI_control_state_t * ) ctrl )->counts[1] =
                  ( long long ) get_temperature_value(  ) ) == INVALID_VALUE )
        goto fail;

    *events = ( ( ACPI_control_state_t * ) ctrl )->counts;
    return 0;

fail:
    failed = 1;
    return PAPI_ESBSTR;
}