浏览代码

- publishing up_since as core variable

Tomas Mandys 17 年之前
父节点
当前提交
78a65d14d4
共有 3 个文件被更改,包括 3 次插入2 次删除
  1. 0 2
      core_cmd.c
  2. 1 0
      globals.h
  3. 2 0
      main.c

+ 0 - 2
core_cmd.c

@@ -177,7 +177,6 @@ static const char* dst_blst_stats_get_doc[] = {
 #define MAX_CTIME_LEN 128
 
 /* up time */
-static time_t up_since;
 static char up_since_ctime[MAX_CTIME_LEN];
 
 
@@ -646,7 +645,6 @@ rpc_export_t core_rpc_methods[] = {
 int rpc_init_time(void)
 {
 	char *t;
-	time(&up_since);
 	t=ctime(&up_since);
 	if (strlen(t)+1>=MAX_CTIME_LEN) {
 		ERR("Too long data %d\n", (int)strlen(t));

+ 1 - 0
globals.h

@@ -49,6 +49,7 @@ extern int config_check;
 extern char* stat_file;
 extern unsigned short port_no;
 
+extern time_t up_since;
 extern pid_t creator_pid;  /* pid of first process before daemonization */
 extern int uid;
 extern int gid;

+ 2 - 0
main.c

@@ -294,6 +294,7 @@ int *process_count = 0;			/* Total number of SER processes currently
 gen_lock_t* process_lock;		/* lock on the process table */
 int process_no = 0;				/* index of process in the pt */
 
+time_t up_since;
 int sig_flag = 0;              /* last signal received */
 int dont_fork = 0;
 int dont_daemonize = 0;
@@ -1276,6 +1277,7 @@ int main(int argc, char** argv)
 	int dont_fork_cnt;
 
 	/*init*/
+	time(&up_since);
 	creator_pid = getpid();
 	ret=-1;
 	my_argc=argc; my_argv=argv;