The mingw build was simply broken.
For example:
mman.c: In function 'mmap_lock':
mman.c:29:30: error: 'mapping' undeclared (first use in this function)
29 | #define BT_LOG_OUTPUT_LEVEL (mapping->log_level)
| ^~~~~~~
../../src/logging/log.h:165:31: note: in expansion of macro 'BT_LOG_OUTPUT_LEVEL'
165 | #define _BT_LOG_OUTPUT_LEVEL BT_LOG_OUTPUT_LEVEL
| ^~~~~~~~~~~~~~~~~~~
../../src/logging/log.h:671:38: note: in expansion of macro '_BT_LOG_OUTPUT_LEVEL'
671 | (BT_LOG_ENABLED((lvl)) && (lvl) >= _BT_LOG_OUTPUT_LEVEL)
| ^~~~~~~~~~~~~~~~~~~~
../../src/logging/log.h:835:9: note: in expansion of macro 'BT_LOG_ON'
835 | if (BT_LOG_ON(lvl)) \
| ^~~~~~~~~
../../src/logging/log.h:974:4: note: in expansion of macro 'BT_LOG_WRITE'
974 | BT_LOG_WRITE(BT_LOG_FATAL, _BT_LOG_TAG, __VA_ARGS__)
| ^~~~~~~~~~~~
../../src/logging/log.h:995:24: note: in expansion of macro 'BT_LOGF'
995 | #define BT_LOGF_STR(s) BT_LOGF("%s", (s))
| ^~~~~~~
mman.c:122:3: note: in expansion of macro 'BT_LOGF_STR'
122 | BT_LOGF_STR("Failed to acquire mmap_mutex.");
| ^~~~~~~~~~~
mman.c:29:30: note: each undeclared identifier is reported only once for each function it appears in
29 | #define BT_LOG_OUTPUT_LEVEL (mapping->log_level)
| ^~~~~~~
../../src/logging/log.h:165:31: note: in expansion of macro 'BT_LOG_OUTPUT_LEVEL'
165 | #define _BT_LOG_OUTPUT_LEVEL BT_LOG_OUTPUT_LEVEL
| ^~~~~~~~~~~~~~~~~~~
../../src/logging/log.h:671:38: note: in expansion of macro '_BT_LOG_OUTPUT_LEVEL'
671 | (BT_LOG_ENABLED((lvl)) && (lvl) >= _BT_LOG_OUTPUT_LEVEL)
| ^~~~~~~~~~~~~~~~~~~~
../../src/logging/log.h:835:9: note: in expansion of macro 'BT_LOG_ON'
835 | if (BT_LOG_ON(lvl)) \
| ^~~~~~~~~
../../src/logging/log.h:974:4: note: in expansion of macro 'BT_LOG_WRITE'
974 | BT_LOG_WRITE(BT_LOG_FATAL, _BT_LOG_TAG, __VA_ARGS__)
| ^~~~~~~~~~~~
../../src/logging/log.h:995:24: note: in expansion of macro 'BT_LOGF'
995 | #define BT_LOGF_STR(s) BT_LOGF("%s", (s))
| ^~~~~~~
mman.c:122:3: note: in expansion of macro 'BT_LOGF_STR'
122 | BT_LOGF_STR("Failed to acquire mmap_mutex.");
| ^~~~~~~~~~~
mman.c: In function 'mmap_unlock':
mman.c:29:30: error: 'mapping' undeclared (first use in this function)
29 | #define BT_LOG_OUTPUT_LEVEL (mapping->log_level)
| ^~~~~~~
../../src/logging/log.h:165:31: note: in expansion of macro 'BT_LOG_OUTPUT_LEVEL'
165 | #define _BT_LOG_OUTPUT_LEVEL BT_LOG_OUTPUT_LEVEL
| ^~~~~~~~~~~~~~~~~~~
../../src/logging/log.h:671:38: note: in expansion of macro '_BT_LOG_OUTPUT_LEVEL'
671 | (BT_LOG_ENABLED((lvl)) && (lvl) >= _BT_LOG_OUTPUT_LEVEL)
| ^~~~~~~~~~~~~~~~~~~~
../../src/logging/log.h:835:9: note: in expansion of macro 'BT_LOG_ON'
835 | if (BT_LOG_ON(lvl)) \
| ^~~~~~~~~
../../src/logging/log.h:974:4: note: in expansion of macro 'BT_LOG_WRITE'
974 | BT_LOG_WRITE(BT_LOG_FATAL, _BT_LOG_TAG, __VA_ARGS__)
| ^~~~~~~~~~~~
../../src/logging/log.h:995:24: note: in expansion of macro 'BT_LOGF'
995 | #define BT_LOGF_STR(s) BT_LOGF("%s", (s))
| ^~~~~~~
mman.c:131:3: note: in expansion of macro 'BT_LOGF_STR'
131 | BT_LOGF_STR("Failed to release mmap_mutex.");
| ^~~~~~~~~~~
mman.c: At top level:
mman.c:173:7: error: conflicting types for 'bt_mmap'
173 | void *bt_mmap(void *addr, size_t length, int prot, int flags, int fd,
| ^~~~~~~
In file included from mman.c:53:
../../src/compat/mman.h:48:7: note: previous declaration of 'bt_mmap' was here
48 | void *bt_mmap(void *addr, size_t length, int prot, int flags, int fd,
| ^~~~~~~
mman.c: In function 'bt_mmap':
mman.c:202:12: error: too many arguments to function 'mapping_create'
202 | mapping = mapping_create(log_level);
| ^~~~~~~~~~~~~~
mman.c:73:22: note: declared here
73 | struct mmap_mapping *mapping_create(void)
| ^~~~~~~~~~~~~~
make[2]: *** [Makefile:501: mman.lo] Error 1
Change-Id: I71b36504541382cadf09953d9e113adc6c3641b6
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1610
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
*/
mma->page_aligned_length = ALIGN(length + offset - page_aligned_offset, page_size);
mma->page_aligned_addr = bt_mmap(NULL, mma->page_aligned_length,
- prot, flags, fd, page_aligned_offset);
+ prot, flags, fd, page_aligned_offset, log_level);
if (mma->page_aligned_addr == MAP_FAILED) {
free(mma);
return MAP_FAILED;
static pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER;
static
-struct mmap_mapping *mapping_create(void)
+struct mmap_mapping *mapping_create(int log_level)
{
struct mmap_mapping *mapping;
if (mapping != NULL) {
mapping->file_handle = NULL;
mapping->map_handle = NULL;
+ mapping->log_level = log_level;
}
return mapping;
void mmap_lock(int log_level)
{
if (pthread_mutex_lock(&mmap_mutex)) {
- BT_LOGF_STR("Failed to acquire mmap_mutex.");
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_FATAL, log_level, BT_LOG_TAG, "Failed to acquire mmap_mutex.");
abort();
}
}
void mmap_unlock(int log_level)
{
if (pthread_mutex_unlock(&mmap_mutex)) {
- BT_LOGF_STR("Failed to release mmap_mutex.");
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_FATAL, log_level, BT_LOG_TAG, "Failed to release mmap_mutex.");
abort();
}
}
* mappings to exceed the file's size (even within a page).
*/
void *bt_mmap(void *addr, size_t length, int prot, int flags, int fd,
- off_t offset);
+ off_t offset, int log_level);
int bt_munmap(void *addr, size_t length);
static inline
void *bt_mmap(void *addr, size_t length, int prot, int flags, int fd,
- off_t offset)
+ off_t offset, int log_level)
{
return (void *) mmap(addr, length, prot, flags, fd, offset);
}
#define BT_SOCKET SOCKET
static inline
-int bt_socket_init(void)
+int bt_socket_init(int log_level)
{
WORD verreq;
WSADATA wsa;
ret = WSAStartup(verreq, &wsa);
if (ret != 0) {
-#ifdef BT_LOGE
- BT_LOGE("Winsock init failed with error: %d", ret);
+#ifdef BT_LOG_WRITE_CUR_LVL
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_ERROR, log_level, BT_LOG_TAG,
+ "Winsock init failed with error: %d", ret);
#endif
goto end;
}
if (LOBYTE(wsa.wVersion) != 2 || HIBYTE(wsa.wVersion) != 2) {
-#ifdef BT_LOGE_STR
- BT_LOGE_STR("Could not init winsock 2.2 support");
+#ifdef BT_LOG_WRITE_CUR_LVL
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_ERROR, log_level, BT_LOG_TAG,
+ "Could not init winsock 2.2 support");
#endif
WSACleanup();
ret = -1;
#define BT_SOCKET int
static inline
-int bt_socket_init(void)
+int bt_socket_init(int log_level)
{
return 0;
}
BT_ASSERT(ds_file->mmap_len);
ds_file->mmap_addr = bt_mmap((void *) 0, ds_file->mmap_len,
PROT_READ, MAP_PRIVATE, fileno(ds_file->file->fp),
- ds_file->mmap_offset);
+ ds_file->mmap_offset, 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",
ds_file->mmap_len, ds_file->file->path->str,
viewer_connection = g_new0(struct live_viewer_connection, 1);
- if (bt_socket_init() != 0) {
+ if (bt_socket_init(lttng_live_msg_iter->log_level) != 0) {
goto error;
}