diff --git a/repos/libports/src/lib/libc/internal/kernel.h b/repos/libports/src/lib/libc/internal/kernel.h index cce005591..705874136 100644 --- a/repos/libports/src/lib/libc/internal/kernel.h +++ b/repos/libports/src/lib/libc/internal/kernel.h @@ -94,8 +94,13 @@ struct Libc::Kernel final : Vfs::Io_response_handler, */ void reset_malloc_heap() override; - Env_implementation _libc_env { _env, _heap }; - Vfs_plugin _vfs { _libc_env, _heap, *this }; + Env_implementation _libc_env { _env, _heap }; + + bool const _update_mtime = _libc_env.libc_config().attribute_value("update_mtime", true); + + Vfs_plugin _vfs { _libc_env, _heap, *this, + _update_mtime ? Vfs_plugin::Update_mtime::YES + : Vfs_plugin::Update_mtime::NO }; bool const _cloned = _libc_env.libc_config().attribute_value("cloned", false); pid_t const _pid = _libc_env.libc_config().attribute_value("pid", 0U); diff --git a/repos/libports/src/lib/libc/internal/vfs_plugin.h b/repos/libports/src/lib/libc/internal/vfs_plugin.h index 8458c9df4..d766eea8e 100644 --- a/repos/libports/src/lib/libc/internal/vfs_plugin.h +++ b/repos/libports/src/lib/libc/internal/vfs_plugin.h @@ -37,11 +37,16 @@ namespace Libc { class Vfs_plugin; } class Libc::Vfs_plugin : public Plugin { + public: + + enum class Update_mtime { NO, YES }; + private: Genode::Allocator &_alloc; Vfs::File_system &_root_dir; Vfs::Io_response_handler &_response_handler; + Update_mtime const _update_mtime; /** * Sync a handle and propagate errors @@ -57,9 +62,12 @@ class Libc::Vfs_plugin : public Plugin Vfs_plugin(Libc::Env &env, Genode::Allocator &alloc, - Vfs::Io_response_handler &handler) + Vfs::Io_response_handler &handler, + Update_mtime update_mtime) : - _alloc(alloc), _root_dir(env.vfs()), _response_handler(handler) + _alloc(alloc), _root_dir(env.vfs()), + _response_handler(handler), + _update_mtime(update_mtime) { } ~Vfs_plugin() final { } diff --git a/repos/libports/src/lib/libc/vfs_plugin.cc b/repos/libports/src/lib/libc/vfs_plugin.cc index e5be14385..a3b89254a 100644 --- a/repos/libports/src/lib/libc/vfs_plugin.cc +++ b/repos/libports/src/lib/libc/vfs_plugin.cc @@ -349,6 +349,9 @@ void Libc::Vfs_plugin::_vfs_write_mtime(Vfs::Vfs_handle &handle) { struct timespec ts; + if (_update_mtime == Update_mtime::NO) + return; + /* XXX using clock_gettime directly is probably not the best idea */ if (clock_gettime(CLOCK_REALTIME, &ts) < 0) { ts.tv_sec = 0;