void readSysProc(void)
{
char* procName;
proc_t p;
DIR* dir;
struct dirent* entry;
char path[32],sbuf[512];
int i=0;
SysProcNum=0; /* first set zero,this is very important!*/
if((dir=opendir("/proc"))==NULL)
{
mysyslog(LOG_ERR,"open directory /proc error!");
exit(0);
}
while((entry=readdir(dir))!=NULL)
{
if(!isdigit(*entry->d_name))
continue;
sprintf(path,"/proc/%s/status",entry->d_name);
if((file2str(path,sbuf,sizeof sbuf))!=-1)
{
parse_proc_status(sbuf,&p);
SysProc[i]=p;
i++;
SysProcNum++;
}
}
closedir(dir);
}