[Bug #2881] 网卡流量异常误报,修正编译错误,修改版本号1.20

要提交的变更:
	修改:     common.c
	修改:     proc_inv.h
	修改:     read_netcard.c
	修改:     version.h

	Signed-off-by: Zhang, Jialing <jlzhang@linx-info.com>
This commit is contained in:
Zhang, Jialing
2016-08-31 16:55:34 +08:00
parent 9b4ca60b17
commit 05ae4729f3
4 changed files with 20 additions and 7 deletions

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

@@ -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];

View File

@@ -1,5 +1,6 @@
#include "mnic.h"
static int sys_nic_debug=0;
static char *prase_digit(char **s)
{
char *retp = NULL;
@@ -54,9 +55,13 @@ char *get_name(char *name, char *p)
int get_dev_fields(char *str, NETCARD_INFO *ife)
{
if( getenv("SYS_NIC_DEBUG") ) {
sys_nic_debug = 1;
}
int i = 0;
char *retp[16];
char error_str[1024];
while((retp[i] = prase_digit(&str)) != NULL){i++;if(i > 15)break;}
ife->rx_bytes = atoll(retp[0]);
ife->rx_packets = atoll(retp[1]);
@@ -71,6 +76,10 @@ int get_dev_fields(char *str, NETCARD_INFO *ife)
ife->tx_fifo_errors = atol(retp[12]);
ife->collisions = atol(retp[13]);
ife->tx_carrier_errors = atol(retp[14]);
if( 0 ) {
snprintf(error_str, sizeof(error_str), "ife->rx_bytes%lld:\tife->tx_bytes=%lld\n",ife->rx_bytes,ife->tx_bytes);
record_log(error_str);
}
return 0;
}

View File

@@ -1,5 +1,5 @@
// version=1.14
#ifndef MNIC_VERSION
#define MNIC_VERSION "1.14"
#define MNIC_VERSION "1.20"
#endif