mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 18:56:29 +00:00
libc: make mtime update configurable
By specifying <libc update_mtime="no"...>, the modification-time update on VFS-sync operations (as issued whenever a written file is closed) can explicitly be disabled. Issue #1784
This commit is contained in:
parent
76438a3f85
commit
979d823d85
@ -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);
|
||||
|
@ -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 { }
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user