| 40 | }; |
| 41 | |
| 42 | InputStreamPtr |
| 43 | OpenFileInputStream(Path path, Mutex &mutex) |
| 44 | { |
| 45 | FileReader reader(path); |
| 46 | |
| 47 | const FileInfo info = reader.GetFileInfo(); |
| 48 | |
| 49 | if (!info.IsRegular()) |
| 50 | throw FmtRuntimeError("Not a regular file: {}", path); |
| 51 | |
| 52 | #ifdef POSIX_FADV_SEQUENTIAL |
| 53 | posix_fadvise(reader.GetFD().Get(), (off_t)0, info.GetSize(), |
| 54 | POSIX_FADV_SEQUENTIAL); |
| 55 | #endif |
| 56 | |
| 57 | return std::make_unique<FileInputStream>(path.ToUTF8Throw().c_str(), |
| 58 | std::move(reader), info.GetSize(), |
| 59 | mutex); |
| 60 | } |
| 61 | |
| 62 | void |
| 63 | FileInputStream::Seek(std::unique_lock<Mutex> &lock, |
no test coverage detected