memcached: upgrade to 1.6.9

Fix Set but unused clang warning
sigignore issue is already fixed in 1.6.9

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2021-06-04 12:07:22 -07:00
parent eada1065ae
commit 4bcefa8176
3 changed files with 50 additions and 76 deletions

View File

@ -1,74 +0,0 @@
From b9040acdba1245f8cdf5e94384830e3d04fde98a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 22 Jul 2020 21:32:14 -0700
Subject: [PATCH] Replace sigignore with signal API
sigignore has been deprecated in glibc 2.32+ [1] and eventually it will be
removed, therefore substitute it
[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=02802fafcf6e11ea3f998f685035ffe568dfddeb
Upstream-Status: Submitted [https://github.com/memcached/memcached/pull/702]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
configure.ac | 1 -
memcached.c | 16 ++--------------
2 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/configure.ac b/configure.ac
index ffc98b2..4567b30 100644
--- a/configure.ac
+++ b/configure.ac
@@ -630,7 +630,6 @@ AC_CHECK_FUNCS(mlockall)
AC_CHECK_FUNCS(getpagesizes)
AC_CHECK_FUNCS(sysconf)
AC_CHECK_FUNCS(memcntl)
-AC_CHECK_FUNCS(sigignore)
AC_CHECK_FUNCS(clock_gettime)
AC_CHECK_FUNCS(preadv)
AC_CHECK_FUNCS(pread)
diff --git a/memcached.c b/memcached.c
index 9cb778d..91ced9e 100644
--- a/memcached.c
+++ b/memcached.c
@@ -8292,18 +8292,6 @@ static void sig_usrhandler(const int sig) {
stop_main_loop = GRACE_STOP;
}
-#ifndef HAVE_SIGIGNORE
-static int sigignore(int sig) {
- struct sigaction sa = { .sa_handler = SIG_IGN, .sa_flags = 0 };
-
- if (sigemptyset(&sa.sa_mask) == -1 || sigaction(sig, &sa, 0) == -1) {
- return -1;
- }
- return 0;
-}
-#endif
-
-
/*
* On systems that supports multiple page sizes we may reduce the
* number of TLB-misses by using the biggest available page size
@@ -9996,7 +9984,7 @@ int main (int argc, char **argv) {
/* daemonize if requested */
/* if we want to ensure our ability to dump core, don't chdir to / */
if (do_daemonize) {
- if (sigignore(SIGHUP) == -1) {
+ if (signal(SIGHUP, SIG_IGN) == SIG_ERR) {
perror("Failed to ignore SIGHUP");
}
if (daemonize(maxcore, settings.verbose) == -1) {
@@ -10146,7 +10134,7 @@ int main (int argc, char **argv) {
* ignore SIGPIPE signals; we can use errno == EPIPE if we
* need that information
*/
- if (sigignore(SIGPIPE) == -1) {
+ if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
perror("failed to ignore SIGPIPE; sigaction");
exit(EX_OSERR);
}
--
2.27.0

View File

@ -0,0 +1,48 @@
From d6294e9166e4875a0572349aabcc5e51acbd2e3c Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 4 Jun 2021 11:33:12 -0700
Subject: [PATCH] stats_prefix.c: Check for NDEBUG before using total_written
variable
When using NDEBUG assert macro is ineffective which is caught by latest
clang and reports that total_written is set but unused. Therefore check
for NDEBUG to make sure assert is used only when its effective
Fixes
error: variable 'total_written' set but not used [-Werror,-Wunused-but-set-variable]
size_t size = 0, written = 0, total_written = 0;
^
Upstream-Status: Submitted [https://github.com/memcached/memcached/pull/792]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
stats_prefix.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/stats_prefix.c b/stats_prefix.c
index 62f0d04..d72e514 100644
--- a/stats_prefix.c
+++ b/stats_prefix.c
@@ -127,8 +127,10 @@ char *stats_prefix_dump(int *length) {
PREFIX_STATS *pfs;
char *buf;
int i, pos;
- size_t size = 0, written = 0, total_written = 0;
-
+ size_t size = 0, written = 0;
+#ifndef NDEBUG
+ size_t total_written = 0;
+#endif
/*
* Figure out how big the buffer needs to be. This is the sum of the
* lengths of the prefixes themselves, plus the size of one copy of
@@ -154,8 +156,10 @@ char *stats_prefix_dump(int *length) {
pfs->prefix, pfs->num_gets, pfs->num_hits,
pfs->num_sets, pfs->num_deletes);
pos += written;
+#ifndef NDEBUG
total_written += written;
assert(total_written < size);
+#endif
}
}

View File

@ -21,9 +21,9 @@ RDEPENDS_${PN} += "perl perl-module-posix perl-module-autoloader \
SRC_URI = "http://www.memcached.org/files/${BP}.tar.gz \
file://memcached-add-hugetlbfs-check.patch \
file://0001-Replace-sigignore-with-signal-API.patch \
file://0002-stats_prefix.c-Check-for-NDEBUG-before-using-total_w.patch \
"
SRC_URI[sha256sum] = "908f0eecfa559129c9e44edc46f02e73afe8faca355b4efc5c86d902fc3e32f7"
SRC_URI[sha256sum] = "d5a62ce377314dbffdb37c4467e7763e3abae376a16171e613cbe69956f092d1"
# set the same COMPATIBLE_HOST as libhugetlbfs
COMPATIBLE_HOST = "(i.86|x86_64|powerpc|powerpc64|aarch64|arm).*-linux*"