mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-23 01:08:55 +00:00
terminal session: return number of bytes written
To better support non-blocking terminal components, let the 'Terminal::Session::write()' function return the number of bytes actually written. Fixes #2240
This commit is contained in:
committed by
Norman Feske
parent
9f7a4feab4
commit
dbb641d44a
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
* Copyright (C) 2011-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -80,17 +80,21 @@ class Terminal::Session_client : public Genode::Rpc_client<Session>
|
||||
while (written_bytes < num_bytes) {
|
||||
|
||||
/* copy payload to I/O buffer */
|
||||
Genode::size_t n = Genode::min(num_bytes - written_bytes,
|
||||
_io_buffer.size());
|
||||
Genode::size_t payload_bytes = Genode::min(num_bytes - written_bytes,
|
||||
_io_buffer.size());
|
||||
Genode::memcpy(_io_buffer.local_addr<char>(),
|
||||
src + written_bytes, n);
|
||||
src + written_bytes, payload_bytes);
|
||||
|
||||
/* tell server to pick up new I/O buffer content */
|
||||
call<Rpc_write>(n);
|
||||
Genode::size_t written_payload_bytes = call<Rpc_write>(payload_bytes);
|
||||
|
||||
written_bytes += written_payload_bytes;
|
||||
|
||||
if (written_payload_bytes != payload_bytes)
|
||||
return written_bytes;
|
||||
|
||||
written_bytes += n;
|
||||
}
|
||||
return num_bytes;
|
||||
return written_bytes;
|
||||
}
|
||||
|
||||
void connected_sigh(Genode::Signal_context_capability cap)
|
||||
|
Reference in New Issue
Block a user