From c606e6381a049f708a57d9c4e0220bbbc5121da6 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 4 Jul 2017 16:15:04 -0400 Subject: [PATCH] lib: use dedicated BT_LOG*_ERRNO() instead of using strerror() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- lib/ctf-ir/fields.c | 12 ++++++------ lib/ctf-ir/stream.c | 19 ++++++++----------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/ctf-ir/fields.c b/lib/ctf-ir/fields.c index 3ee3b950..9599b5bd 100644 --- a/lib/ctf-ir/fields.c +++ b/lib/ctf-ir/fields.c @@ -3036,8 +3036,8 @@ int increase_packet_size(struct bt_ctf_stream_pos *pos) pos->offset, pos->packet_size); ret = munmap_align(pos->base_mma); if (ret) { - BT_LOGE("Failed to perform an aligned memory unmapping: " - "ret=%d, errno=%d", ret, errno); + BT_LOGE_ERRNO("Failed to perform an aligned memory unmapping", + ": ret=%d", ret); goto end; } @@ -3047,8 +3047,8 @@ int increase_packet_size(struct bt_ctf_stream_pos *pos) pos->packet_size / CHAR_BIT); } while (ret == EINTR); if (ret) { - BT_LOGE("Failed to preallocate memory space: ret=%d, errno=%d", - ret, errno); + BT_LOGE_ERRNO("Failed to preallocate memory space", + ": ret=%d", ret); errno = EINTR; ret = -1; goto end; @@ -3057,8 +3057,8 @@ int increase_packet_size(struct bt_ctf_stream_pos *pos) pos->base_mma = mmap_align(pos->packet_size / CHAR_BIT, pos->prot, pos->flags, pos->fd, pos->mmap_offset); if (pos->base_mma == MAP_FAILED) { - BT_LOGE("Failed to perform an aligned memory mapping: " - "ret=%d, errno=%d", ret, errno); + BT_LOGE_ERRNO("Failed to perform an aligned memory mapping", + ": ret=%d", ret); ret = -1; } diff --git a/lib/ctf-ir/stream.c b/lib/ctf-ir/stream.c index 1c3d534f..f13c024a 100644 --- a/lib/ctf-ir/stream.c +++ b/lib/ctf-ir/stream.c @@ -731,10 +731,9 @@ append_ids: S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); g_free(file_path); if (fd < 0) { - BT_LOGW("Failed to open stream file for writing: %s: " - "filename=\"%s\", " - "ret=%d, errno=%d", strerror(errno), - filename->str, fd, errno); + BT_LOGW_ERRNO("Failed to open stream file for writing", + ": file_path=\"%s\", filename=\"%s\", ret=%d", + file_path, filename->str, fd); goto end; } @@ -1795,16 +1794,14 @@ void bt_ctf_stream_destroy(struct bt_object *obj) ret = ftruncate(stream->pos.fd, stream->size); } while (ret == -1 && errno == EINTR); if (ret) { - BT_LOGE("Failed to truncate stream file: %s: " - "ret=%d, errno=%d, size=%" PRIu64, - strerror(errno), ret, errno, - (uint64_t) stream->size); + BT_LOGE_ERRNO("Failed to truncate stream file", + ": ret=%d, size=%" PRIu64, + ret, (uint64_t) stream->size); } if (close(stream->pos.fd)) { - BT_LOGE("Failed to close stream file: %s: " - "ret=%d, errno=%d", strerror(errno), - ret, errno); + BT_LOGE_ERRNO("Failed to close stream file", + ": ret=%d", ret); } } -- 2.34.1