|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [UNIKRAFT/LIBMEMCACHED PATCH 5/7] Provide main() function if configured to do so
From: gaulthier gain <gaulthier.gain@xxxxxxxxx>
We add a config option for enabling the main() function provided by
our Memcached glue code.
Signed-off-by: gaulthier gain <gaulthier.gain@xxxxxxxxx>
---
Config.uk | 9 ++++++++-
Makefile.uk | 8 ++++++++
main.c | 8 ++++++++
3 files changed, 24 insertions(+), 1 deletion(-)
create mode 100644 main.c
diff --git a/Config.uk b/Config.uk
index 1611588..9c5d57a 100644
--- a/Config.uk
+++ b/Config.uk
@@ -1,4 +1,11 @@
-config LIBMEMCACHED
+menuconfig LIBMEMCACHED
bool "libmemcached - Memcached"
default y
select LIBLIBEVENT
+
+if LIBMEMCACHED
+config LIBMEMCACHED_MAIN_FUNCTION
+ bool "Provide main function"
+ default n
+endif
+
diff --git a/Makefile.uk b/Makefile.uk
index 2e07f4e..636435f 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -74,9 +74,17 @@ LIBMEMCACHED_SUPPRESS_FLAGS-$(call gcc_version_ge,7,0)
+=-Wimplicit-fallthrough=
LIBMEMCACHED_CFLAGS-y += $(LIBMEMCACHED_FLAGS)
LIBMEMCACHED_CFLAGS-y += $(LIBMEMCACHED_SUPPRESS_FLAGS-y)
+################################################################################
+# Glue code
+################################################################################
+LIBMEMCACHED_SRCS-$(CONFIG_LIBMEMCACHED_MAIN_FUNCTION) +=
$(LIBMEMCACHED_BASE)/main.c|unikraft
+
################################################################################
# Memcached sources
################################################################################
+# Rename the main function found in memcached.c to memcached_main
+LIBMEMCACHED_MEMCACHED_FLAGS-y += -Dmain=memcached_main
+
LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/assoc.c
LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/authfile.c
LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/bipbuffer.c
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..6a2b1f4
--- /dev/null
+++ b/main.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+extern int memcached_main(int argc, char *argv[]);
+
+int main(int argc, char *argv[])
+{
+ printf("HeyHey\n");
+ return memcached_main(argc, argv);
+}
--
2.17.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |