zabbix-agent2/src/zabbix_server/ipmi/checks_ipmi.c
/******************************************************************************
 *                                                                            *
 * Function: zbx_perform_all_openipmi_ops                                     *
 *                                                                            *
 * Purpose: Pass control to OpenIPMI library to process all internal events   *
 *                                                                            *
 * Parameters: timeout - [IN] timeout (in seconds) for processing single      *
 *                            operation; processing multiple operations may   *
 *                            take more time                                  *
 *                                                                            *
 *****************************************************************************/
zbx_perform_all_openipmi_ops

Purpose: Pass control to OpenIPMI library to process all internal events

Parameters: timeout - [IN] timeout (in seconds) for processing single
operation; processing multiple operations may
take more time
zbx_perform_all_openipmi_ops Purpose : Pass control to OpenIPMI library to process all internal events Parameters : timeout - [ IN ] timeout ( in seconds ) for processing single operation ; processing multiple operations may take more time
void	zbx_perform_all_openipmi_ops(int timeout)
{
	for (;;)
	{
		struct timeval	tv;
		double		start_time;
		int		res;
		tv.tv_sec = timeout;
		tv.tv_usec = 0;
		start_time = zbx_time();
		if (0 != (res = os_hnd->perform_one_op(os_hnd, &tv)))
		{
			zabbix_log(LOG_LEVEL_DEBUG, "IPMI error: %s", zbx_strerror(res));
			break;
		}
		if (zbx_time() - start_time >= timeout)
		{
			break;
		}
	}
}
void zbx_perform_all_openipmi_ops ( int timeout ) { for ( ; ; ) { struct timeval tv ; double start_time ; int res ; tv . tv_sec = timeout ; tv . tv_usec = 0 ; start_time = zbx_time ( ) ; if ( 0 != ( res = os_hnd -> perform_one_op ( os_hnd , & tv ) ) ) { zabbix_log ( LOG_LEVEL_DEBUG , " " , zbx_strerror ( res ) ) ; break ; } if ( zbx_time ( ) - start_time >= timeout ) { break ; } } }
Function: zbx_perform_all_openipmi_ops                                     
                                                                            
 Purpose: Pass control to OpenIPMI library to process all internal events   
                                                                            
 Parameters: timeout - [IN] timeout (in seconds) for processing single      
                            operation; processing multiple operations may   
                            take more time
Function : zbx_perform_all_openipmi_ops Purpose : Pass control to OpenIPMI library to process all internal events Parameters : timeout - [ IN ] timeout ( in seconds ) for processing single operation ; processing multiple operations may take more time
/* Before OpenIPMI v2.0.26, perform_one_op() did not modify timeout argument.   */ /* Starting with OpenIPMI v2.0.26, perform_one_op() updates timeout argument.   */ /* To make sure that the loop works consistently with all versions of OpenIPMI, */ /* initialize timeout argument for perform_one_op() inside the loop.            */ /* perform_one_op() returns 0 on success, errno on failure (timeout means success) */ /* If execution of perform_one_op() took more time than specified in timeout argument, assume that  */ /* perform_one_op() timed out and break the loop.                                                   */ /* If it took less than specified in timeout argument, assume that some operation was performed and */ /* there may be more operations to be performed.                                                    */