From 0b7282c36a824a973665ffc372919d2931f704f4 Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Thu, 20 Apr 2023 19:19:23 +0000 Subject: [PATCH] Fix build errors on some compilers due to missing symbols. --- man/man7/telodendria-admin.7 | 3 --- src/Main.c | 21 ------------------- src/Routes/RouteConfig.c | 1 - src/Routes/RoutePrivileges.c | 1 - src/Routes/RouteProcControl.c | 7 +++---- src/include/Main.h | 39 ----------------------------------- 6 files changed, 3 insertions(+), 69 deletions(-) delete mode 100644 src/include/Main.h diff --git a/man/man7/telodendria-admin.7 b/man/man7/telodendria-admin.7 index f38cd81..ce2f19d 100644 --- a/man/man7/telodendria-admin.7 +++ b/man/man7/telodendria-admin.7 @@ -352,9 +352,6 @@ Field;Type;Description memory_allocated;Integer;T{ The total amount of memory allocated, measured in bytes. T} -uptime;Integer;T{ -The total uptime of the server process, measured in milliseconds. -T} version;String;T{ The current version of Telodendria. T} diff --git a/src/Main.c b/src/Main.c index 62082ab..9d87937 100644 --- a/src/Main.c +++ b/src/Main.c @@ -53,25 +53,6 @@ static Array *httpServers; static volatile int restart; -static unsigned long startTs; - -void -Restart(void) -{ - raise(SIGUSR1); -} - -void -Shutdown(void) -{ - raise(SIGINT); -} - -unsigned long -Uptime(void) -{ - return UtilServerTs() - startTs; -} static void SignalHandler(int signal) @@ -156,8 +137,6 @@ start: groupInfo = NULL; cron = NULL; - startTs = UtilServerTs(); - memset(&matrixArgs, 0, sizeof(matrixArgs)); if (!LogConfigGlobal()) diff --git a/src/Routes/RouteConfig.c b/src/Routes/RouteConfig.c index 767a2b1..a3b7142 100644 --- a/src/Routes/RouteConfig.c +++ b/src/Routes/RouteConfig.c @@ -24,7 +24,6 @@ #include #include -#include #include #include diff --git a/src/Routes/RoutePrivileges.c b/src/Routes/RoutePrivileges.c index ab05e6e..1d7bbe3 100644 --- a/src/Routes/RoutePrivileges.c +++ b/src/Routes/RoutePrivileges.c @@ -24,7 +24,6 @@ #include #include -#include #include #include diff --git a/src/Routes/RouteProcControl.c b/src/Routes/RouteProcControl.c index 83c9128..a87d9c5 100644 --- a/src/Routes/RouteProcControl.c +++ b/src/Routes/RouteProcControl.c @@ -24,10 +24,10 @@ #include #include -#include #include #include +#include ROUTE_IMPL(RouteProcControl, path, argp) { @@ -63,11 +63,11 @@ ROUTE_IMPL(RouteProcControl, path, argp) case HTTP_POST: if (strcmp(op, "restart") == 0) { - Restart(); + raise(SIGUSR1); } else if (strcmp(op, "shutdown") == 0) { - Shutdown(); + raise(SIGINT); } else { @@ -83,7 +83,6 @@ ROUTE_IMPL(RouteProcControl, path, argp) HashMapSet(response, "version", JsonValueString(TELODENDRIA_VERSION)); HashMapSet(response, "memory_allocated", JsonValueInteger(MemoryAllocated())); - HashMapSet(response, "uptime", JsonValueInteger(Uptime())); goto finish; } diff --git a/src/include/Main.h b/src/include/Main.h deleted file mode 100644 index 3fc883c..0000000 --- a/src/include/Main.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2022-2023 Jordan Bancino <@jordan:bancino.net> - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef TELODENDRIA_MAIN_H -#define TELODENDRIA_MAIN_H - -extern void - Restart(void); - -extern void - Shutdown(void); - -extern unsigned long - Uptime(void); - -extern int - main(int argc, char **argv); - -#endif /* TELODENDRIA_MAIN_H */