From ff4c3c3fb88dd3a5c210af481d4a60ccd6e37140 Mon Sep 17 00:00:00 2001 From: Jiuzhu Dong Date: Mon, 15 Mar 2021 16:46:10 +0800 Subject: [PATCH] thttpd: add THTTPD_NFILE_DESCRIPTORS limits instead of NFILE_DESCRIPTORS Signed-off-by: Jiuzhu Dong --- netutils/thttpd/Kconfig | 6 ++++++ netutils/thttpd/thttpd.c | 6 +++--- netutils/thttpd/thttpd_cgi.c | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/netutils/thttpd/Kconfig b/netutils/thttpd/Kconfig index 8d7b40ecf..b6a72e4c3 100644 --- a/netutils/thttpd/Kconfig +++ b/netutils/thttpd/Kconfig @@ -12,6 +12,12 @@ config NETUTILS_THTTPD if NETUTILS_THTTPD +config THTTPD_NFILE_DESCRIPTORS + int "the maximum number of file descriptors for thttpd webserver" + default 16 + ---help--- + The maximum number of file descriptors for thttpd webserver + config THTTPD_PORT int "THTTPD port number" default 80 diff --git a/netutils/thttpd/thttpd.c b/netutils/thttpd/thttpd.c index 0dd3d20f8..bc07f0ca0 100644 --- a/netutils/thttpd/thttpd.c +++ b/netutils/thttpd/thttpd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * netutils/thttpd/thttpd.c + * apps/netutils/thttpd/thttpd.c * Tiny HTTP Server * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. @@ -85,7 +85,7 @@ #define CNST_LINGERING 3 #define SPARE_FDS 2 -#define AVAILABLE_FDS (CONFIG_NFILE_DESCRIPTORS - SPARE_FDS) +#define AVAILABLE_FDS (CONFIG_THTTPD_NFILE_DESCRIPTORS - SPARE_FDS) /**************************************************************************** * Private Types @@ -696,7 +696,7 @@ int thttpd_main(int argc, char **argv) * socket descriptors */ - fw = fdwatch_initialize(CONFIG_NFILE_DESCRIPTORS); + fw = fdwatch_initialize(CONFIG_THTTPD_NFILE_DESCRIPTORS); if (!fw) { nerr("ERROR: fdwatch initialization failure\n"); diff --git a/netutils/thttpd/thttpd_cgi.c b/netutils/thttpd/thttpd_cgi.c index abba663ae..816c014b7 100644 --- a/netutils/thttpd/thttpd_cgi.c +++ b/netutils/thttpd/thttpd_cgi.c @@ -1,5 +1,5 @@ /**************************************************************************** - * netutils/thttpd/thttpd_cgi.c + * apps/netutils/thttpd/thttpd_cgi.c * CGI support * * Copyright (C) 2009, 2011, 2016 Gregory Nutt. All rights reserved. @@ -771,7 +771,7 @@ static int cgi_child(int argc, char **argv) */ ninfo("Closing descriptors\n"); - for (fd = 3; fd < CONFIG_NFILE_DESCRIPTORS; fd++) + for (fd = 3; fd < CONFIG_THTTPD_NFILE_DESCRIPTORS; fd++) { /* Keep hc->conn_fd open for obvious reasons */