[Tarantool-patches] [PATCH 03/43] build: export src/lib/core/clock.c symbols

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sun Apr 12 03:13:11 MSK 2020


Exports functions used by src/lua/clock.lua via FFI.

Part of #2971
---
 extra/exports        |  8 --------
 src/exports.c        |  3 +++
 src/lib/core/clock.c | 16 ++++++++++++++++
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/extra/exports b/extra/exports
index 9323996c1..6e6b5afd9 100644
--- a/extra/exports
+++ b/extra/exports
@@ -240,14 +240,6 @@ box_latch_delete
 box_latch_lock
 box_latch_trylock
 box_latch_unlock
-clock_realtime
-clock_monotonic
-clock_process
-clock_thread
-clock_realtime64
-clock_monotonic64
-clock_process64
-clock_thread64
 string_strip_helper
 
 # Lua / LuaJIT
diff --git a/src/exports.c b/src/exports.c
index 4bb423a57..378ebfb42 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -48,10 +48,13 @@
  * Add new exporters here. Keep them in alphabetical order.
  */
 
+EXPORT(clock_export_syms);
+
 void
 export_syms(void)
 {
 	void *syms[] = {
+		clock_export_syms,
 	};
 	const int func_count = sizeof(syms) / sizeof(syms[0]);
 	for (int i = 0; i < func_count; ++i)
diff --git a/src/lib/core/clock.c b/src/lib/core/clock.c
index ff3058485..72ba5c5d9 100644
--- a/src/lib/core/clock.c
+++ b/src/lib/core/clock.c
@@ -108,3 +108,19 @@ clock_thread64(void)
 	return (uint64_t) clock() * 1000000000 / CLOCKS_PER_SEC;
 #endif
 }
+
+void **
+clock_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)clock_realtime,
+		(void *)clock_monotonic,
+		(void *)clock_process,
+		(void *)clock_thread,
+		(void *)clock_realtime64,
+		(void *)clock_monotonic64,
+		(void *)clock_process64,
+		(void *)clock_thread64,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)



More information about the Tarantool-patches mailing list