commit 81c36ce: [Minor] Print more useful information in the `--version` output
Vsevolod Stakhov
vsevolod at rspamd.com
Fri Apr 7 20:42:03 UTC 2023
Author: Vsevolod Stakhov
Date: 2023-04-07 21:36:45 +0100
URL: https://github.com/rspamd/rspamd/commit/81c36ce90012a2977e12eba3ad0a51c499d97dfe (HEAD -> master)
[Minor] Print more useful information in the `--version` output
---
src/rspamd.c | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/src/rspamd.c b/src/rspamd.c
index bcc4e56dd..4e6336394 100644
--- a/src/rspamd.c
+++ b/src/rspamd.c
@@ -1267,14 +1267,38 @@ rspamd_spair_close (gpointer p)
g_free (p);
}
+const char*
+get_cpu_architecture(void) {
+#if defined(__x86_64__) || defined(_M_X64)
+ return "x86_64";
+#elif defined(__i386) || defined(_M_IX86)
+ return "x86";
+#elif defined(__aarch64__)
+ return "ARM64";
+#elif defined(__arm__) || defined(_M_ARM)
+ return "ARM";
+#elif defined(__mips__)
+ return "MIPS";
+#elif defined(__powerpc__) || defined(_M_PPC)
+ return "PowerPC";
+#elif defined(__sparc__)
+ return "SPARC";
+#else
+ return "Unknown";
+#endif
+}
+
static void
-version (void)
+version (struct rspamd_main *rspamd_main)
{
#if defined(GIT_VERSION) && GIT_VERSION == 1
rspamd_printf ("Rspamd daemon version " RVERSION "-git." RID "\n\n");
#else
rspamd_printf ("Rspamd daemon version " RVERSION "\n\n");
#endif
+ rspamd_printf("CPU architecture %s; features: %s\n",
+ get_cpu_architecture(),
+ rspamd_main->cfg->libs_ctx->crypto_ctx->cpu_extensions);
#ifdef WITH_HYPERSCAN
rspamd_printf ("Hyperscan enabled: TRUE\n");
#else
@@ -1287,9 +1311,9 @@ version (void)
rspamd_printf ("Jemalloc enabled: FALSE\n");
#endif
#ifdef WITH_LUAJIT
- rspamd_printf ("LuaJIT enabled: TRUE\n");
+ rspamd_printf ("LuaJIT enabled: TRUE (LuaJIT version: %s)\n", LUAJIT_VERSION);
#else
- rspamd_printf ("LuaJIT enabled: FALSE\n");
+ rspamd_printf ("LuaJIT enabled: FALSE (Lua version: %s)\n", LUA_VERSION);
#endif
#ifndef __has_feature
# define __has_feature(x) 0
@@ -1418,7 +1442,7 @@ main (gint argc, gchar **argv, gchar **env)
read_cmd_line (&argc, &argv, rspamd_main->cfg);
if (show_version) {
- version ();
+ version (rspamd_main);
exit (EXIT_SUCCESS);
}
More information about the Commits
mailing list