Commit 75fb85fc authored by Kevin Wolf's avatar Kevin Wolf

kernel2: Dateizeiger zwischen Streams synchronisieren

! kernel2: Wenn zwei verschiedene Streams zu einer non-seekable
  Ressource (z.B. Terminal) existieren, dann müssen ihre Dateizeiger
  synchronisiert werden, damit nicht z.B. Tastatureingaben doppelt
  gelesen werden.
Signed-off-by: Kevin Wolf's avatarKevin Wolf <kevin@tyndur.org>
parent 872ce5ec
......@@ -425,8 +425,14 @@ struct lio_stream* lio_composite_stream(struct lio_stream* read,
static uint64_t stream_getpos(struct lio_stream* s, bool read)
{
if (read || (s->res_read == s->res_write)) {
if (s->res_read->excl_stream) {
s->pos_read = s->res_read->excl_stream->pos_read;
}
return s->pos_read;
} else {
if (s->res_write->excl_stream) {
s->pos_write = s->res_read->excl_stream->pos_write;
}
return s->pos_write;
}
}
......@@ -435,8 +441,14 @@ static void stream_updatepos(struct lio_stream* s, bool read, uint64_t pos)
{
if (read || (s->res_read == s->res_write)) {
s->pos_read = pos;
if (s->res_read->excl_stream) {
s->res_read->excl_stream->pos_read = s->pos_read;
}
} else {
s->pos_write = pos;
if (s->res_write->excl_stream) {
s->res_write->excl_stream->pos_write = s->pos_write;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment