Skip to content

Commit 4dcd4df

Browse files
bhalevyxemul
authored andcommitted
file: provide a default implementation for file_impl::statat
By default, file_impl::statat now throws a runtime_error similar to other unsupported methods. Note that posix_file_impl does override statat with an implementation based on the statat system call. Signed-off-by: Benny Halevy <[email protected]> Closes #3187
1 parent 801b156 commit 4dcd4df

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

include/seastar/core/file.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public:
149149

150150
virtual future<> flush() = 0;
151151
virtual future<struct stat> stat() = 0;
152-
virtual future<struct stat> statat(std::string_view name, int flags = 0) = 0;
152+
virtual future<struct stat> statat(std::string_view name, int flags = 0);
153153
virtual future<> truncate(uint64_t length) = 0;
154154
virtual future<> discard(uint64_t offset, uint64_t length) = 0;
155155
virtual future<int> ioctl(uint64_t cmd, void* argp) noexcept;

src/core/file.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,6 +1509,10 @@ future<int> file_impl::fcntl_short(int op, uintptr_t arg) noexcept {
15091509
return make_exception_future<int>(std::runtime_error("this file type does not support fcntl_short"));
15101510
}
15111511

1512+
future<struct stat> file_impl::statat(std::string_view name, int flags) {
1513+
return make_exception_future<struct stat>(std::runtime_error("this file type does not support statat"));
1514+
}
1515+
15121516
future<file> open_file_dma(std::string_view name, open_flags flags) noexcept {
15131517
return engine().open_file_dma(name, flags, file_open_options());
15141518
}

0 commit comments

Comments
 (0)