[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 10/29: testzzuf: added special debug functions
From: |
gnunet |
Subject: |
[libmicrohttpd] 10/29: testzzuf: added special debug functions |
Date: |
Tue, 20 Jun 2023 22:24:23 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 87d40361d30012eced13e0d0a7e0544754bc777b
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Oct 17 12:00:03 2022 +0300
testzzuf: added special debug functions
---
src/testzzuf/Makefile.am | 1 +
src/testzzuf/mhd_debug_funcs.c | 63 ++++++++++++++++++++++++++++++++++++++++++
src/testzzuf/mhd_debug_funcs.h | 47 +++++++++++++++++++++++++++++++
3 files changed, 111 insertions(+)
diff --git a/src/testzzuf/Makefile.am b/src/testzzuf/Makefile.am
index 69c6df87..5c5c00ea 100644
--- a/src/testzzuf/Makefile.am
+++ b/src/testzzuf/Makefile.am
@@ -3,6 +3,7 @@ SUBDIRS = .
AM_CPPFLAGS = \
-I$(top_srcdir)/src/include \
+ -I$(top_srcdir)/src/microhttpd \
-DMHD_CPU_COUNT=$(CPU_COUNT) \
$(CPPFLAGS_ac) $(LIBCURL_CPPFLAGS)
diff --git a/src/testzzuf/mhd_debug_funcs.c b/src/testzzuf/mhd_debug_funcs.c
new file mode 100644
index 00000000..9bfd3001
--- /dev/null
+++ b/src/testzzuf/mhd_debug_funcs.c
@@ -0,0 +1,63 @@
+/*
+ This file is part of GNU libmicrohttpd
+ Copyright (C) 2022 Evgeny Grin (Karlson2k)
+
+ GNU libmicrohttpd is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with GNU libmicrohttpd.
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file testzzuf/mhd_debug_funcs.c
+ * @brief Implementations of MHD private debug functions
+ * @author Karlson2k (Evgeny Grin)
+ */
+
+#include "mhd_debug_funcs.h"
+#include "internal.h"
+#include "mhd_sockets.h"
+
+/**
+ * Checks whether MHD can use accept() syscall and
+ * avoid accept4() syscall.
+ * @return non-zero if accept() is possible,
+ * zero if accept4() is always used by MHD
+ */
+int
+MHD_is_avoid_accept4_possible_ (void)
+{
+#if ! defined(USE_ACCEPT4)
+ return ! 0;
+#else /* ! USE_ACCEPT4 */
+ return (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_DEBUG_BUILD)) ?
+ ! 0 : 0;
+#endif /* ! USE_ACCEPT4 */
+}
+
+
+/**
+ * Switch MHD daemon to use accept() syscalls for new connections.
+ * @param daemon the daemon to operate
+ */
+void
+MHD_avoid_accept4_ (struct MHD_Daemon *daemon)
+{
+ (void) daemon; /* Mute compiler warning */
+#ifdef USE_ACCEPT4
+#ifdef _DEBUG
+ daemon->avoid_accept4 = true;
+#else /* ! _DEBUG */
+ abort ();
+#endif /* ! _DEBUG */
+#endif /* USE_ACCEPT4 */
+}
diff --git a/src/testzzuf/mhd_debug_funcs.h b/src/testzzuf/mhd_debug_funcs.h
new file mode 100644
index 00000000..02423edb
--- /dev/null
+++ b/src/testzzuf/mhd_debug_funcs.h
@@ -0,0 +1,47 @@
+/*
+ This file is part of GNU libmicrohttpd
+ Copyright (C) 2022 Evgeny Grin (Karlson2k)
+
+ GNU libmicrohttpd is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with GNU libmicrohttpd.
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file testzzuf/mhd_debug_funcs.h
+ * @brief Declarations of MHD private debug functions
+ * @author Karlson2k (Evgeny Grin)
+ */
+
+#ifndef MHD_DEBUG_FUNCS_H
+#define MHD_DEBUG_FUNCS_H 1
+
+struct MHD_Daemon;
+
+/**
+ * Checks whether MHD can use accept() syscall and
+ * avoid accept4() syscall.
+ * @return non-zero if accept() is possible,
+ * zero if accept4() is always used by MHD
+ */
+int
+MHD_is_avoid_accept4_possible_ (void);
+
+/**
+ * Switch MHD daemon to use accept() syscalls for new connections.
+ * @param daemon the daemon to operate
+ */
+void
+MHD_avoid_accept4_ (struct MHD_Daemon *daemon);
+
+#endif /* MHD_DEBUG_FUNCS_H */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] 08/29: tests: minor improvemnts, (continued)
- [libmicrohttpd] 08/29: tests: minor improvemnts, gnunet, 2023/06/20
- [libmicrohttpd] 07/29: Removed request line and headers processing old functions and variables, gnunet, 2023/06/20
- [libmicrohttpd] 09/29: daemon: added debug member to avoid accept4() usage, gnunet, 2023/06/20
- [libmicrohttpd] 01/29: Refactoring: check whether memory block is resizable, gnunet, 2023/06/20
- [libmicrohttpd] 06/29: Re-implemented parsing of the request headers and footers from scratch., gnunet, 2023/06/20
- [libmicrohttpd] 12/29: Added back testing with socat as a fallback option, gnunet, 2023/06/20
- [libmicrohttpd] 05/29: Request body processing: removed impossible code paths, gnunet, 2023/06/20
- [libmicrohttpd] 16/29: Added tests with single and double folded header, gnunet, 2023/06/20
- [libmicrohttpd] 21/29: process_request_body(): minor readability improvementы, gnunet, 2023/06/20
- [libmicrohttpd] 11/29: testzzuf: re-worked zzuf testing, gnunet, 2023/06/20
- [libmicrohttpd] 10/29: testzzuf: added special debug functions,
gnunet <=
- [libmicrohttpd] 22/29: Minor refactoring for partially processed request body, gnunet, 2023/06/20
- [libmicrohttpd] 14/29: Added test with folded header placed last, gnunet, 2023/06/20
- [libmicrohttpd] 15/29: Added test with large folded header, gnunet, 2023/06/20
- [libmicrohttpd] 20/29: Added checks for correct values specified for connection memory limits, gnunet, 2023/06/20
- [libmicrohttpd] 19/29: connection: fixed pipelined requests processing, gnunet, 2023/06/20
- [libmicrohttpd] 13/29: Added new tests with header fold, gnunet, 2023/06/20
- [libmicrohttpd] 18/29: Added proper connection's buffers pre-initialisaion, gnunet, 2023/06/20
- [libmicrohttpd] 17/29: connection.c: corrected error responses, gnunet, 2023/06/20
- [libmicrohttpd] 24/29: process new connection: fixed missing mutex unlock in error handling path, gnunet, 2023/06/20
- [libmicrohttpd] 23/29: Adjusted buffer increase default step size, gnunet, 2023/06/20