[Bug #2881] 修正编译错误,添加调试信息

修改:     Makefile
	修改:     common.c
	修改:     mnic.c
	修改:     proc_inv.h

Signed-off-by: Zhang, Guodong <gdzhang@linx-info.com>
This commit is contained in:
Zhang, Guodong
2016-08-08 09:22:40 +08:00
parent f149505a40
commit 4809315f90
4 changed files with 20 additions and 12 deletions

View File

@@ -4,7 +4,7 @@ DEFAULTS = Makefile.config
include $(DEFAULTS)
all:sys_nicmonitor libnic_shm.so
all:sys_nicmonitor libnic_shm.so test
CFLAGS += -Wall -Wformat=2 -Wno-format-extra-args -Wformat-security -Wformat-nonliteral #-g

View File

@@ -1,3 +1,5 @@
#include <sys/stat.h>
#include <sys/types.h>
static pthread_mutex_t lock_record_logpath = PTHREAD_MUTEX_INITIALIZER;
#define LOGPATH_LOCK pthread_mutex_lock(&lock_record_logpath)
@@ -26,7 +28,7 @@ void create_dir(char *create_path)
{
if(tmp_path[i]=='/')
{
tmp[i] = 0;
tmp_path[i] = 0;
if( access(tmp_path, F_OK)!=0 )
{
if(mkdir(tmp_path, 0755)==-1)
@@ -45,6 +47,7 @@ static void *record_log_thread( void *arg )
char *log_str;
FILE *log_fp = NULL;
char **tmp = NULL;
char tmp_path[256];
int i = 0;
LOGPATH_LOCK;
strcpy(tmp_path,log_path);
@@ -173,6 +176,7 @@ void record_log(char *str)
log_prepare[log_idx] = keepstr;
log_idx++;
}
}
LOG_UNLOCK;
}

View File

@@ -377,7 +377,7 @@ static void init_shm(SHM **ptr, CONFIG_FILE_ST *p)
int size = 0;
key_t share_key;
// char *ref_count = NULL;
char *flag_str = NULL;
//char *flag_str = NULL;
char *path = shm_path;
char error_str[200];
@@ -409,7 +409,7 @@ static void init_shm(SHM **ptr, CONFIG_FILE_ST *p)
return;
}
flag_str = (char *)shmptr+size-16;
//flag_str = (char *)shmptr+size-16;
// if( strcmp( flag_str, "D5001" ) != 0 ) {
//first, do init.
@@ -738,12 +738,13 @@ static void *cacu_flow(void *p)
}else {
count_t = 1;
}
summit = (unsigned int)(curr->info.average_flow*8*100/1024/1024/ptr->mem.conf->flow_peak/count_t);
summit = (unsigned int)(curr->info.average_flow/1024/1024/ptr->mem.conf->flow_peak/count_t*8*100);
if( sys_nic_debug ) {
#if 1
printf("%s:\tcount=%d\tsummit=%d\tflow_limit:%d\taverage_flow:%lld\n", curr->info.charname, count_t, summit, conf.flow_limit, curr->info.average_flow);
#endif
snprintf(error_str, sizeof(error_str), "%s:\tcount=%d\tsummit=%d\tflow_limit:%d\taverage_flow:%lld\n", curr->info.charname, count_t, summit, conf.flow_limit, curr->info.average_flow);
snprintf(error_str, sizeof(error_str), "%s:\tcount=%d\tsummit=%d\tflow_limit:%d\taverage_flow:%lld\tbytes[%d]:%lld\tcurr->info.rx_bytes:%lld\tcurr->info.tx_bytes\n",
curr->info.charname, count_t, summit, conf.flow_limit, curr->info.average_flow,i,bytes[i],curr->rx_bytes,curr->tx_bytes);
record_log(error_str);
}
@@ -1214,6 +1215,7 @@ int get_conf()
// int i;
// struct passwd *user;
configfile_t *configfile;
char tmp_str[256];
// memset(buf, 0, sizeof(buf));
// uid=getuid();
@@ -1226,12 +1228,14 @@ int get_conf()
configfile = dotconf_create(conf_path, options, NULL, CASE_INSENSITIVE);
if (!configfile)
{
record_log("Warning can't reading config file\n");
sprintf(tmp_str,"%s","Warning can't reading config file\n");
record_log(tmp_str);
return -1;
}
if (dotconf_command_loop(configfile) == 0){
record_log("Warning can't reading config file\n");
sprintf(tmp_str,"%s","Warning can't reading config file\n");
record_log(tmp_str);
return -1;
}
dotconf_cleanup(configfile);

View File

@@ -34,12 +34,12 @@
#include "const.h"
//for alarm ................................
typedef struct MESS_BH
struct MESS_BH
{
unsigned char mtype;
int length;
};
typedef struct PROCESS_ALM
struct PROCESS_ALM
{
char context_name[MAX_STRING_LEN];
char app_name[MAX_STRING_LEN];
@@ -50,12 +50,12 @@ typedef struct PROCESS_ALM
//for mmi....................................
const int MAX_BUFFER_LEN = 500;
typedef struct MESS_BLOCK
struct MESS_BLOCK
{
unsigned char num;
char buffer[MAX_BUFFER_LEN];
};
typedef struct MESS_PROC
struct MESS_PROC
{
char context_name[MAX_STRING_LEN];
char app_name[MAX_STRING_LEN];