mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
os: handle SYNC packet in lx_fs
Call 'fsync(2)' on files and directories. Fixes #3711.
This commit is contained in:
parent
df553e9360
commit
336228f357
@ -237,6 +237,12 @@ class Lx_fs::Directory : public Node
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool sync() override
|
||||
{
|
||||
int ret = fsync(dirfd(_fd));
|
||||
return ret ? false : true;
|
||||
}
|
||||
|
||||
Status status() override
|
||||
{
|
||||
struct stat st { };
|
||||
|
@ -141,6 +141,12 @@ class Lx_fs::File : public Node
|
||||
return ret == -1 ? 0 : ret;
|
||||
}
|
||||
|
||||
bool sync() override
|
||||
{
|
||||
int ret = fsync(_fd);
|
||||
return ret ? false : true;
|
||||
}
|
||||
|
||||
Status status() override
|
||||
{
|
||||
struct stat st { };
|
||||
|
@ -121,13 +121,10 @@ class Lx_fs::Session_component : public Session_rpc_object
|
||||
|
||||
case Packet_descriptor::SYNC:
|
||||
|
||||
/**
|
||||
* We could call sync(2) here but for now we forward just the
|
||||
* reminder because besides testing, there is currently no
|
||||
* use-case.
|
||||
*/
|
||||
Genode::warning("SYNC not implemented!");
|
||||
succeeded = true;
|
||||
if (tx_sink()->packet_valid(packet)) {
|
||||
succeeded = open_node.node().sync();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,8 @@ class Lx_fs::Node : public File_system::Node_base
|
||||
virtual size_t read(char *dst, size_t len, seek_off_t) = 0;
|
||||
virtual size_t write(char const *src, size_t len, seek_off_t) = 0;
|
||||
|
||||
virtual bool sync() { return true; }
|
||||
|
||||
virtual Status status() = 0;
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user