zabbix-agent2/src/zabbix_agent/stats.c
/******************************************************************************
 *                                                                            *
 * Function: free_collector_data                                              *
 *                                                                            *
 * Purpose: Free memory allocated for collector                               *
 *                                                                            *
 * Author: Eugene Grigorjev                                                   *
 *                                                                            *
 * Comments: Unix version allocated memory as shared.                         *
 *                                                                            *
 ******************************************************************************/
free_collector_data

Purpose: Free memory allocated for collector

Author: Eugene Grigorjev

Comments: Unix version allocated memory as shared.
free_collector_data Purpose : Free memory allocated for collector Author : Eugene Grigorjev Comments : Unix version allocated memory as shared .
void	free_collector_data(void)
{
#ifdef _WINDOWS
	zbx_free(collector);
#else
	if (NULL == collector)
		return;
#ifdef ZBX_PROCSTAT_COLLECTOR
	zbx_procstat_destroy();
#endif
	if (ZBX_NONEXISTENT_SHMID != collector->diskstat_shmid)
	{
		if (-1 == shmctl(collector->diskstat_shmid, IPC_RMID, 0))
			zabbix_log(LOG_LEVEL_WARNING, "cannot remove shared memory for disk statistics collector: %s",
					zbx_strerror(errno));
		diskdevices = NULL;
		collector->diskstat_shmid = ZBX_NONEXISTENT_SHMID;
	}
	zbx_mutex_destroy(&diskstats_lock);
#endif
#if defined(HAVE_KSTAT_H) && defined(HAVE_VMINFO_T_UPDATES)
	zbx_kstat_destroy();
#endif
	collector = NULL;
}
void free_collector_data ( void ) { #ifdef _WINDOWS zbx_free ( collector ) ; #else if ( NULL == collector ) return ; #ifdef ZBX_PROCSTAT_COLLECTOR zbx_procstat_destroy ( ) ; #endif if ( ZBX_NONEXISTENT_SHMID != collector -> diskstat_shmid ) { if ( -1 == shmctl ( collector -> diskstat_shmid , IPC_RMID , 0 ) ) zabbix_log ( LOG_LEVEL_WARNING , " " , zbx_strerror ( errno ) ) ; diskdevices = NULL ; collector -> diskstat_shmid = ZBX_NONEXISTENT_SHMID ; } zbx_mutex_destroy ( & diskstats_lock ) ; #endif #if defined ( HAVE_KSTAT_H ) && defined ( HAVE_VMINFO_T_UPDATES ) zbx_kstat_destroy ( ) ; #endif collector = NULL ; }
Function: free_collector_data                                              
                                                                            
 Purpose: Free memory allocated for collector                               
                                                                            
 Author: Eugene Grigorjev                                                   
                                                                            
 Comments: Unix version allocated memory as shared.
Function : free_collector_data Purpose : Free memory allocated for collector Author : Eugene Grigorjev Comments : Unix version allocated memory as shared .