summaryrefslogtreecommitdiff
path: root/lib/libfrr.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2018-10-01 19:02:39 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2018-10-02 10:26:25 +0200
commit42efb0d43b63f206c4dfb0c5e8c8a772a768b9d1 (patch)
tree92ea37563e19d001ddaa95e5d75df71c9aeab7a6 /lib/libfrr.c
parenteec50add2230f7d60d19383777145f0dffca9edc (diff)
lib: print version information in libfrr.so
This makes libfrr.so executable to print its version info. This is useful if you need to check your libfrr.so matches your daemons. Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/libfrr.c')
-rw-r--r--lib/libfrr.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/libfrr.c b/lib/libfrr.c
index 2bce4766d3..94cd0ab623 100644
--- a/lib/libfrr.c
+++ b/lib/libfrr.c
@@ -973,3 +973,25 @@ void frr_fini(void)
fclose(fp);
}
}
+
+#ifdef INTERP
+static const char interp[]
+ __attribute__((section(".interp"), used)) = INTERP;
+#endif
+/*
+ * executable entry point for libfrr.so
+ *
+ * note that libc initialization is skipped for this so the set of functions
+ * that can be called is rather limited
+ */
+extern void _libfrr_version(void)
+ __attribute__((visibility("hidden"), noreturn));
+void _libfrr_version(void)
+{
+ const char banner[] =
+ FRR_FULL_NAME " " FRR_VERSION ".\n"
+ FRR_COPYRIGHT GIT_INFO "\n"
+ "configured with:\n " FRR_CONFIG_ARGS "\n";
+ write(1, banner, sizeof(banner) - 1);
+ _exit(0);
+}