diff --git a/repos/libports/src/lib/libc/task.cc b/repos/libports/src/lib/libc/task.cc index 147dfd47d..6ac560efb 100644 --- a/repos/libports/src/lib/libc/task.cc +++ b/repos/libports/src/lib/libc/task.cc @@ -767,6 +767,17 @@ struct Libc::Kernel final : Vfs::Io_response_handler, } } + /** + * Alloc new watch handler for given path + */ + Vfs::Vfs_watch_handle *alloc_watch_handle(char const *path) + { + Vfs::Vfs_watch_handle *watch_handle { nullptr }; + typedef Vfs::Directory_service::Watch_result Result; + return _libc_env.vfs().watch(path, &watch_handle, _heap) == Result::WATCH_OK + ? watch_handle : nullptr; + } + /**************************************** ** Vfs::Io_response_handler interface ** @@ -857,6 +868,12 @@ void Libc::dispatch_pending_io_signals() } +Vfs::Vfs_watch_handle *Libc::watch(char const *path) +{ + return kernel->alloc_watch_handle(path); +} + + Genode::Duration Libc::current_time() { return kernel->current_time(); diff --git a/repos/libports/src/lib/libc/task.h b/repos/libports/src/lib/libc/task.h index c674becad..c90bb1724 100644 --- a/repos/libports/src/lib/libc/task.h +++ b/repos/libports/src/lib/libc/task.h @@ -23,6 +23,7 @@ #include #include +#include namespace Libc { @@ -51,6 +52,16 @@ namespace Libc { void dispatch_pending_io_signals(); + /** + * Get watch handle for given path + * + * \param path path that should be be watched + * + * \return point to the watch handle object or a nullptr + * when the watch operation failed + */ + Vfs::Vfs_watch_handle *watch(char const *path); + /** * Get time since startup in ms */