重命名: trunk/src/README -> ../README 删除: ../branches/sys_nicmonitor-1.4-龙芯-32/Makefile 删除: ../branches/sys_nicmonitor-1.4-龙芯-32/Makefile.config 删除: ../branches/sys_nicmonitor-1.4-龙芯-32/const.h 删除: ../branches/sys_nicmonitor-1.4-龙芯-32/dotconf.h 删除: ../branches/sys_nicmonitor-1.4-龙芯-32/mnic.c 删除: ../branches/sys_nicmonitor-1.4-龙芯-32/mnic.h 删除: ../branches/sys_nicmonitor-1.4-龙芯-32/nicinfo_shm.c 删除: ../branches/sys_nicmonitor-1.4-龙芯-32/nicinfo_shm.h 删除: ../branches/sys_nicmonitor-1.4-龙芯-32/proc_inv.h 删除: ../branches/sys_nicmonitor-1.4-龙芯-32/read_netcard.c 删除: ../branches/sys_nicmonitor-1.4-龙芯-32/send_alarm.c 删除: ../branches/sys_nicmonitor-1.4-龙芯-32/sys_netcard.h 删除: ../branches/sys_nicmonitor-1.4-龙芯-32/sys_nicmonitor 删除: ../branches/sys_nicmonitor-1.5/Makefile 删除: ../branches/sys_nicmonitor-1.5/Makefile.config 删除: ../branches/sys_nicmonitor-1.5/README1.5 删除: ../branches/sys_nicmonitor-1.5/const.h 删除: ../branches/sys_nicmonitor-1.5/mnic.c 删除: ../branches/sys_nicmonitor-1.5/mnic.h 删除: ../branches/sys_nicmonitor-1.5/nicinfo_shm.c 删除: ../branches/sys_nicmonitor-1.5/nicinfo_shm.h 删除: ../branches/sys_nicmonitor-1.5/proc_inv.h 删除: ../branches/sys_nicmonitor-1.5/read_netcard.c 删除: ../branches/sys_nicmonitor-1.5/send_alarm.c 删除: ../branches/sys_nicmonitor-1.5/sys_netcard.h 删除: ../branches/sys_nicmonitor-1.5/sys_nicmonitor 删除: ../branches/sys_nicmonitor-1.6/Makefile 删除: ../branches/sys_nicmonitor-1.6/Makefile.config 删除: ../branches/sys_nicmonitor-1.6/README1.5 删除: ../branches/sys_nicmonitor-1.6/README1.6 删除: ../branches/sys_nicmonitor-1.6/const.h 删除: ../branches/sys_nicmonitor-1.6/mnic.c 删除: ../branches/sys_nicmonitor-1.6/mnic.h 删除: ../branches/sys_nicmonitor-1.6/nicinfo_shm.c 删除: ../branches/sys_nicmonitor-1.6/nicinfo_shm.h 删除: ../branches/sys_nicmonitor-1.6/proc_inv.h 删除: ../branches/sys_nicmonitor-1.6/read_netcard.c 删除: ../branches/sys_nicmonitor-1.6/send_alarm.c 删除: ../branches/sys_nicmonitor-1.6/sys_netcard.h 删除: ../branches/sys_nicmonitor-1.6/sys_nicmonitor 重命名: trunk/sys_nicmonitor/src/Pkgfile -> Pkgfile 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/README -> README 删除: branches/sys_nicmonitor-1.0/Makefile 删除: branches/sys_nicmonitor-1.0/Makefile.config 删除: branches/sys_nicmonitor-1.0/const.h 删除: branches/sys_nicmonitor-1.0/mnic.c 删除: branches/sys_nicmonitor-1.0/mnic.h 删除: branches/sys_nicmonitor-1.0/nicinfo_shm.c 删除: branches/sys_nicmonitor-1.0/nicinfo_shm.h 删除: branches/sys_nicmonitor-1.0/proc_inv.h 删除: branches/sys_nicmonitor-1.0/read_netcard.c 删除: branches/sys_nicmonitor-1.0/send_alarm.c 删除: branches/sys_nicmonitor-1.0/sys_netcard.h 重命名: trunk/sys_nicmonitor/src/build.sh -> build.sh 重命名: trunk/sys_nicmonitor/src/dep/dotconf#1.0.13-1.pkg.tar.gz -> dep/dotconf#1.0.13-1.pkg.tar.gz 重命名: trunk/sys_nicmonitor/src/dep/libman.so -> dep/libman.so 重命名: trunk/sys_nicmonitor/src/dep/run.sh -> dep/run.sh 重命名: trunk/sys_nicmonitor/src/post_add.sh -> post_add.sh 重命名: trunk/sys_nicmonitor/src/post_mk.sh -> post_mk.sh 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/Makefile -> sys_nicmonitor/Makefile 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/Makefile.config -> sys_nicmonitor/Makefile.config 重命名: trunk/sys_nicmonitor/src/README -> sys_nicmonitor/README 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/common.c -> sys_nicmonitor/common.c 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/const.h -> sys_nicmonitor/const.h 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/mnic.c -> sys_nicmonitor/mnic.c 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/mnic.h -> sys_nicmonitor/mnic.h 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/nicinfo_shm.c -> sys_nicmonitor/nicinfo_shm.c 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/nicinfo_shm.h -> sys_nicmonitor/nicinfo_shm.h 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/proc_inv.h -> sys_nicmonitor/proc_inv.h 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/read_netcard.c -> sys_nicmonitor/read_netcard.c 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/send_alarm.c -> sys_nicmonitor/send_alarm.c 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/sys_netcard.h -> sys_nicmonitor/sys_netcard.h 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/test.c -> sys_nicmonitor/test.c 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/testread.c -> sys_nicmonitor/testread.c 重命名: trunk/sys_nicmonitor/src/sys_nicmonitor/version.h -> sys_nicmonitor/version.h 删除: tags/README1.5 删除: tags/README1.6 删除: tags/README1.7 删除: tags/libman.so 删除: tags/sys_nicmonitor-1.0.0/Makefile 删除: tags/sys_nicmonitor-1.0.0/Makefile.config 删除: tags/sys_nicmonitor-1.0.0/const.h 删除: tags/sys_nicmonitor-1.0.0/mnic.c 删除: tags/sys_nicmonitor-1.0.0/mnic.h 删除: tags/sys_nicmonitor-1.0.0/nicinfo_shm.c 删除: tags/sys_nicmonitor-1.0.0/nicinfo_shm.h 删除: tags/sys_nicmonitor-1.0.0/proc_inv.h 删除: tags/sys_nicmonitor-1.0.0/read_netcard.c 删除: tags/sys_nicmonitor-1.0.0/send_alarm.c 删除: tags/sys_nicmonitor-1.0.0/sys_netcard.h 删除: tags/sys_nicmonitor-1.5/Makefile 删除: tags/sys_nicmonitor-1.5/Makefile.config 删除: tags/sys_nicmonitor-1.5/const.h 删除: tags/sys_nicmonitor-1.5/mnic.c 删除: tags/sys_nicmonitor-1.5/mnic.h 删除: tags/sys_nicmonitor-1.5/nicinfo_shm.c 删除: tags/sys_nicmonitor-1.5/nicinfo_shm.h 删除: tags/sys_nicmonitor-1.5/proc_inv.h 删除: tags/sys_nicmonitor-1.5/read_netcard.c 删除: tags/sys_nicmonitor-1.5/send_alarm.c 删除: tags/sys_nicmonitor-1.5/sys_netcard.h 删除: tags/sys_nicmonitor-1.6/Makefile 删除: tags/sys_nicmonitor-1.6/Makefile.config 删除: tags/sys_nicmonitor-1.6/const.h 删除: tags/sys_nicmonitor-1.6/mnic.c 删除: tags/sys_nicmonitor-1.6/mnic.h 删除: tags/sys_nicmonitor-1.6/nicinfo_shm.c 删除: tags/sys_nicmonitor-1.6/nicinfo_shm.h 删除: tags/sys_nicmonitor-1.6/proc_inv.h 删除: tags/sys_nicmonitor-1.6/read_netcard.c 删除: tags/sys_nicmonitor-1.6/send_alarm.c 删除: tags/sys_nicmonitor-1.6/sys_netcard.h 删除: tags/sys_nicmonitor-1.7/Makefile 删除: tags/sys_nicmonitor-1.7/Makefile.config 删除: tags/sys_nicmonitor-1.7/const.h 删除: tags/sys_nicmonitor-1.7/mnic.c 删除: tags/sys_nicmonitor-1.7/mnic.h 删除: tags/sys_nicmonitor-1.7/nicinfo_shm.c 删除: tags/sys_nicmonitor-1.7/nicinfo_shm.h 删除: tags/sys_nicmonitor-1.7/proc_inv.h 删除: tags/sys_nicmonitor-1.7/read_netcard.c 删除: tags/sys_nicmonitor-1.7/send_alarm.c 删除: tags/sys_nicmonitor-1.7/sys_netcard.h 删除: tags/sys_nicmonitor-1.8/bin/README 删除: tags/sys_nicmonitor-1.8/bin/install.sh 删除: tags/sys_nicmonitor-1.8/bin/sys_nicmonitor#1.8-x86_64-Linx-Rocky4.2.pkg.tar.gz 删除: tags/sys_nicmonitor-1.8/doc/网卡监视程序动态库使用手册【新】.doc 删除: tags/sys_nicmonitor-1.8/doc/网卡监视程序安装说明以及使用手册【新】.doc 删除: tags/sys_nicmonitor-1.8/src/Pkgfile 删除: tags/sys_nicmonitor-1.8/src/README1.8 删除: tags/sys_nicmonitor-1.8/src/V1.8 删除: tags/sys_nicmonitor-1.8/src/build.sh 删除: tags/sys_nicmonitor-1.8/src/post_add.sh 删除: tags/sys_nicmonitor-1.8/src/post_mk.sh 删除: tags/sys_nicmonitor-1.8/src/sys_nicmonitor-1.8.tar.gz 删除: tags/sys_nicmonitor-1.8/test/Makefile 删除: tags/sys_nicmonitor-1.8/test/dotconf.h 删除: tags/sys_nicmonitor-1.8/test/getmem 删除: tags/sys_nicmonitor-1.8/test/getmem.c 删除: tags/sys_nicmonitor-1.8/test/mnic.h 删除: tags/sys_nicmonitor-1.8/test/nicinfo_shm.h 删除: tags/sys_nicmonitor-1.8/test/read_shm 删除: tags/sys_nicmonitor-1.8/test/read_shm.c 删除: tags/sys_nicmonitor-1.8/test/recv_msg 删除: tags/sys_nicmonitor-1.8/test/recv_msg.c 删除: tags/sys_nicmonitor-1.8/test/sys_netcard.h 重命名: trunk/test/Makefile -> test/Makefile 重命名: trunk/test/dotconf.h -> test/dotconf.h 重命名: trunk/test/getmem.c -> test/getmem.c 重命名: trunk/test/mnic.h -> test/mnic.h 重命名: trunk/test/nicinfo_shm.h -> test/nicinfo_shm.h 重命名: trunk/test/read_shm.c -> test/read_shm.c 重命名: trunk/test/recv_msg.c -> test/recv_msg.c 重命名: trunk/test/sys_netcard.h -> test/sys_netcard.h 删除: trunk/LATEST 删除: trunk/README 删除: trunk/bin/README 删除: trunk/bin/install.sh 删除: trunk/bin/sys_nicmonitor#1.8.1-x86_64-Linx-Rocky4.2.pkg.tar.gz 删除: trunk/doc/网卡监视程序动态库使用手册【新】.doc 删除: trunk/doc/网卡监视程序安装说明以及使用手册【新】.doc 删除: trunk/src/Pkgfile 删除: trunk/src/build.sh 删除: trunk/src/post_add.sh 删除: trunk/src/post_mk.sh 删除: trunk/src/sys_nicmonitor-1.8.tar.gz 删除: trunk/src/sys_nicmonitor-1.9.tar.gz 删除: trunk/sys_nicmonitor/README.md 删除: trunk/sys_nicmonitor/sys_nicmonitor-from-svn.tar.bz2 Signed-off-by: Zhang, Guodong <gdzhang@linx-info.com>
199 lines
5.1 KiB
C++
199 lines
5.1 KiB
C++
////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (c) Comets' Grp. of Kedong Corp 2008. All Rights Reserved.
|
|
//
|
|
// FileName : procconf.h
|
|
//
|
|
// Function : this class realize some basic functions for process managerment,
|
|
// such as initiate process, report status of process, check status of process,
|
|
// update status of process, get information of process
|
|
//
|
|
// Author :
|
|
//
|
|
// Date :
|
|
//
|
|
// Modify by :
|
|
//
|
|
// Mod Date :
|
|
//
|
|
////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef _PROCCONF_H
|
|
#define _PROCCONF_H
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <fcntl.h>
|
|
#include <sys/mman.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
//#include <iostream.h>
|
|
#include <signal.h>
|
|
|
|
#include "const.h"
|
|
|
|
//for alarm ................................
|
|
struct MESS_BH
|
|
{
|
|
unsigned char mtype;
|
|
int length;
|
|
};
|
|
struct PROCESS_ALM
|
|
{
|
|
char context_name[MAX_STRING_LEN];
|
|
char app_name[MAX_STRING_LEN];
|
|
char proc_name[MAX_STRING_LEN];
|
|
unsigned char status;
|
|
};
|
|
//for alarm end .............................
|
|
|
|
//for mmi....................................
|
|
const int MAX_BUFFER_LEN = 500;
|
|
struct MESS_BLOCK
|
|
{
|
|
unsigned char num;
|
|
char buffer[MAX_BUFFER_LEN];
|
|
};
|
|
struct MESS_PROC
|
|
{
|
|
char context_name[MAX_STRING_LEN];
|
|
char app_name[MAX_STRING_LEN];
|
|
char proc_name[MAX_STRING_LEN];
|
|
char status;
|
|
};
|
|
//for mmi end ................................
|
|
|
|
const int DEFAULT_PERIOD = 3;
|
|
const int COUNT_LIMIT = 2;
|
|
const int START_DEFAULT_PERIOD = 60;
|
|
const int START_COUNT_LIMIT = 5;
|
|
const int APP_COUNT_LIMIT = 1;
|
|
|
|
//process critical level
|
|
//const int WST_CRITICAL = 1; // Shutdown and reboot workstation when failed
|
|
//const int SYS_CRITICAL = 2; // Shutdown and reboot the system on the wst when failed
|
|
//const int USER_CRITICAL = 3; // Shutdown and reboot the subsystem when failed
|
|
//const int GENERAL = 4; // reboot the process
|
|
const int CRUCIAL = 1; // crucial process
|
|
const int GENERAL = 0; // general process
|
|
|
|
|
|
extern int srv_init(char *service,int port);
|
|
extern int Tcp_close(int sockfd);
|
|
extern int Tcp_read(int fd,char *ptr,int nbytes);
|
|
extern int Tcp_write(int fd,char *ptr,int nbytes);
|
|
extern int srv_accept(int fd,struct sockaddr *cli_addr,int *clilen);
|
|
extern int client_tcp_open(char *host,char *service,int port);
|
|
|
|
typedef struct
|
|
{
|
|
char context_name[MAX_STRING_LEN];
|
|
char app_name[MAX_STRING_LEN];
|
|
char proc_name[MAX_STRING_LEN];
|
|
pid_t proc_pid;
|
|
}PROC_ADM_INFO;
|
|
|
|
//***************************************************************
|
|
// structure name : PROC_INFO
|
|
// function : store process informatin
|
|
// author :
|
|
// date :
|
|
// modify by :
|
|
// modification :
|
|
// mod date :
|
|
//***************************************************************
|
|
typedef struct
|
|
{
|
|
int position;
|
|
char node_name[MAX_STRING_LEN];
|
|
char context_name[MAX_STRING_LEN];
|
|
char app_name[MAX_STRING_LEN];
|
|
char proc_name[MAX_STRING_LEN];
|
|
|
|
unsigned char active_flag;
|
|
unsigned char master_flag;
|
|
|
|
time_t startup_time;
|
|
time_t refresh_time;
|
|
short refresh_peri;
|
|
unsigned char monitor_type;
|
|
|
|
pid_t proc_pid;
|
|
unsigned char auto_start;
|
|
unsigned char act_timer;
|
|
unsigned char start_timer;
|
|
unsigned char critical_level;
|
|
|
|
char exefile_path[MAX_EXECMD_LEN];
|
|
|
|
}PROC_INFO;
|
|
|
|
//***************************************************************
|
|
// structure name : APP_INFO
|
|
// function : store application informatin
|
|
// author :
|
|
// date :
|
|
// modify by :
|
|
// modification :
|
|
// mod date :
|
|
//***************************************************************
|
|
typedef struct
|
|
{
|
|
int position;
|
|
char context_name[MAX_STRING_LEN];
|
|
int context_id;
|
|
char app_name[MAX_STRING_LEN];
|
|
int app_id;
|
|
unsigned char act_timer;
|
|
unsigned char active_flag;
|
|
}APP_INFO;
|
|
|
|
|
|
typedef struct
|
|
{
|
|
int no_proc;
|
|
int semdes_cfg;
|
|
PROC_INFO proc[MAX_LOCAL_PROCESS];
|
|
APP_INFO app[MAX_LOCAL_APP];
|
|
}PROCCFG;
|
|
|
|
class proc_invocation
|
|
{
|
|
public:
|
|
int m_init;
|
|
PROCCFG *proccfg_p;
|
|
|
|
public:
|
|
proc_invocation();
|
|
~proc_invocation();
|
|
|
|
int conf_create();
|
|
//int check_proc_status();
|
|
//int update_rtdb();
|
|
//int kill_proc(pid_t pid);
|
|
//int start_proc(char *cmdline);
|
|
//int send_alarm(char *context_name, char *app_name, char *proc_name, unsigned char status);
|
|
//int update_proc_status(char *context_name, char *app_name, char *proc_name, char status);
|
|
|
|
//int proc_init(char *context_name, char *app_name, char *proc_name, int critical_level);//exefile_path,auto_start
|
|
int proc_init(char *context_name, char *app_name, char *proc_name);
|
|
int proc_report(int pos, char status, int intertime=3);
|
|
int proc_exit(int proc_pos);
|
|
|
|
int get_pos(char *context_name, char *app_name, char *proc_name);
|
|
int is_proc_exist(char *context_name, char *app_name, char *proc_name);
|
|
int conf_map();
|
|
|
|
int get_procinfo(int position, PROC_ADM_INFO *p_info);
|
|
int get_active_pid(int &num, int *p_pidlist);
|
|
int is_proc_run(pid_t pid);
|
|
int is_proc_run(char *context_name, char *app_name, char *proc_name);
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|