2 * SPDX-License-Identifier: MIT
4 * Copyright 2016 Philippe Proulx <pproulx@efficios.com>
11 #include "cpp-common/vendor/fmt/format.h"
15 int ctf_fs_file_open(struct ctf_fs_file
*file
, const char *mode
)
20 BT_CPPLOGI_SPEC(file
->logger
, "Opening file \"{}\" with mode \"{}\"", file
->path
, mode
);
21 file
->fp
.reset(fopen(file
->path
.c_str(), mode
));
23 BT_CPPLOGE_ERRNO_APPEND_CAUSE_SPEC(file
->logger
, "Cannot open file", ": path={}, mode={}",
28 BT_CPPLOGI_SPEC(file
->logger
, "Opened file: {}", fmt::ptr(file
->fp
));
30 if (fstat(fileno(file
->fp
.get()), &stat
)) {
31 BT_CPPLOGE_ERRNO_APPEND_CAUSE_SPEC(file
->logger
, "Cannot get file information", ": path={}",
36 file
->size
= stat
.st_size
;
37 BT_CPPLOGI_SPEC(file
->logger
, "File is {} bytes", (intmax_t) file
->size
);
This page took 0.030035 seconds and 4 git commands to generate.