From 31cc85a3b6a4d146ebc483a1a38e46236aab4cca Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 2 Nov 2023 19:26:00 +0000 Subject: [PATCH] compat: remove unused `addr` parameter from bt_mmap Change-Id: Iecf7764f5fd669369064aa3b3fafe2575d933f28 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/11204 Reviewed-by: Philippe Proulx --- src/common/mmap-align.h | 2 +- src/compat/mman.c | 4 ++-- src/compat/mman.h | 6 +++--- src/plugins/ctf/fs-src/data-stream-file.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/common/mmap-align.h b/src/common/mmap-align.h index 7c164935..4d81b257 100644 --- a/src/common/mmap-align.h +++ b/src/common/mmap-align.h @@ -58,7 +58,7 @@ struct mmap_align_data *mmap_align(size_t length, int prot, * boundary. */ mma->page_aligned_length = BT_ALIGN(length + offset - page_aligned_offset, page_size); - mma->page_aligned_addr = bt_mmap(NULL, mma->page_aligned_length, + mma->page_aligned_addr = bt_mmap(mma->page_aligned_length, prot, flags, fd, page_aligned_offset, log_level); if (mma->page_aligned_addr == MAP_FAILED) { free(mma); diff --git a/src/compat/mman.c b/src/compat/mman.c index 1cc1c44c..79ff7599 100644 --- a/src/compat/mman.c +++ b/src/compat/mman.c @@ -152,8 +152,8 @@ DWORD map_prot_flags(int prot, DWORD *dwDesiredAccess) return 0; } -void *bt_mmap(void *addr __attribute__((unused)), size_t length, int prot, - int flags, int fd, off_t offset, int log_level) +void *bt_mmap(size_t length, int prot, int flags, int fd, off_t offset, + int log_level) { struct mmap_mapping *mapping = NULL; void *mapping_addr; diff --git a/src/compat/mman.h b/src/compat/mman.h index 5aaab760..33febccb 100644 --- a/src/compat/mman.h +++ b/src/compat/mman.h @@ -30,7 +30,7 @@ * Note that some platforms (e.g. Windows) do not allow read-only * mappings to exceed the file's size (even within a page). */ -BT_EXTERN_C void *bt_mmap(void *addr, size_t length, int prot, int flags, int fd, +BT_EXTERN_C void *bt_mmap(size_t length, int prot, int flags, int fd, off_t offset, int log_level); BT_EXTERN_C int bt_munmap(void *addr, size_t length); @@ -47,10 +47,10 @@ BT_EXTERN_C size_t bt_mmap_get_offset_align_size(int log_level); #include "common/common.h" static inline -void *bt_mmap(void *addr, size_t length, int prot, int flags, int fd, +void *bt_mmap(size_t length, int prot, int flags, int fd, off_t offset, int log_level __attribute__((unused))) { - return (void *) mmap(addr, length, prot, flags, fd, offset); + return (void *) mmap(NULL, length, prot, flags, fd, offset); } static inline diff --git a/src/plugins/ctf/fs-src/data-stream-file.cpp b/src/plugins/ctf/fs-src/data-stream-file.cpp index 1a49d878..482383b1 100644 --- a/src/plugins/ctf/fs-src/data-stream-file.cpp +++ b/src/plugins/ctf/fs-src/data-stream-file.cpp @@ -125,7 +125,7 @@ static enum ctf_msg_iter_medium_status ds_file_mmap(struct ctf_fs_ds_file *ds_fi BT_ASSERT(ds_file->mmap_len > 0); ds_file->mmap_addr = - bt_mmap((void *) 0, ds_file->mmap_len, PROT_READ, MAP_PRIVATE, fileno(ds_file->file->fp), + bt_mmap(ds_file->mmap_len, PROT_READ, MAP_PRIVATE, fileno(ds_file->file->fp), ds_file->mmap_offset_in_file, ds_file->log_level); if (ds_file->mmap_addr == MAP_FAILED) { BT_COMP_LOGE("Cannot memory-map address (size %zu) of file \"%s\" (%p) at offset %jd: %s", -- 2.34.1