mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-03 13:14:45 +00:00
Noux: add is_nonblocking() method
Certain programs tend to set their sockets non-blocking. As previously descriptors in Noux were only blocking we now introduce a method to mark the used Io_channel as non-blocking.
This commit is contained in:
parent
343266b06e
commit
95f71a5f71
@ -70,6 +70,11 @@ namespace Noux {
|
|||||||
virtual bool check_unblock(bool rd, bool wr, bool ex) const {
|
virtual bool check_unblock(bool rd, bool wr, bool ex) const {
|
||||||
return false; }
|
return false; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the channel is set to non-blocking mode
|
||||||
|
*/
|
||||||
|
virtual bool is_nonblocking() { return false; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register blocker for getting waked up on an I/O channel event
|
* Register blocker for getting waked up on an I/O channel event
|
||||||
*
|
*
|
||||||
|
@ -140,6 +140,7 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
|
|||||||
|
|
||||||
Shared_pointer<Io_channel> io = _lookup_channel(_sysio->write_in.fd);
|
Shared_pointer<Io_channel> io = _lookup_channel(_sysio->write_in.fd);
|
||||||
|
|
||||||
|
if (!io->is_nonblocking())
|
||||||
if (!io->check_unblock(false, true, false))
|
if (!io->check_unblock(false, true, false))
|
||||||
_block_for_io_channel(io);
|
_block_for_io_channel(io);
|
||||||
|
|
||||||
@ -156,6 +157,7 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
|
|||||||
{
|
{
|
||||||
Shared_pointer<Io_channel> io = _lookup_channel(_sysio->read_in.fd);
|
Shared_pointer<Io_channel> io = _lookup_channel(_sysio->read_in.fd);
|
||||||
|
|
||||||
|
if (!io->is_nonblocking())
|
||||||
while (!io->check_unblock(true, false, false))
|
while (!io->check_unblock(true, false, false))
|
||||||
_block_for_io_channel(io);
|
_block_for_io_channel(io);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user