2 * SPDX-License-Identifier: MIT
4 * Copyright 2016 Philippe Proulx <pproulx@efficios.com>
7 #define BT_CLOG_CFG (logCfg)
8 #define BT_LOG_TAG "PLUGIN/SRC.CTF.FS/FILE"
11 #include <sys/types.h>
16 #include "cpp-common/cfg-logging.hpp"
17 #include "cpp-common/cfg-logging-error-reporting.hpp"
20 int ctf_fs_file_open(struct ctf_fs_file
*file
, const char *mode
)
24 const bt2_common::LogCfg
& logCfg
= file
->logCfg
;
26 BT_CLOGI("Opening file \"%s\" with mode \"%s\"", file
->path
.c_str(), mode
);
27 file
->fp
.reset(fopen(file
->path
.c_str(), mode
));
29 BT_CLOGE_ERRNO_APPEND_CAUSE("Cannot open file", ": path=%s, mode=%s", file
->path
.c_str(),
34 BT_CLOGI("Opened file: %p", file
->fp
.get());
36 if (fstat(fileno(file
->fp
.get()), &stat
)) {
37 BT_CLOGE_ERRNO_APPEND_CAUSE("Cannot get file information", ": path=%s", file
->path
.c_str());
41 file
->size
= stat
.st_size
;
42 BT_CLOGI("File is %jd bytes", (intmax_t) file
->size
);
This page took 0.030794 seconds and 5 git commands to generate.