Rename and export MaxScaleUptime()

MaxScaleUptime() renamed to maxscale_uptime() and moved from
gateway.c (MaxScale main) to misc.c, which is included in the
maxscale_common library. That way the symbol will be available
at link-time and will thus not prevent the use of the linker
flags -Wl,-z,defs (resolve all symbols at link-time) when
linking a module that uses maxscale_uptime().
This commit is contained in:
Johan Wikman
2016-03-01 21:04:22 +02:00
parent cb3213af63
commit 52e1b24975
4 changed files with 48 additions and 10 deletions

View File

@ -99,8 +99,6 @@
# define _GNU_SOURCE
#endif
time_t MaxScaleStarted;
extern char *program_invocation_name;
extern char *program_invocation_short_name;
@ -1293,6 +1291,8 @@ int main(int argc, char **argv)
*maxlog_enabled = 1;
*log_to_shm = 0;
maxscale_reset_uptime();
sigemptyset(&sigpipe_mask);
sigaddset(&sigpipe_mask, SIGPIPE);
progname = *argv;
@ -1967,7 +1967,6 @@ int main(int argc, char **argv)
if (daemon_mode)
write_child_exit_code(daemon_pipe[1], rc);
MaxScaleStarted = time(0);
/*<
* Serve clients.
*/
@ -2298,12 +2297,6 @@ static int write_pid_file() {
return 0;
}
int
MaxScaleUptime()
{
return time(0) - MaxScaleStarted;
}
bool handle_path_arg(char** dest, char* path, char* arg, bool rd, bool wr)
{
char pathbuffer[PATH_MAX+2];