Package: libsysfs2 Version: 2.1.0+repack-2 Severity: normal Dear Maintainer, *** Please consider answering these questions, where appropriate ***
* What led up to the situation? We wrote an edac-rate daemon which links against libedac which again links against libsysfs. The memory usage of the daemon is constantly increasing which finally triggers the OOM killer for user jobs * What exactly did you do (or not do) that was effective (or ineffective)? I have to restart the daemon from time to time. * What was the outcome of this action? The memory usage increased again. * What outcome did you expect instead? The used memory stays constant. Here is the valgrind output: ==27455== Memcheck, a memory error detector ==27455== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==27455== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==27455== Command: ./usr/sbin/edac_rate_daemon ==27455== ==27455== ==27455== HEAP SUMMARY: ==27455== in use at exit: 72,464 bytes in 276 blocks ==27455== total heap usage: 734 allocs, 458 frees, 2,269,558 bytes allocated ==27455== ==27455== 112 (64 direct, 48 indirect) bytes in 1 blocks are definitely lost in loss record 16 of 42 ==27455== at 0x4C28BED: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x53C2E24: dlist_new (dlist.c:102) ==27455== by 0x53C2ECA: dlist_new_with_delete (dlist.c:124) ==27455== by 0x53C44CA: sysfs_open_device_tree (sysfs_device.c:252) ==27455== by 0x4E31253: _sysfs_open_device_tree (libedac.c:628) ==27455== by 0x4E300E3: edac_handle_init (libedac.c:137) ==27455== by 0x40138B: get_edac_values (edac_rate_daemon.c:365) ==27455== by 0x402521: update_array (edac_rate_daemon.c:233) ==27455== by 0x401095: main (edac_rate_daemon.c:99) ==27455== ==27455== 112 (64 direct, 48 indirect) bytes in 1 blocks are definitely lost in loss record 17 of 42 ==27455== at 0x4C28BED: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x53C2E24: dlist_new (dlist.c:102) ==27455== by 0x53C2ECA: dlist_new_with_delete (dlist.c:124) ==27455== by 0x53C44CA: sysfs_open_device_tree (sysfs_device.c:252) ==27455== by 0x4E31253: _sysfs_open_device_tree (libedac.c:628) ==27455== by 0x4E300E3: edac_handle_init (libedac.c:137) ==27455== by 0x40138B: get_edac_values (edac_rate_daemon.c:365) ==27455== by 0x402521: update_array (edac_rate_daemon.c:233) ==27455== by 0x4010BE: main (edac_rate_daemon.c:99) ==27455== ==27455== 144 bytes in 1 blocks are definitely lost in loss record 18 of 42 ==27455== at 0x4C28BED: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x4010AD: main (edac_rate_daemon.c:103) ==27455== ==27455== 144 bytes in 1 blocks are definitely lost in loss record 19 of 42 ==27455== at 0x4C28BED: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x4010D6: main (edac_rate_daemon.c:103) ==27455== ==27455== 376 (64 direct, 312 indirect) bytes in 1 blocks are definitely lost in loss record 24 of 42 ==27455== at 0x4C28BED: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x53C2E24: dlist_new (dlist.c:102) ==27455== by 0x53C2ECA: dlist_new_with_delete (dlist.c:124) ==27455== by 0x53C44CA: sysfs_open_device_tree (sysfs_device.c:252) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x4E31253: _sysfs_open_device_tree (libedac.c:628) ==27455== by 0x4E300E3: edac_handle_init (libedac.c:137) ==27455== by 0x40138B: get_edac_values (edac_rate_daemon.c:365) ==27455== by 0x402521: update_array (edac_rate_daemon.c:233) ==27455== by 0x401095: main (edac_rate_daemon.c:99) ==27455== ==27455== 376 (64 direct, 312 indirect) bytes in 1 blocks are definitely lost in loss record 25 of 42 ==27455== at 0x4C28BED: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x53C2E24: dlist_new (dlist.c:102) ==27455== by 0x53C2ECA: dlist_new_with_delete (dlist.c:124) ==27455== by 0x53C44CA: sysfs_open_device_tree (sysfs_device.c:252) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x4E31253: _sysfs_open_device_tree (libedac.c:628) ==27455== by 0x4E300E3: edac_handle_init (libedac.c:137) ==27455== by 0x40138B: get_edac_values (edac_rate_daemon.c:365) ==27455== by 0x402521: update_array (edac_rate_daemon.c:233) ==27455== by 0x4010BE: main (edac_rate_daemon.c:99) ==27455== ==27455== 1,056 (768 direct, 288 indirect) bytes in 12 blocks are definitely lost in loss record 28 of 42 ==27455== at 0x4C28BED: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x53C2E24: dlist_new (dlist.c:102) ==27455== by 0x53C2ECA: dlist_new_with_delete (dlist.c:124) ==27455== by 0x53C44CA: sysfs_open_device_tree (sysfs_device.c:252) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x4E31253: _sysfs_open_device_tree (libedac.c:628) ==27455== by 0x4E300E3: edac_handle_init (libedac.c:137) ==27455== by 0x40138B: get_edac_values (edac_rate_daemon.c:365) ==27455== by 0x402521: update_array (edac_rate_daemon.c:233) ==27455== by 0x401095: main (edac_rate_daemon.c:99) ==27455== ==27455== 1,056 (768 direct, 288 indirect) bytes in 12 blocks are definitely lost in loss record 29 of 42 ==27455== at 0x4C28BED: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x53C2E24: dlist_new (dlist.c:102) ==27455== by 0x53C2ECA: dlist_new_with_delete (dlist.c:124) ==27455== by 0x53C44CA: sysfs_open_device_tree (sysfs_device.c:252) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x4E31253: _sysfs_open_device_tree (libedac.c:628) ==27455== by 0x4E300E3: edac_handle_init (libedac.c:137) ==27455== by 0x40138B: get_edac_values (edac_rate_daemon.c:365) ==27455== by 0x402521: update_array (edac_rate_daemon.c:233) ==27455== by 0x4010BE: main (edac_rate_daemon.c:99) ==27455== ==27455== 1,912 (600 direct, 1,312 indirect) bytes in 1 blocks are definitely lost in loss record 33 of 42 ==27455== at 0x4C272B8: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x53C4247: alloc_device (sysfs_device.c:157) ==27455== by 0x53C4290: sysfs_open_device_path (sysfs_device.c:177) ==27455== by 0x53C1280: sysfs_read_dir_subdirs (sysfs_attr.c:465) ==27455== by 0x53C4429: sysfs_open_device_tree (sysfs_device.c:239) ==27455== by 0x4E31253: _sysfs_open_device_tree (libedac.c:628) ==27455== by 0x4E300E3: edac_handle_init (libedac.c:137) ==27455== by 0x40138B: get_edac_values (edac_rate_daemon.c:365) ==27455== by 0x402521: update_array (edac_rate_daemon.c:233) ==27455== by 0x401095: main (edac_rate_daemon.c:99) ==27455== ==27455== 1,912 (600 direct, 1,312 indirect) bytes in 1 blocks are definitely lost in loss record 34 of 42 ==27455== at 0x4C272B8: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x53C4247: alloc_device (sysfs_device.c:157) ==27455== by 0x53C4290: sysfs_open_device_path (sysfs_device.c:177) ==27455== by 0x53C1280: sysfs_read_dir_subdirs (sysfs_attr.c:465) ==27455== by 0x53C4429: sysfs_open_device_tree (sysfs_device.c:239) ==27455== by 0x4E31253: _sysfs_open_device_tree (libedac.c:628) ==27455== by 0x4E300E3: edac_handle_init (libedac.c:137) ==27455== by 0x40138B: get_edac_values (edac_rate_daemon.c:365) ==27455== by 0x402521: update_array (edac_rate_daemon.c:233) ==27455== by 0x4010BE: main (edac_rate_daemon.c:99) ==27455== ==27455== 9,376 (1,200 direct, 8,176 indirect) bytes in 2 blocks are definitely lost in loss record 37 of 42 ==27455== at 0x4C272B8: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x53C4247: alloc_device (sysfs_device.c:157) ==27455== by 0x53C4290: sysfs_open_device_path (sysfs_device.c:177) ==27455== by 0x53C1280: sysfs_read_dir_subdirs (sysfs_attr.c:465) ==27455== by 0x53C4429: sysfs_open_device_tree (sysfs_device.c:239) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x4E31253: _sysfs_open_device_tree (libedac.c:628) ==27455== by 0x4E300E3: edac_handle_init (libedac.c:137) ==27455== by 0x40138B: get_edac_values (edac_rate_daemon.c:365) ==27455== by 0x402521: update_array (edac_rate_daemon.c:233) ==27455== by 0x401095: main (edac_rate_daemon.c:99) ==27455== ==27455== 9,376 (1,200 direct, 8,176 indirect) bytes in 2 blocks are definitely lost in loss record 38 of 42 ==27455== at 0x4C272B8: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x53C4247: alloc_device (sysfs_device.c:157) ==27455== by 0x53C4290: sysfs_open_device_path (sysfs_device.c:177) ==27455== by 0x53C1280: sysfs_read_dir_subdirs (sysfs_attr.c:465) ==27455== by 0x53C4429: sysfs_open_device_tree (sysfs_device.c:239) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x4E31253: _sysfs_open_device_tree (libedac.c:628) ==27455== by 0x4E300E3: edac_handle_init (libedac.c:137) ==27455== by 0x40138B: get_edac_values (edac_rate_daemon.c:365) ==27455== by 0x402521: update_array (edac_rate_daemon.c:233) ==27455== by 0x4010BE: main (edac_rate_daemon.c:99) ==27455== ==27455== 14,400 bytes in 24 blocks are definitely lost in loss record 40 of 42 ==27455== at 0x4C272B8: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x53C4247: alloc_device (sysfs_device.c:157) ==27455== by 0x53C4290: sysfs_open_device_path (sysfs_device.c:177) ==27455== by 0x53C1280: sysfs_read_dir_subdirs (sysfs_attr.c:465) ==27455== by 0x53C4429: sysfs_open_device_tree (sysfs_device.c:239) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x4E31253: _sysfs_open_device_tree (libedac.c:628) ==27455== by 0x4E300E3: edac_handle_init (libedac.c:137) ==27455== by 0x40138B: get_edac_values (edac_rate_daemon.c:365) ==27455== by 0x402521: update_array (edac_rate_daemon.c:233) ==27455== ==27455== 16,056 (7,800 direct, 8,256 indirect) bytes in 13 blocks are definitely lost in loss record 41 of 42 ==27455== at 0x4C272B8: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x53C4247: alloc_device (sysfs_device.c:157) ==27455== by 0x53C4290: sysfs_open_device_path (sysfs_device.c:177) ==27455== by 0x53C1280: sysfs_read_dir_subdirs (sysfs_attr.c:465) ==27455== by 0x53C4429: sysfs_open_device_tree (sysfs_device.c:239) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x4E31253: _sysfs_open_device_tree (libedac.c:628) ==27455== by 0x4E300E3: edac_handle_init (libedac.c:137) ==27455== by 0x40138B: get_edac_values (edac_rate_daemon.c:365) ==27455== by 0x402521: update_array (edac_rate_daemon.c:233) ==27455== by 0x401095: main (edac_rate_daemon.c:99) ==27455== ==27455== 16,056 (7,800 direct, 8,256 indirect) bytes in 13 blocks are definitely lost in loss record 42 of 42 ==27455== at 0x4C272B8: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27455== by 0x53C4247: alloc_device (sysfs_device.c:157) ==27455== by 0x53C4290: sysfs_open_device_path (sysfs_device.c:177) ==27455== by 0x53C1280: sysfs_read_dir_subdirs (sysfs_attr.c:465) ==27455== by 0x53C4429: sysfs_open_device_tree (sysfs_device.c:239) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x53C4485: sysfs_open_device_tree (sysfs_device.c:243) ==27455== by 0x4E31253: _sysfs_open_device_tree (libedac.c:628) ==27455== by 0x4E300E3: edac_handle_init (libedac.c:137) ==27455== by 0x40138B: get_edac_values (edac_rate_daemon.c:365) ==27455== by 0x402521: update_array (edac_rate_daemon.c:233) ==27455== by 0x4010BE: main (edac_rate_daemon.c:99) ==27455== ==27455== LEAK SUMMARY: ==27455== definitely lost: 35,680 bytes in 86 blocks ==27455== indirectly lost: 36,784 bytes in 190 blocks ==27455== possibly lost: 0 bytes in 0 blocks ==27455== still reachable: 0 bytes in 0 blocks ==27455== suppressed: 0 bytes in 0 blocks ==27455== ==27455== For counts of detected and suppressed errors, rerun with: -v ==27455== ERROR SUMMARY: 15 errors from 15 contexts (suppressed: 4 from 4) and a test code: /* * ===================================================================================== * * Filename: edac_daemon.c * * Description: a ce rate monitor running in the background * * Version: 1.0 * Created: 02/18/2010 09:15:39 PM * Revision: none * Compiler: gcc * * Author: Henning Fehrmann (), henning.fehrm...@aei.mpg.de * Company: AEI Hannover * * ===================================================================================== */ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <signal.h> #include <unistd.h> #include <time.h> #include <string.h> #include <edac.h> #include <sys/stat.h> #include <sys/mman.h> #include "uthash.h" #include <sys/resource.h> #define RUNNING_DIR "/tmp" #define LOCK_FILE "/var/run/edac_rate_daemon.lock" #define LOG_FILE "/tmp/edac_rate.log" #define BUF 48 #define CNT_5MIN 5 #define CNT_1H 17 #define CNT_1D 41 #define CNT_7D 48 #define BANKS 32 #define RANGE_5MIN 300 #define RANGE_1H 3600 #define RANGE_1D 86400 #define RANGE_7D 604800 unsigned int UE_cnt=0; struct DIMM_struct { int id; char slot[32]; unsigned int CEcnt; unsigned int * CEarray; float * CErates; unsigned int * timearray; int UEcnt; UT_hash_handle hh; }; struct DIMM_struct * dimms; /* sleep time */ int sleeptime=1; time_t start_time; typedef struct list * List; struct prog_ctx { char *progname; struct edac_handle *edac; int verbose; int quiet; int print_status; List reports; }; void daemonize(); void update_array(); void get_rate(); void log_message( char * filename, char * message); void signal_handler( int sig); void publish_rate(); static void get_edac_values (); // int main() int main() { // daemonize(); int i; start_time = time(NULL); //dimms = (struct DIMM_struct *) malloc ( BANKS * sizeof ( struct DIMM_struct )) ; dimms = NULL; for (i=0; i<2; i++) { update_array(); get_rate(); publish_rate(); // sleep(sleeptime); struct rusage* memory = malloc(sizeof(struct rusage)); getrusage(RUSAGE_SELF, memory); // printf("Usage: %ld\n", memory->ru_ixrss); // printf("Usage: %ld\n", memory->ru_isrss); // printf("Usage: %ld\n", memory->ru_idrss); // printf("Max: %ld\n", memory->ru_maxrss); } struct DIMM_struct * dimm, *tmp; HASH_ITER(hh, dimms, dimm, tmp) { free(dimm->CEarray); free(dimm->timearray); free(dimm->CErates); HASH_DEL(dimms, dimm); free(dimm); } free(dimms); return 0; } // }}} void publish_rate() { FILE * f; struct DIMM_struct * dimm, *tmp; if((f=fopen("/tmp/edac_rate_array_debug","w"))==NULL) { log_message(LOG_FILE,"could not open file "); exit(0); return; } HASH_ITER(hh, dimms, dimm, tmp) { fprintf(f,"%s\t%f\t%f\t%f\t%f\tCE[mHz]: 5min,1h,1d,7d\n", dimm->slot,dimm->CErates[0],dimm->CErates[1],dimm->CErates[2],dimm->CErates[3]); } if (UE_cnt != 0){ fprintf(f,"UE: %u\n",UE_cnt); } // fprintf(stdout,"%f\t%f\t%f\t%f\n",rate_5min,rate_1h,rate_1d,rate_7d); fclose(f); } void get_rate() { unsigned int CE_d_5min; unsigned int time_d_5min; unsigned int CE_d_1h; unsigned int time_d_1h; unsigned int CE_d_1d; unsigned int time_d_1d; unsigned int CE_d_7d; unsigned int time_d_7d; struct DIMM_struct * dimm, *tmp; HASH_ITER(hh, dimms, dimm, tmp) { if (dimm->timearray[CNT_5MIN-1]==start_time){ continue; } time_d_5min=dimm->timearray[0]-dimm->timearray[CNT_5MIN-1]; //printf("update now\n"); CE_d_5min=dimm->CEarray[0]-dimm->CEarray[CNT_5MIN-1]; dimm->CErates[0]=1000.*(float)CE_d_5min/(float)time_d_5min; if (dimm->timearray[CNT_1H -1 ]==start_time){ continue; } time_d_1h=dimm->timearray[0]-dimm->timearray[CNT_1H -1 ]; CE_d_1h=dimm->CEarray[0]-dimm->CEarray[CNT_1H - 1]; dimm->CErates[1]=1000.*(float)CE_d_1h/(float)time_d_1h; if (dimm->timearray[CNT_1D -1 ]==start_time){ continue; } time_d_1d=dimm->timearray[0]-dimm->timearray[CNT_1D -1 ]; CE_d_1d=dimm->CEarray[0]-dimm->CEarray[CNT_1D -1 ]; dimm->CErates[2]=1000.*(float)CE_d_1d/(float)time_d_1d; if (dimm->timearray[CNT_7D -1 ]==start_time){ continue; } time_d_7d=dimm->timearray[0]-dimm->timearray[CNT_7D-1]; CE_d_7d=dimm->CEarray[0]-dimm->CEarray[CNT_7D-1]; dimm->CErates[3]=1000.*(float)CE_d_7d/(float)time_d_7d; } } void daemonize() { int i,lfp; char str[10]; if(getppid()==1) return; /* already a daemon */ i=fork(); if (i<0) exit(1); /* fork error */ if (i>0) exit(0); /* parent exits */ /* child (daemon) continues */ setsid(); /* obtain a new process group */ for (i=getdtablesize();i>=0;--i) close(i); /* close all descriptors */ i=open("/dev/null",O_RDWR); dup(i); dup(i); /* handle standart I/O */ umask(027); /* set newly created file permissions */ chdir(RUNNING_DIR); /* change running directory */ lfp=open(LOCK_FILE,O_RDWR|O_CREAT,0640); if (lfp<0) exit(1); /* can not open */ if (lockf(lfp,F_TLOCK,0)<0) exit(0); /* can not lock */ /* first instance continues */ sprintf(str,"%d\n",getpid()); write(lfp,str,strlen(str)); /* record pid to lockfile */ signal(SIGCHLD,SIG_IGN); /* ignore child */ signal(SIGTSTP,SIG_IGN); /* ignore tty signals */ signal(SIGTTOU,SIG_IGN); signal(SIGTTIN,SIG_IGN); signal(SIGHUP,signal_handler); /* catch hangup signal */ signal(SIGTERM,signal_handler); /* catch kill signal */ } void update_array() { int i; time_t now = time(NULL); unsigned int time_tmp1; unsigned int time_tmp2; unsigned int CE_tmp1; unsigned int CE_tmp2; struct DIMM_struct * dimm, *tmp; get_edac_values(); //HASH_ITER(hh, dimms, dimm, tmp) { // if(dimm) printf("%s id is %d %d\n", dimm->slot,dimm->id,dimm->CEcnt); //} HASH_ITER(hh, dimms, dimm, tmp) { time_tmp1=dimm->timearray[0]; CE_tmp1=dimm->CEarray[0]; dimm->timearray[0]=(uint)now; dimm->CEarray[0]=dimm->CEcnt; /* do the first 5 minutes */ for (i=1; i< CNT_5MIN; i++ ){ time_tmp2=dimm->timearray[i]; CE_tmp2=dimm->CEarray[i]; dimm->timearray[i]=time_tmp1; dimm->CEarray[i]=CE_tmp1; time_tmp1=time_tmp2; CE_tmp1=CE_tmp2; } if ( time_tmp1-dimm->timearray[CNT_5MIN]< RANGE_5MIN){ /* do not touch the next array segments */ continue; } for (i=CNT_5MIN; i< CNT_1H; i++ ){ time_tmp2=dimm->timearray[i]; CE_tmp2=dimm->CEarray[i]; dimm->timearray[i]=time_tmp1; dimm->CEarray[i]=CE_tmp1; time_tmp1=time_tmp2; CE_tmp1=CE_tmp2; } if ( time_tmp1-dimm->timearray[CNT_1H]< RANGE_1H){ /* do not touch the next array segments */ continue; } for (i=CNT_1H; i< CNT_1D; i++ ){ time_tmp2 = dimm->timearray[i]; CE_tmp2= dimm->CEarray[i]; dimm->timearray[i]=time_tmp1; dimm->CEarray[i]=CE_tmp1; time_tmp1=time_tmp2; CE_tmp1=CE_tmp2; } if ( time_tmp1-dimm->timearray[CNT_1D]< RANGE_1D){ /* do not touch the next array segments */ continue; } for (i=CNT_1D; i< CNT_7D; i++ ){ time_tmp2=dimm->timearray[i]; CE_tmp2=dimm->CEarray[i]; dimm->timearray[i]=time_tmp1; dimm->CEarray[i]=CE_tmp1; time_tmp1=time_tmp2; CE_tmp1=CE_tmp2; } } } void log_message(filename,message) char *filename; char *message; { FILE *logfile; logfile=fopen(filename,"a"); if(!logfile) return; fprintf(logfile,"%s\n",message); fclose(logfile); } void signal_handler(sig) int sig; { struct DIMM_struct * dimm, *tmp; switch(sig) { case SIGHUP: HASH_ITER(hh, dimms, dimm, tmp) { free(dimm->CEarray); free(dimm->timearray); free(dimm->CErates); HASH_DEL(dimms, dimm); free(dimm); } free(dimms); log_message(LOG_FILE,"hangup signal catched"); break; case SIGTERM: HASH_ITER(hh, dimms, dimm, tmp) { free(dimm->CEarray); free(dimm->timearray); free(dimm->CErates); HASH_DEL(dimms, dimm); free(dimm); } free(dimms); log_message(LOG_FILE,"terminate signal catched"); exit(0); break; } } static void get_edac_values () { edac_mc *mc; edac_csrow *csrow; struct DIMM_struct * dimm; struct edac_mc_info mci; struct edac_csrow_info csi; int i,j; int id=0; char slot[32]; struct edac_handle *edac; static struct prog_ctx prog_ctx = { "report", NULL, 0, 0, 0, NULL }; if (!(edac = edac_handle_create ())) { fprintf (stderr, "edac_handle_create: Out of memory!\n"); exit (1); } if (edac_handle_init (edac) < 0) { fprintf (stderr, "Unable to get EDAC data: %s\n", edac_strerror (edac)); edac_handle_destroy (edac); exit (1); } prog_ctx.edac=edac; edac_for_each_mc_info (prog_ctx.edac, mc, mci) { edac_for_each_csrow_info (mc, csrow, csi) { for (i = 0; i < EDAC_MAX_CHANNELS; i++) { struct edac_channel *ch = &csi.channel[i]; if (!ch->valid) continue; sprintf(slot,"%s:%s:%s",mci.id, csi.id, ch->dimm_label); HASH_FIND_STR( dimms, slot, dimm); if (!dimm){ dimm = (struct DIMM_struct *) malloc(sizeof( struct DIMM_struct)); dimm->id = id++; dimm->CEcnt = ch->ce_count; dimm->CEarray = (unsigned int *) malloc (sizeof(unsigned int)* BUF); dimm->timearray = (unsigned int *) malloc (sizeof(unsigned int)* BUF); dimm->CErates = (float *) malloc (sizeof(float )* 4); for (j=0; j<BUF; j++){ dimm->CEarray[j]=0.; dimm->timearray[j]=start_time; } for (j=0; j<4; j++) dimm->CErates[j]=0.; strcpy(dimm->slot,slot); HASH_ADD_STR( dimms, slot, dimm ); }else{ dimm->CEcnt = ch->ce_count ; } } } } edac_handle_destroy (edac); return; } -- System Information: Debian Release: 7.5 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 3.12.18-atlas (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=de_DE@euro (charmap=UTF-8) (ignored: LC_ALL set to de_DE.utf-8) Shell: /bin/sh linked to /bin/dash Versions of packages libsysfs2 depends on: ii libc6 2.13-38+deb7u1 ii multiarch-support 2.13-38+deb7u1 libsysfs2 recommends no packages. libsysfs2 suggests no packages. -- no debconf information -- To UNSUBSCRIBE, email to debian-qa-packages-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20140603102837.26646.92743.reportbug@a3017.atlas.local