From 5fbc00a3cc2fe2f08008ad10383cf356b963c23d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C5=93ur?= Date: Thu, 23 May 2024 14:53:13 +0200 Subject: [PATCH] event_warn mmap format --- buffer.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/buffer.c b/buffer.c index e1cf6295..319b9faf 100644 --- a/buffer.c +++ b/buffer.c @@ -3077,6 +3077,14 @@ evbuffer_file_segment_materialize(struct evbuffer_file_segment *seg) #if defined(EVENT__HAVE_MMAP) if (!(flags & EVBUF_FS_DISABLE_MMAP)) { off_t offset_rounded = 0, offset_leftover = 0; + int mmap_flags = +#ifdef MAP_NOCACHE + MAP_NOCACHE | /* ??? */ +#endif +#ifdef MAP_FILE + MAP_FILE | +#endif + MAP_PRIVATE; void *mapped; if (offset) { /* mmap implementations don't generally like us @@ -3092,18 +3100,11 @@ evbuffer_file_segment_materialize(struct evbuffer_file_segment *seg) #else mapped = mmap(NULL, length + offset_leftover, #endif - PROT_READ, -#ifdef MAP_NOCACHE - MAP_NOCACHE | /* ??? */ -#endif -#ifdef MAP_FILE - MAP_FILE | -#endif - MAP_PRIVATE, - fd, offset_rounded); + PROT_READ, mmap_flags, fd, offset_rounded); if (mapped == MAP_FAILED) { - event_warn("%s: mmap(%d, %d, %zu) failed", - __func__, fd, 0, (size_t)(offset + length)); + event_warn("%s: mmap(NULL, %zu, %d, %d, %d, %lld) failed", __func__, + (size_t)(length + offset_leftover), PROT_READ, mmap_flags, fd, + (long long)offset_rounded); } else { seg->mapping = mapped; seg->contents = (char*)mapped+offset_leftover;