e3f7d7783c1c872ff5b52b30c40df97ad9a85c43
2 * SPDX-License-Identifier: MIT
4 * Copyright 2016 Philippe Proulx <pproulx@efficios.com>
11 #include "cpp-common/vendor/fmt/format.h"
15 void ctf_fs_file_destroy(struct ctf_fs_file
*file
)
24 void ctf_fs_file_deleter::operator()(ctf_fs_file
* const file
) noexcept
26 ctf_fs_file_destroy(file
);
29 ctf_fs_file::UP
ctf_fs_file_create(const bt2c::Logger
& parentLogger
)
31 return ctf_fs_file::UP
{new ctf_fs_file
{parentLogger
}};
34 int ctf_fs_file_open(struct ctf_fs_file
*file
, const char *mode
)
39 BT_CPPLOGI_SPEC(file
->logger
, "Opening file \"{}\" with mode \"{}\"", file
->path
, mode
);
40 file
->fp
.reset(fopen(file
->path
.c_str(), mode
));
42 BT_CPPLOGE_ERRNO_APPEND_CAUSE_SPEC(file
->logger
, "Cannot open file", ": path={}, mode={}",
47 BT_CPPLOGI_SPEC(file
->logger
, "Opened file: {}", fmt::ptr(file
->fp
));
49 if (fstat(fileno(file
->fp
.get()), &stat
)) {
50 BT_CPPLOGE_ERRNO_APPEND_CAUSE_SPEC(file
->logger
, "Cannot get file information", ": path={}",
55 file
->size
= stat
.st_size
;
56 BT_CPPLOGI_SPEC(file
->logger
, "File is {} bytes", (intmax_t) file
->size
);
This page took 0.030316 seconds and 3 git commands to generate.