Bläddra i källkod

- publishing up_since as core variable

Tomas Mandys 17 år sedan
förälder
incheckning
78a65d14d4
3 ändrade filer med 3 tillägg och 2 borttagningar
  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
 #define MAX_CTIME_LEN 128
 
 
 /* up time */
 /* up time */
-static time_t up_since;
 static char up_since_ctime[MAX_CTIME_LEN];
 static char up_since_ctime[MAX_CTIME_LEN];
 
 
 
 
@@ -646,7 +645,6 @@ rpc_export_t core_rpc_methods[] = {
 int rpc_init_time(void)
 int rpc_init_time(void)
 {
 {
 	char *t;
 	char *t;
-	time(&up_since);
 	t=ctime(&up_since);
 	t=ctime(&up_since);
 	if (strlen(t)+1>=MAX_CTIME_LEN) {
 	if (strlen(t)+1>=MAX_CTIME_LEN) {
 		ERR("Too long data %d\n", (int)strlen(t));
 		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 char* stat_file;
 extern unsigned short port_no;
 extern unsigned short port_no;
 
 
+extern time_t up_since;
 extern pid_t creator_pid;  /* pid of first process before daemonization */
 extern pid_t creator_pid;  /* pid of first process before daemonization */
 extern int uid;
 extern int uid;
 extern int gid;
 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 */
 gen_lock_t* process_lock;		/* lock on the process table */
 int process_no = 0;				/* index of process in the pt */
 int process_no = 0;				/* index of process in the pt */
 
 
+time_t up_since;
 int sig_flag = 0;              /* last signal received */
 int sig_flag = 0;              /* last signal received */
 int dont_fork = 0;
 int dont_fork = 0;
 int dont_daemonize = 0;
 int dont_daemonize = 0;
@@ -1276,6 +1277,7 @@ int main(int argc, char** argv)
 	int dont_fork_cnt;
 	int dont_fork_cnt;
 
 
 	/*init*/
 	/*init*/
+	time(&up_since);
 	creator_pid = getpid();
 	creator_pid = getpid();
 	ret=-1;
 	ret=-1;
 	my_argc=argc; my_argv=argv;
 	my_argc=argc; my_argv=argv;