mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 23:42:32 +00:00
libc_fs: Handle Packet_alloc_failed exception
This commit is contained in:
parent
28c6763a7d
commit
2e6f281cf0
@ -563,6 +563,7 @@ class Plugin : public Libc::Plugin
|
|||||||
|
|
||||||
ssize_t read(Libc::File_descriptor *fd, void *buf, ::size_t count)
|
ssize_t read(Libc::File_descriptor *fd, void *buf, ::size_t count)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
File_system::Session::Tx::Source &source = *file_system()->tx();
|
File_system::Session::Tx::Source &source = *file_system()->tx();
|
||||||
|
|
||||||
size_t const max_packet_size = source.bulk_buffer_size() / 2;
|
size_t const max_packet_size = source.bulk_buffer_size() / 2;
|
||||||
@ -578,9 +579,8 @@ class Plugin : public Libc::Plugin
|
|||||||
|
|
||||||
size_t curr_packet_size = Genode::min(remaining_count, max_packet_size);
|
size_t curr_packet_size = Genode::min(remaining_count, max_packet_size);
|
||||||
|
|
||||||
/*
|
off_t const seek_offset = context(fd)->seek_offset();
|
||||||
* XXX handle 'Packet_alloc_failed' exception'
|
|
||||||
*/
|
|
||||||
File_system::Packet_descriptor
|
File_system::Packet_descriptor
|
||||||
packet(source.alloc_packet(curr_packet_size),
|
packet(source.alloc_packet(curr_packet_size),
|
||||||
static_cast<File_system::Packet_ref *>(context(fd)),
|
static_cast<File_system::Packet_ref *>(context(fd)),
|
||||||
@ -598,9 +598,11 @@ class Plugin : public Libc::Plugin
|
|||||||
do {
|
do {
|
||||||
packet = source.get_acked_packet();
|
packet = source.get_acked_packet();
|
||||||
static_cast<Plugin_context *>(packet.ref())->in_flight = false;
|
static_cast<Plugin_context *>(packet.ref())->in_flight = false;
|
||||||
} while (context(fd)->in_flight);
|
|
||||||
|
|
||||||
context(fd)->in_flight = false;
|
if (packet.operation() == File_system::Packet_descriptor::WRITE)
|
||||||
|
source.release_packet(packet);
|
||||||
|
|
||||||
|
} while (context(fd)->in_flight);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX check if acked packet belongs to request,
|
* XXX check if acked packet belongs to request,
|
||||||
@ -626,8 +628,13 @@ class Plugin : public Libc::Plugin
|
|||||||
if (read_num_bytes < curr_packet_size)
|
if (read_num_bytes < curr_packet_size)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return count - remaining_count;
|
return count - remaining_count;
|
||||||
|
|
||||||
|
} catch (File_system::Session::Tx::Source::Packet_alloc_failed) {
|
||||||
|
PERR("Packet_alloc_failed during read (count=%zd)", count);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t readlink(const char *path, char *buf, size_t bufsiz)
|
ssize_t readlink(const char *path, char *buf, size_t bufsiz)
|
||||||
|
Loading…
Reference in New Issue
Block a user