diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2020-10-15 17:04:02 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2020-10-15 17:04:02 +0300 |
commit | 1777068bd81603228f0c7e3e20005769aeba838e (patch) | |
tree | 9551e83eb1576aaed18ae5818c9326d0eb81f695 | |
parent | 16d9f9e426a8ea1f5c05a21554824b7981c0df3b (diff) | |
download | libmicrohttpd-1777068bd81603228f0c7e3e20005769aeba838e.tar.gz libmicrohttpd-1777068bd81603228f0c7e3e20005769aeba838e.zip |
mhd_send: round up readahead size on FreeBSD
-rw-r--r-- | src/microhttpd/mhd_send.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c index 987a694b..50fa5483 100644 --- a/src/microhttpd/mhd_send.c +++ b/src/microhttpd/mhd_send.c | |||
@@ -84,7 +84,7 @@ MHD_send_init_static_vars_ (void) | |||
84 | * SF_FLAGS defined only on FreeBSD 11 and later. */ | 84 | * SF_FLAGS defined only on FreeBSD 11 and later. */ |
85 | #ifdef SF_FLAGS | 85 | #ifdef SF_FLAGS |
86 | long sys_page_size = sysconf (_SC_PAGESIZE); | 86 | long sys_page_size = sysconf (_SC_PAGESIZE); |
87 | if (0 > sys_page_size) | 87 | if (0 >= sys_page_size) |
88 | { /* Failed to get page size. */ | 88 | { /* Failed to get page size. */ |
89 | freebsd_sendfile_flags_ = SF_NODISKIO; | 89 | freebsd_sendfile_flags_ = SF_NODISKIO; |
90 | freebsd_sendfile_flags_thd_p_c_ = SF_NODISKIO; | 90 | freebsd_sendfile_flags_thd_p_c_ = SF_NODISKIO; |
@@ -92,10 +92,11 @@ MHD_send_init_static_vars_ (void) | |||
92 | else | 92 | else |
93 | { | 93 | { |
94 | freebsd_sendfile_flags_ = | 94 | freebsd_sendfile_flags_ = |
95 | SF_FLAGS ((uint16_t) (MHD_SENFILE_CHUNK_ / sys_page_size), SF_NODISKIO); | 95 | SF_FLAGS ((uint16_t) ((MHD_SENFILE_CHUNK_ + sys_page_size - 1) |
96 | / sys_page_size), SF_NODISKIO); | ||
96 | freebsd_sendfile_flags_thd_p_c_ = | 97 | freebsd_sendfile_flags_thd_p_c_ = |
97 | SF_FLAGS ((uint16_t) (MHD_SENFILE_CHUNK_THR_P_C_ / sys_page_size), | 98 | SF_FLAGS ((uint16_t) ((MHD_SENFILE_CHUNK_THR_P_C_ + sys_page_size - 1) |
98 | SF_NODISKIO); | 99 | / sys_page_size), SF_NODISKIO); |
99 | } | 100 | } |
100 | #endif /* SF_FLAGS */ | 101 | #endif /* SF_FLAGS */ |
101 | } | 102 | } |