/* * util_file_get_size -- returns size of a file */ ssize_t util_file_get_size(const char *path) { #ifndef _WIN32 if (util_file_is_device_dax(path)) { return device_dax_size(path); } #endif util_stat_t stbuf; if (util_stat(path, &stbuf) < 0) { ERR("!fstat %s", path); return -1; } return stbuf.st_size; }
/* * util_file_get_size -- returns size of a file */ ssize_t util_file_get_size(const char *path) { LOG(3, "path \"%s\"", path); int file_type = util_file_get_type(path); if (file_type < 0) return -1; #ifndef _WIN32 if (file_type == TYPE_DEVDAX) { return device_dax_size(path); } #endif os_stat_t stbuf; if (os_stat(path, &stbuf) < 0) { ERR("!stat \"%s\"", path); return -1; } LOG(4, "file length %zu", stbuf.st_size); return stbuf.st_size; }