if (bt_common_is_setuid_setgid()) {
BT_LOGI_STR("Skipping non-system plugin paths for setuid/setgid binary.");
} else {
- char *home_plugin_dir =
- bt_common_get_home_plugin_path();
+ char *home_plugin_dir = bt_common_get_home_plugin_path(
+ BT_LOG_OUTPUT_LEVEL);
if (home_plugin_dir) {
ret = bt_config_append_plugin_paths(
* modules.
*/
static const char* log_level_env_var_names[] = {
- "BABELTRACE_COMMON_LOG_LEVEL",
- "BABELTRACE_COMPAT_LOG_LEVEL",
- "BABELTRACE_CTFSER_LOG_LEVEL",
- "BABELTRACE_FD_CACHE_LOG_LEVEL",
"BABELTRACE_FLT_LTTNG_UTILS_DEBUG_INFO_LOG_LEVEL",
"BABELTRACE_FLT_UTILS_COUNTER_LOG_LEVEL",
"BABELTRACE_FLT_UTILS_MUXER_LOG_LEVEL",
assert.h \
assert.c \
common.c \
- common.h \
- logging.c \
- logging.h
+ common.h
noinst_HEADERS = \
align.h \
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL log_level
#define BT_LOG_TAG "COMMON"
-#include "logging.h"
+#include "logging/log.h"
#include <unistd.h>
#include <string.h>
#endif /* __MINGW32__ */
static
-char *bt_secure_getenv(const char *name)
+char *bt_secure_getenv(const char *name, int log_level)
{
if (bt_common_is_setuid_setgid()) {
BT_LOGD("Disregarding environment variable for setuid/setgid binary: "
#ifdef __MINGW32__
static
-const char *bt_get_home_dir(void)
+const char *bt_get_home_dir(int log_level)
{
return g_get_home_dir();
}
#else /* __MINGW32__ */
static
-const char *bt_get_home_dir(void)
+const char *bt_get_home_dir(int log_level)
{
char *val = NULL;
struct passwd *pwd;
- val = bt_secure_getenv(HOME_ENV_VAR);
+ val = bt_secure_getenv(HOME_ENV_VAR, log_level);
if (val) {
goto end;
}
#endif /* __MINGW32__ */
BT_HIDDEN
-char *bt_common_get_home_plugin_path(void)
+char *bt_common_get_home_plugin_path(int log_level)
{
char *path = NULL;
const char *home_dir;
size_t length;
- home_dir = bt_get_home_dir();
+ home_dir = bt_get_home_dir(log_level);
if (!home_dir) {
goto end;
}
#endif
BT_HIDDEN
-size_t bt_common_get_page_size(void)
+size_t bt_common_get_page_size(int log_level)
{
int page_size;
* return value.
*/
BT_HIDDEN
-char *bt_common_get_home_plugin_path(void);
+char *bt_common_get_home_plugin_path(int log_level);
/*
* Appends the list of directories in `paths` to the array `dirs`.
* Returns the system page size.
*/
BT_HIDDEN
-size_t bt_common_get_page_size(void);
+size_t bt_common_get_page_size(int log_level);
/*
* Adds the digit separator `sep` as many times as needed to form groups
* value smaller than the requested `count`.
*/
static inline
-ssize_t bt_common_read(int fd, void *buf, size_t count)
+ssize_t bt_common_read(int fd, void *buf, size_t count, int log_level)
{
size_t i = 0;
ssize_t ret;
ret = read(fd, buf + i, count - i);
if (ret < 0) {
if (errno == EINTR) {
-#ifdef BT_LOGD_STR
- BT_LOGD_STR("read() call interrupted; retrying...");
+#ifdef BT_LOG_WRITE_CUR_LVL
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_DEBUG, log_level,
+ BT_LOG_TAG,
+ "read() call interrupted; retrying...");
#endif
/* retry operation */
continue;
} else {
-#ifdef BT_LOGE_ERRNO
- BT_LOGE_ERRNO("Error while reading", ": fd=%d",
- fd);
+#ifdef BT_LOG_WRITE_ERRNO_CUR_LVL
+ BT_LOG_WRITE_ERRNO_CUR_LVL(BT_LOG_ERROR,
+ log_level, BT_LOG_TAG,
+ "Error while reading", ": fd=%d", fd);
#endif
goto end;
}
+++ /dev/null
-/*
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_OUTPUT_LEVEL bt_common_log_level
-#include "logging/log.h"
-
-BT_LOG_INIT_LOG_LEVEL(bt_common_log_level, "BABELTRACE_COMMON_LOG_LEVEL");
+++ /dev/null
-#ifndef COMMON_LOGGING_H
-#define COMMON_LOGGING_H
-
-/*
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_OUTPUT_LEVEL bt_common_log_level
-#include "logging/log.h"
-
-BT_LOG_LEVEL_EXTERN_SYMBOL(bt_common_log_level);
-
-#endif /* COMMON_LOGGING_H */
static inline
struct mmap_align *mmap_align(size_t length, int prot,
- int flags, int fd, off_t offset)
+ int flags, int fd, off_t offset, int log_level)
{
struct mmap_align *mma;
off_t page_aligned_offset; /* mmap offset, aligned to floor */
size_t page_size;
- page_size = bt_common_get_page_size();
+ page_size = bt_common_get_page_size(log_level);
mma = malloc(sizeof(*mma));
if (!mma)
noinst_LTLIBRARIES = libcompat.la
libcompat_la_SOURCES = \
- logging.c \
- logging.h \
mman.c \
mman.h \
uuid.c \
+++ /dev/null
-/*
- * Copyright (c) 2017 Michael Jeanson <mjeanson@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_OUTPUT_LEVEL bt_compat_log_level
-#include "logging/log.h"
-
-BT_LOG_INIT_LOG_LEVEL(bt_compat_log_level, "BABELTRACE_COMPAT_LOG_LEVEL");
+++ /dev/null
-#ifndef COMPAT_LOGGING_H
-#define COMPAT_LOGGING_H
-
-/*
- * Copyright (c) 2017 Michael Jeanson <mjeanson@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_OUTPUT_LEVEL bt_compat_log_level
-#include "logging/log.h"
-
-BT_LOG_LEVEL_EXTERN_SYMBOL(bt_compat_log_level);
-
-#endif /* COMPAT_LOGGING_H */
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL (mapping->log_level)
#define BT_LOG_TAG "COMPAT/MMAN"
-#include "logging.h"
+#include "logging/log.h"
#include "common/macros.h"
#include "compat/mman.h"
struct mmap_mapping {
+ int log_level;
+
/* The duplicated handle. */
HANDLE file_handle;
/* Handle returned by CreateFileMapping. */
{
/* Cleanup of handles should never fail. */
if (!UnmapViewOfFile(addr)) {
- BT_LOGF_STR("Failed to unmap mmap mapping.");
+ /*
+ * FIXME: We don't have access to the mapping's log
+ * level here, so force a FATAL level.
+ */
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_FATAL, BT_LOG_FATAL, BT_LOG_TAG,
+ "Failed to unmap mmap mapping.");
abort();
}
}
static
-void mmap_lock(void)
+void mmap_lock(int log_level)
{
if (pthread_mutex_lock(&mmap_mutex)) {
BT_LOGF_STR("Failed to acquire mmap_mutex.");
}
static
-void mmap_unlock(void)
+void mmap_unlock(int log_level)
{
if (pthread_mutex_unlock(&mmap_mutex)) {
BT_LOGF_STR("Failed to release mmap_mutex.");
BT_HIDDEN
void *bt_mmap(void *addr, size_t length, int prot, int flags, int fd,
- off_t offset)
+ off_t offset, int log_level)
{
struct mmap_mapping *mapping = NULL;
void *mapping_addr;
}
/* Allocate the mapping struct. */
- mapping = mapping_create();
+ mapping = mapping_create(log_level);
if (!mapping) {
- BT_LOGE_STR("Failed to allocate mmap mapping.");
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_ERROR, log_level, BT_LOG_TAG,
+ "Failed to allocate mmap mapping.");
_set_errno(ENOMEM);
goto error;
}
goto error;
}
- mmap_lock();
+ mmap_lock(log_level);
/* If we have never done any mappings, allocate the hashtable. */
if (!mmap_mappings) {
/* Add the new mapping to the hashtable. */
g_hash_table_insert(mmap_mappings, mapping_addr, mapping);
- mmap_unlock();
+ mmap_unlock(log_level);
return mapping_addr;
error_mutex_unlock:
- mmap_unlock();
+ mmap_unlock(log_level);
error:
mapping_clean(mapping);
return MAP_FAILED;
int bt_munmap(void *addr, size_t length)
{
int ret = 0;
+ struct mmap_mapping *mapping = addr;
+ int log_level;
- mmap_lock();
+ BT_ASSERT(mapping);
+ log_level = mapping->log_level;
+ mmap_lock(log_level);
/* Check if the mapping exists in the hashtable. */
if (g_hash_table_lookup(mmap_mappings, addr) == NULL) {
}
end:
- mmap_unlock();
+ mmap_unlock(log_level);
return ret;
}
* SOFTWARE.
*/
-#define BT_LOG_TAG "COMPAT/UUID"
-#include "logging.h"
-
#ifdef __APPLE__
/*
* On macOS, we need a dummy symbol so that the linker won't
goto end;
}
- ret = bt_ctfser_init(&stream->ctfser, file_path);
+ ret = bt_ctfser_init(&stream->ctfser, file_path,
+ BT_LOG_OUTPUT_LEVEL);
g_free(file_path);
if (ret) {
/* bt_ctfser_init() logs errors */
libbabeltrace2_ctfser_la_SOURCES = \
ctfser.c \
- ctfser.h \
- logging.c \
- logging.h
+ ctfser.h
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL (ctfser->log_level)
#define BT_LOG_TAG "CTFSER"
-#include "logging.h"
+#include "logging/log.h"
#include <unistd.h>
#include <string.h>
#include "compat/fcntl.h"
static inline
-uint64_t get_packet_size_increment_bytes(void)
+uint64_t get_packet_size_increment_bytes(struct bt_ctfser *ctfser)
{
- return bt_common_get_page_size() * 8;
+ return bt_common_get_page_size(ctfser->log_level) * 8;
}
static inline
{
ctfser->base_mma = mmap_align(ctfser->cur_packet_size_bytes,
PROT_READ | PROT_WRITE,
- MAP_SHARED, ctfser->fd, ctfser->mmap_offset);
+ MAP_SHARED, ctfser->fd, ctfser->mmap_offset, ctfser->log_level);
}
BT_HIDDEN
goto end;
}
- ctfser->cur_packet_size_bytes += get_packet_size_increment_bytes();
+ ctfser->cur_packet_size_bytes += get_packet_size_increment_bytes(
+ ctfser);
do {
ret = bt_posix_fallocate(ctfser->fd, ctfser->mmap_offset,
}
BT_HIDDEN
-int bt_ctfser_init(struct bt_ctfser *ctfser, const char *path)
+int bt_ctfser_init(struct bt_ctfser *ctfser, const char *path, int log_level)
{
int ret = 0;
memset(ctfser, 0, sizeof(*ctfser));
ctfser->fd = open(path, O_RDWR | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+ ctfser->log_level = log_level;
if (ctfser->fd < 0) {
BT_LOGW_ERRNO("Failed to open stream file for writing",
": path=\"%s\", ret=%d",
ctfser->prev_packet_size_bytes = 0;
/* Make initial space for the current packet */
- ctfser->cur_packet_size_bytes = get_packet_size_increment_bytes();
+ ctfser->cur_packet_size_bytes = get_packet_size_increment_bytes(
+ ctfser);
do {
ret = bt_posix_fallocate(ctfser->fd, ctfser->mmap_offset,
/* Stream file's path (for debugging) */
GString *path;
+
+ /* Serializer's log level */
+ int log_level;
};
/*
* This function opens the file `path` for writing.
*/
BT_HIDDEN
-int bt_ctfser_init(struct bt_ctfser *ctfser, const char *path);
+int bt_ctfser_init(struct bt_ctfser *ctfser, const char *path,
+ int log_level);
/*
* Finalizes a CTF serializer.
+++ /dev/null
-/*
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_OUTPUT_LEVEL bt_ctfser_log_level
-#include "logging/log.h"
-
-BT_LOG_INIT_LOG_LEVEL(bt_ctfser_log_level, "BABELTRACE_CTFSER_LOG_LEVEL");
+++ /dev/null
-#ifndef COMMON_LOGGING_H
-#define COMMON_LOGGING_H
-
-/*
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_OUTPUT_LEVEL bt_ctfser_log_level
-#include "logging/log.h"
-
-BT_LOG_LEVEL_EXTERN_SYMBOL(bt_ctfser_log_level);
-
-#endif /* COMMON_LOGGING_H */
libbabeltrace2_fd_cache_la_SOURCES = \
fd-cache.c \
- fd-cache.h \
- logging.c \
- logging.h
+ fd-cache.h
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL (fdc->log_level)
#define BT_LOG_TAG "FD-CACHE"
-#include "logging.h"
+#include "logging/log.h"
#include <fcntl.h>
#include <sys/stat.h>
}
BT_HIDDEN
-int bt_fd_cache_init(struct bt_fd_cache *fdc)
+int bt_fd_cache_init(struct bt_fd_cache *fdc, int log_level)
{
int ret = 0;
+ fdc->log_level = log_level;
fdc->cache = g_hash_table_new_full(file_key_hash, file_key_equal,
file_key_destroy, (GDestroyNotify) fd_cache_handle_internal_destroy);
if (!fdc->cache) {
};
struct bt_fd_cache {
+ int log_level;
GHashTable *cache;
};
}
BT_HIDDEN
-int bt_fd_cache_init(struct bt_fd_cache *fdc);
+int bt_fd_cache_init(struct bt_fd_cache *fdc, int log_level);
BT_HIDDEN
void bt_fd_cache_fini(struct bt_fd_cache *fdc);
+++ /dev/null
-/*
- * Copyright (c) 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_OUTPUT_LEVEL bt_fd_cache_log_level
-#include "logging/log.h"
-
-BT_LOG_INIT_LOG_LEVEL(bt_fd_cache_log_level, "BABELTRACE_FD_CACHE_LOG_LEVEL");
+++ /dev/null
-#ifndef FD_CACHE_LOGGING_H
-#define FD_CACHE_LOGGING_H
-
-/*
- * Copyright (c) 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_OUTPUT_LEVEL bt_fd_cache_log_level
-#include "logging/log.h"
-
-BT_LOG_LEVEL_EXTERN_SYMBOL(bt_fd_cache_log_level);
-
-#endif /* FD_CACHE_LOGGING_H */
}
}
- home_plugin_dir = bt_common_get_home_plugin_path();
+ home_plugin_dir = bt_common_get_home_plugin_path(BT_LOG_OUTPUT_LEVEL);
if (home_plugin_dir) {
GString *home_plugin_dir_str =
g_string_new(home_plugin_dir);
set_stream_file_name(stream);
g_string_append_printf(path, "/%s", stream->file_name->str);
- ret = bt_ctfser_init(&stream->ctfser, path->str);
+ ret = bt_ctfser_init(&stream->ctfser, path->str, BT_LOG_OUTPUT_LEVEL);
if (ret) {
goto error;
}
if (ds_file->mmap_addr && (offset < ds_file->mmap_offset ||
offset >= ds_file->mmap_offset + ds_file->mmap_len)) {
int unmap_ret;
- off_t offset_in_mapping = offset % bt_common_get_page_size();
+ off_t offset_in_mapping = offset %
+ bt_common_get_page_size(BT_LOG_OUTPUT_LEVEL);
BT_LOGD("Medium seek request cannot be accomodated by the current "
"file mapping: offset=%jd, mmap-offset=%jd, "
bt_stream *stream, const char *path)
{
int ret;
- const size_t page_size = bt_common_get_page_size();
+ const size_t page_size = bt_common_get_page_size(BT_LOG_OUTPUT_LEVEL);
struct ctf_fs_ds_file *ds_file = g_new0(struct ctf_fs_ds_file, 1);
if (!ds_file) {
msg_iter_data->pc_msg_iter = self_msg_iter;
msg_iter_data->msg_iter = bt_msg_iter_create(
port_data->ds_file_group->ctf_fs_trace->metadata->tc,
- bt_common_get_page_size() * 8,
+ bt_common_get_page_size(BT_LOG_OUTPUT_LEVEL) * 8,
ctf_fs_ds_file_medops, NULL);
if (!msg_iter_data->msg_iter) {
BT_LOGE_STR("Cannot create a CTF message iterator.");
struct bt_msg_iter_packet_properties props;
msg_iter = bt_msg_iter_create(ctf_fs_trace->metadata->tc,
- bt_common_get_page_size() * 8, ctf_fs_ds_file_medops, NULL);
+ bt_common_get_page_size(BT_LOG_OUTPUT_LEVEL) * 8,
+ ctf_fs_ds_file_medops, NULL);
if (!msg_iter) {
BT_LOGE_STR("Cannot create a CTF message iterator.");
goto error;
goto error;
}
- ret = bt_fd_cache_init(&debug_info_msg_iter->fd_cache);
+ ret = bt_fd_cache_init(&debug_info_msg_iter->fd_cache,
+ BT_LOG_OUTPUT_LEVEL);
if (ret) {
status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
goto error;
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#define BT_LOG_OUTPUT_LEVEL BT_LOG_WARN
+#define BT_LOG_TAG "TEST/BIN-INFO"
+#include "logging/log.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
exit(EXIT_FAILURE);
}
- ret = bt_fd_cache_init(&fdc);
+ ret = bt_fd_cache_init(&fdc, BT_LOG_OUTPUT_LEVEL);
if (ret != 0) {
diag("Failed to initialize FD cache");
exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
- ret = bt_fd_cache_init(&fdc);
+ ret = bt_fd_cache_init(&fdc, BT_LOG_OUTPUT_LEVEL);
if (ret != 0) {
diag("Failed to initialize FD cache");
exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
- ret = bt_fd_cache_init(&fdc);
+ ret = bt_fd_cache_init(&fdc, BT_LOG_OUTPUT_LEVEL);
if (ret != 0) {
diag("Failed to initialize FD cache");
exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
- ret = bt_fd_cache_init(&fdc);
+ ret = bt_fd_cache_init(&fdc, BT_LOG_OUTPUT_LEVEL);
if (ret != 0) {
diag("Failed to initialize FD cache");
exit(EXIT_FAILURE);