[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/REDIS PATCH v2 2/4] Build Redis server and client as libraries



The client and the server work. As discussed, there should also be a
README that covers some problems (like adding loopback if needed to
connect on localhost, or sending parameters to the client to add a
config file etc.).

There is also a problem with the client's IO, when typing in QEMU,
weird tabs and newlines get inserted, but this can be fixed later.

Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@xxxxxxxxx>


On Sun, Nov 17, 2019 at 9:21 AM Costin Lupu <costin.lup@xxxxxxxxx> wrote:
>
> We try to keep the same structure as for Linux builds. We use a library for 
> the
> internal dependencies implementations (Lua, hiredis) and refactor the code
> common to both server and client into a common library. We also add the 
> patches
> for building successfully.
>
> Signed-off-by: Bogdan Lascu <lascu.bogdan96@xxxxxxxxx>
> Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
> ---
>  Config.uk                                     |  43 +++-
>  Makefile.uk                                   | 234 ++++++++++++++++++
>  ...se-linux-macros-for-Unikraft-as-well.patch |  26 ++
>  ...src-sds.h-Declare-SDS_INIT-as-extern.patch |  28 +++
>  ...Make-bytesToHuman-definitions-static.patch |  43 ++++
>  ...i.c-Disable-_serverAssert-definition.patch |  42 ++++
>  6 files changed, 414 insertions(+), 2 deletions(-)
>  create mode 100644 Makefile.uk
>  create mode 100644 
> patches/0001-hiredis-Use-linux-macros-for-Unikraft-as-well.patch
>  create mode 100644 patches/0002-src-sds.h-Declare-SDS_INIT-as-extern.patch
>  create mode 100644 patches/0003-Make-bytesToHuman-definitions-static.patch
>  create mode 100644 
> patches/0004-src-redis-cli.c-Disable-_serverAssert-definition.patch
>
> diff --git a/Config.uk b/Config.uk
> index dea2ebf..754c4a1 100644
> --- a/Config.uk
> +++ b/Config.uk
> @@ -1,7 +1,46 @@
> -config LIBREDIS
> +menuconfig LIBREDIS
>         bool "Redis"
>         default n
> -       select LIBNOLIBC if !HAVE_LIBC
> +
> +if LIBREDIS
> +# hidden
> +config LIBREDIS_COMMON
> +       bool
> +       default n
>         select LIBUKDEBUG
>         select LIBUKALLOC
>         select LIBUKSCHED
> +       select LIBNEWLIBC
> +       select LIBNEWLIBC_WANT_IO_C99_FORMATS if LIBNEWLIBC
> +       select LIBNEWLIBC_LINUX_ERRNO_EXTENSIONS if LIBNEWLIBC
> +       select LIBPTHREAD_EMBEDDED
> +       select UKSYSINFO
> +       select LIBPOSIX_LIBDL
> +       select LIBLWIP
> +       select LWIP_IPV6
> +
> +config LIBREDIS_SERVER
> +       bool "Redis server"
> +       default y
> +       select LIBREDIS_COMMON
> +       select LIBREDIS_HIREDIS
> +       imply LIBREDIS_LUA
> +       help
> +               Build the Redis server library.
> +
> +config LIBREDIS_CLIENT
> +       bool "Redis client"
> +       default n
> +       select LIBREDIS_COMMON
> +       select LIBREDIS_HIREDIS
> +       help
> +               Build the Redis client library.
> +
> +config LIBREDIS_LUA
> +       bool "Use internal Lua implementation"
> +       default n
> +
> +config LIBREDIS_HIREDIS
> +       bool "Use internal Hiredis implementation"
> +       default n
> +endif
> diff --git a/Makefile.uk b/Makefile.uk
> new file mode 100644
> index 0000000..35287ba
> --- /dev/null
> +++ b/Makefile.uk
> @@ -0,0 +1,234 @@
> +#  SPDX-License-Identifier: BSD-3-Clause
> +#
> +#  Redis Makefile.uk
> +#
> +#  Authors: Bogdan Lascu <lascu.bogdan96@xxxxxxxxx>
> +#           Costin Lupu <costin.lupu@xxxxxxxxx>
> +#
> +#  Copyright (c) 2019, University Politehnica of Bucharest. All rights 
> reserved.
> +#
> +#  Redistribution and use in source and binary forms, with or without
> +#  modification, are permitted provided that the following conditions
> +#  are met:
> +#
> +#  1. Redistributions of source code must retain the above copyright
> +#     notice, this list of conditions and the following disclaimer.
> +#  2. Redistributions in binary form must reproduce the above copyright
> +#     notice, this list of conditions and the following disclaimer in the
> +#     documentation and/or other materials provided with the distribution.
> +#  3. Neither the name of the copyright holder nor the names of its
> +#     contributors may be used to endorse or promote products derived from
> +#     this software without specific prior written permission.
> +#
> +#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
> IS"
> +#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> +#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> +#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> +#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> +#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> +#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> +#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> +#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> +#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> +#  POSSIBILITY OF SUCH DAMAGE.
> +#
> +#  THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
> +#
> +
> +################################################################################
> +# Library registration
> +################################################################################
> +$(eval $(call addlib_s,libredis,$(CONFIG_LIBREDIS)))
> +$(eval $(call addlib_s,libredis_lua,$(CONFIG_LIBREDIS_LUA)))
> +$(eval $(call addlib_s,libredis_hiredis,$(CONFIG_LIBREDIS_HIREDIS)))
> +$(eval $(call addlib_s,libredis_common,$(CONFIG_LIBREDIS_COMMON)))
> +$(eval $(call addlib_s,libredis_server,$(CONFIG_LIBREDIS_SERVER)))
> +$(eval $(call addlib_s,libredis_client,$(CONFIG_LIBREDIS_CLIENT)))
> +
> +################################################################################
> +# Sources
> +################################################################################
> +LIBREDIS_VERSION=5.0.6
> +LIBREDIS_URL=https://github.com/antirez/redis/archive/$(LIBREDIS_VERSION).zip
> +LIBREDIS_BASENAME=redis-$(LIBREDIS_VERSION)
> +LIBREDIS_PATCHDIR=$(LIBREDIS_BASE)/patches
> +$(eval $(call fetch,libredis,$(LIBREDIS_URL)))
> +$(eval $(call patch,libredis,$(LIBREDIS_PATCHDIR),$(LIBREDIS_BASENAME)))
> +
> +################################################################################
> +# Helpers
> +################################################################################
> +LIBREDIS_SRC  = $(LIBREDIS_ORIGIN)/$(LIBREDIS_BASENAME)/src
> +LIBREDIS_DEPS = $(LIBREDIS_ORIGIN)/$(LIBREDIS_BASENAME)/deps
> +
> +################################################################################
> +# Library includes
> +################################################################################
> +CINCLUDES-y   += -I$(LIBREDIS_BASE)/include
> +CXXINCLUDES-y += -I$(LIBREDIS_BASE)/include
> +
> +LIBREDIS_CINCLUDES-$(CONFIG_LIBREDIS_HIREDIS) += -I$(LIBREDIS_DEPS)/hiredis
> +LIBREDIS_CINCLUDES-$(CONFIG_LIBREDIS_LUA) += -I$(LIBREDIS_DEPS)/lua/src
> +
> +################################################################################
> +# Flags
> +################################################################################
> +# Suppress some warnings to make the build process look neater
> +LIBREDIS_FLAGS_SUPPRESS = -Wno-unused-parameter -Wno-unused-variable \
> +       -Wno-unused-value -Wno-implicit-fallthrough -Wno-char-subscripts \
> +       -Wno-misleading-indentation
> +LIBREDIS_CFLAGS-y += $(LIBREDIS_FLAGS_SUPPRESS)
> +
> +################################################################################
> +# Redis internal Lua
> +################################################################################
> +LIBREDIS_LUA_CFLAGS-y += $(LIBREDIS_CFLAGS-y)
> +LIBREDIS_LUA_CFLAGS-y += -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC=''
> +
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/fpconv.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lapi.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lauxlib.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lbaselib.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lcode.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/ldblib.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/ldebug.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/ldo.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/ldump.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lfunc.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lgc.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/linit.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/liolib.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/llex.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lmathlib.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lmem.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/loadlib.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lobject.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lopcodes.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/loslib.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lparser.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lstate.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lstring.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lstrlib.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/ltable.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/ltablib.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/ltm.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lua_bit.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lua_cjson.c
> +LIBREDIS_LUA_LUA_CJSON_FLAGS-y += -Wno-sign-compare
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lua_cmsgpack.c
> +LIBREDIS_LUA_LUA_CMSGPACK_FLAGS-y += -Wno-sign-compare
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lua_struct.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lundump.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lvm.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/lzio.c
> +LIBREDIS_LUA_SRCS-y += $(LIBREDIS_DEPS)/lua/src/strbuf.c
> +
> +################################################################################
> +# Redis internal Hiredis
> +################################################################################
> +LIBREDIS_HIREDIS_CFLAGS-y += $(LIBREDIS_CFLAGS-y)
> +
> +LIBREDIS_HIREDIS_SRCS-y += $(LIBREDIS_DEPS)/hiredis/async.c
> +LIBREDIS_HIREDIS_SRCS-y += $(LIBREDIS_DEPS)/hiredis/hiredis.c
> +LIBREDIS_HIREDIS_SRCS-y += $(LIBREDIS_DEPS)/hiredis/net.c
> +LIBREDIS_HIREDIS_SRCS-y += $(LIBREDIS_DEPS)/hiredis/read.c
> +#LIBREDIS_HIREDIS_SRCS-y += $(LIBREDIS_DEPS)/hiredis/sds.c
> +LIBREDIS_HIREDIS_SRCS-y += $(LIBREDIS_SRC)/sds.c
> +
> +################################################################################
> +# Functionality shared between server and client
> +################################################################################
> +LIBREDIS_COMMON_CFLAGS-y    += $(LIBREDIS_CFLAGS-y)
> +LIBREDIS_COMMON_CFLAGS-y    += -Wno-missing-field-initializers
> +LIBREDIS_COMMON_CFLAGS-y    += -DREDIS_STATIC=''
> +LIBREDIS_COMMON_CINCLUDES-y += $(LIBREDIS_CINCLUDES-y)
> +
> +LIBREDIS_COMMON_SRCS-y += $(LIBREDIS_SRC)/adlist.c
> +LIBREDIS_COMMON_SRCS-y += $(LIBREDIS_SRC)/ae.c
> +LIBREDIS_COMMON_SRCS-y += $(LIBREDIS_SRC)/anet.c
> +LIBREDIS_COMMON_SRCS-y += $(LIBREDIS_SRC)/crc16.c
> +LIBREDIS_COMMON_SRCS-y += $(LIBREDIS_SRC)/crc64.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/debug.c
> +LIBREDIS_COMMON_SRCS-y += $(LIBREDIS_SRC)/dict.c
> +LIBREDIS_COMMON_SRCS-y += $(LIBREDIS_SRC)/release.c
> +LIBREDIS_COMMON_SRCS-y += $(LIBREDIS_SRC)/siphash.c
> +LIBREDIS_COMMON_SRCS-y += $(LIBREDIS_SRC)/zmalloc.c
> +
> +################################################################################
> +# Redis server
> +################################################################################
> +LIBREDIS_SERVER_CFLAGS-y    += $(LIBREDIS_COMMON_CFLAGS-y)
> +LIBREDIS_SERVER_CINCLUDES-y += $(LIBREDIS_COMMON_CINCLUDES-y)
> +
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/aof.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/bio.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/bitops.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/blocked.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/childinfo.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/cluster.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/config.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/db.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/defrag.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/endianconv.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/evict.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/expire.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/geo.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/geohash.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/geohash_helper.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/hyperloglog.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/intset.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/latency.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/lazyfree.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/listpack.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/localtime.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/lolwut.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/lolwut5.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/lzf_c.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/lzf_d.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/memtest.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/module.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/multi.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/networking.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/notify.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/object.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/pqsort.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/pubsub.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/quicklist.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/rand.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/rax.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/rdb.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/redis-check-aof.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/redis-check-rdb.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/replication.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/rio.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/scripting.c
> +#LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/sds.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/sentinel.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/server.c
> +LIBREDIS_SERVER_SERVER_FLAGS-y += -Dmain=redis_server_main
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/setproctitle.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/sha1.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/slowlog.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/sort.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/sparkline.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/syncio.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/t_hash.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/t_list.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/t_set.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/t_stream.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/t_string.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/t_zset.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/util.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/ziplist.c
> +LIBREDIS_SERVER_SRCS-y += $(LIBREDIS_SRC)/zipmap.c
> +
> +################################################################################
> +# Redis client
> +################################################################################
> +LIBREDIS_CLIENT_CFLAGS-y    += $(LIBREDIS_COMMON_CFLAGS-y)
> +LIBREDIS_CLIENT_CINCLUDES-y += $(LIBREDIS_COMMON_CINCLUDES-y)
> +LIBREDIS_CLIENT_CINCLUDES-y += -I$(LIBREDIS_DEPS)/linenoise
> +
> +LIBREDIS_CLIENT_SRCS-y += $(LIBREDIS_SRC)/redis-cli.c
> +LIBREDIS_CLIENT_REDIS-CLI_FLAGS-y += -Dmain=redis_client_main
> +LIBREDIS_CLIENT_SRCS-y += $(LIBREDIS_DEPS)/linenoise/linenoise.c
> diff --git a/patches/0001-hiredis-Use-linux-macros-for-Unikraft-as-well.patch 
> b/patches/0001-hiredis-Use-linux-macros-for-Unikraft-as-well.patch
> new file mode 100644
> index 0000000..848c1fe
> --- /dev/null
> +++ b/patches/0001-hiredis-Use-linux-macros-for-Unikraft-as-well.patch
> @@ -0,0 +1,26 @@
> +From b715e80ac71da7b13715e223d9169d11c71ad7ff Mon Sep 17 00:00:00 2001
> +From: Costin Lupu <costin.lupu@xxxxxxxxx>
> +Date: Fri, 1 Nov 2019 12:57:22 +0200
> +Subject: [UNIKRAFT PATCH] hiredis: Use linux macros for Unikraft as well
> +
> +Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
> +---
> + deps/hiredis/fmacros.h | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/deps/hiredis/fmacros.h b/deps/hiredis/fmacros.h
> +index 9a56643..1c9828b 100644
> +--- a/deps/hiredis/fmacros.h
> ++++ b/deps/hiredis/fmacros.h
> +@@ -1,7 +1,7 @@
> + #ifndef __HIREDIS_FMACRO_H
> + #define __HIREDIS_FMACRO_H
> +
> +-#if defined(__linux__)
> ++#if defined(__linux__) || defined(__Unikraft__)
> + #define _BSD_SOURCE
> + #define _DEFAULT_SOURCE
> + #endif
> +--
> +2.20.1
> +
> diff --git a/patches/0002-src-sds.h-Declare-SDS_INIT-as-extern.patch 
> b/patches/0002-src-sds.h-Declare-SDS_INIT-as-extern.patch
> new file mode 100644
> index 0000000..30d886d
> --- /dev/null
> +++ b/patches/0002-src-sds.h-Declare-SDS_INIT-as-extern.patch
> @@ -0,0 +1,28 @@
> +From 3244c867fd93021e311d425aae6aee0256b06179 Mon Sep 17 00:00:00 2001
> +From: Costin Lupu <costin.lupu@xxxxxxxxx>
> +Date: Sat, 16 Nov 2019 22:39:14 +0200
> +Subject: [UNIKRAFT PATCH] src/sds.h: Declare SDS_INIT as extern
> +
> +This should be also upstreamed.
> +
> +Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
> +---
> + src/sds.h | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/src/sds.h b/src/sds.h
> +index 1bdb60d..adcc12c 100644
> +--- a/src/sds.h
> ++++ b/src/sds.h
> +@@ -34,7 +34,7 @@
> + #define __SDS_H
> +
> + #define SDS_MAX_PREALLOC (1024*1024)
> +-const char *SDS_NOINIT;
> ++extern const char *SDS_NOINIT;
> +
> + #include <sys/types.h>
> + #include <stdarg.h>
> +--
> +2.20.1
> +
> diff --git a/patches/0003-Make-bytesToHuman-definitions-static.patch 
> b/patches/0003-Make-bytesToHuman-definitions-static.patch
> new file mode 100644
> index 0000000..5d8d30f
> --- /dev/null
> +++ b/patches/0003-Make-bytesToHuman-definitions-static.patch
> @@ -0,0 +1,43 @@
> +From cb6a16e1526741a5e4b0feea12e88b92db99672b Mon Sep 17 00:00:00 2001
> +From: Costin Lupu <costin.lupu@xxxxxxxxx>
> +Date: Sat, 16 Nov 2019 22:45:13 +0200
> +Subject: [UNIKRAFT PATCH] Make bytesToHuman() definitions static
> +
> +This should be either upstreamed or we should refactor and use a single 
> function
> +and then upstream that second solution.
> +
> +Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
> +---
> + src/redis-cli.c | 2 +-
> + src/server.c    | 2 +-
> + 2 files changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/src/redis-cli.c b/src/redis-cli.c
> +index 480921c..9f1a14e 100644
> +--- a/src/redis-cli.c
> ++++ b/src/redis-cli.c
> +@@ -6684,7 +6684,7 @@ static long getLongInfoField(char *info, char *field) {
> +
> + /* Convert number of bytes into a human readable string of the form:
> +  * 100B, 2G, 100M, 4K, and so forth. */
> +-void bytesToHuman(char *s, long long n) {
> ++static void bytesToHuman(char *s, long long n) {
> +     double d;
> +
> +     if (n < 0) {
> +diff --git a/src/server.c b/src/server.c
> +index 7f0acaa..2524a12 100644
> +--- a/src/server.c
> ++++ b/src/server.c
> +@@ -3058,7 +3058,7 @@ NULL
> +
> + /* Convert an amount of bytes into a human readable string in the form
> +  * of 100B, 2G, 100M, 4K, and so forth. */
> +-void bytesToHuman(char *s, unsigned long long n) {
> ++static void bytesToHuman(char *s, unsigned long long n) {
> +     double d;
> +
> +     if (n < 1024) {
> +--
> +2.20.1
> +
> diff --git 
> a/patches/0004-src-redis-cli.c-Disable-_serverAssert-definition.patch 
> b/patches/0004-src-redis-cli.c-Disable-_serverAssert-definition.patch
> new file mode 100644
> index 0000000..c2d2480
> --- /dev/null
> +++ b/patches/0004-src-redis-cli.c-Disable-_serverAssert-definition.patch
> @@ -0,0 +1,42 @@
> +From fdec8931eaa02585033e00a16926a3b2a1b94661 Mon Sep 17 00:00:00 2001
> +From: Costin Lupu <costin.lupu@xxxxxxxxx>
> +Date: Sat, 16 Nov 2019 22:52:28 +0200
> +Subject: [UNIKRAFT PATCH] src/redis-cli.c: Disable _serverAssert() definition
> +
> +Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
> +---
> + src/redis-cli.c | 5 +++++
> + 1 file changed, 5 insertions(+)
> +
> +diff --git a/src/redis-cli.c b/src/redis-cli.c
> +index 9f1a14e..0bf48be 100644
> +--- a/src/redis-cli.c
> ++++ b/src/redis-cli.c
> +@@ -28,6 +28,9 @@
> +  * POSSIBILITY OF SUCH DAMAGE.
> +  */
> +
> ++#ifdef __Unikraft__
> ++#include <uk/config.h>
> ++#endif
> + #include "fmacros.h"
> + #include "version.h"
> +
> +@@ -432,12 +435,14 @@ void dictListDestructor(void *privdata, void *val)
> +     listRelease((list*)val);
> + }
> +
> ++#ifndef CONFIG_LIBREDIS_SERVER
> + /* _serverAssert is needed by dict */
> + void _serverAssert(const char *estr, const char *file, int line) {
> +     fprintf(stderr, "=== ASSERTION FAILED ===");
> +     fprintf(stderr, "==> %s:%d '%s' is not true",file,line,estr);
> +     *((char*)-1) = 'x';
> + }
> ++#endif
> +
> + 
> /*------------------------------------------------------------------------------
> +  * Help functions
> +--
> +2.20.1
> +
> --
> 2.20.1
>
>
> _______________________________________________
> Minios-devel mailing list
> Minios-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/mailman/listinfo/minios-devel

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.