vfs_rump: reflect resource shortage as return values

The function Vfs::Directory_service::watch() is not expected to throw
Out_of_ram/Out_of_caps but use dedicated Watch_result errors.
This commit is contained in:
Christian Helmuth 2022-04-07 16:06:11 +02:00
parent eb895975e2
commit 8a4f4fcea9

View File

@ -758,11 +758,15 @@ class Vfs::Rump_file_system : public File_system
if (fd < 0) if (fd < 0)
return WATCH_ERR_UNACCESSIBLE; return WATCH_ERR_UNACCESSIBLE;
auto *watch_handle = new (alloc) try {
Rump_watch_handle(*this, alloc, fd); auto *watch_handle = new (alloc)
_watchers.insert(watch_handle); Rump_watch_handle(*this, alloc, fd);
*handle = watch_handle; _watchers.insert(watch_handle);
return WATCH_OK; *handle = watch_handle;
return WATCH_OK;
}
catch (Genode::Out_of_ram) { return WATCH_ERR_OUT_OF_RAM; }
catch (Genode::Out_of_caps) { return WATCH_ERR_OUT_OF_CAPS; }
} }
void close(Vfs_watch_handle *vfs_handle) override void close(Vfs_watch_handle *vfs_handle) override