21#include <l4/cxx/minmax>
23#include "vcon_stream.h"
28#include <sys/ttydefaults.h>
30namespace L4Re {
namespace Core {
33 _s(s), _irq(L4Re::virt_cap_alloc->alloc<L4::Semaphore>()), _irq_bound(
false)
41Vcon_stream::readv(
const struct iovec *iovec,
int iovcnt)
noexcept
48 bool was_bound = __atomic_exchange_n(&_irq_bound,
true, __ATOMIC_SEQ_CST);
55 for (; iovcnt > 0; --iovcnt, ++iovec)
57 size_t len = cxx::min<size_t>(iovec->iov_len, SSIZE_MAX - bytes);
61 char *buf =
static_cast<char *
>(iovec->iov_base);
66 int ret = _s->read(buf, l);
68 if (ret >
static_cast<int>(l))
78 ret = _s->read(buf, l);
101Vcon_stream::writev(
const struct iovec *iovec,
int iovcnt)
noexcept
109 Vfs_config::memcpy(&store, mr,
sizeof(store));
114 size_t sl = cxx::min<size_t>(iovec->iov_len, SSIZE_MAX - written);
115 char const *b =
static_cast<char const *
>(iovec->iov_base);
129 Vfs_config::memcpy(mr, &store,
sizeof(store));
134Vcon_stream::fstat64(
struct stat64 *buf)
const noexcept
138 buf->st_dev = _s.cap();
144Vcon_stream::ioctl(
unsigned long request, va_list args)
noexcept
151 struct termios *t = va_arg(args,
struct termios *);
162 t->c_iflag = t->c_oflag = t->c_cflag = t->c_lflag = 0;
165 t->c_lflag |= ICANON;
168 t->c_cc[VEOF] = CEOF;
169 t->c_cc[VEOL] = _POSIX_VDISABLE;
170 t->c_cc[VEOL2] = _POSIX_VDISABLE;
171 t->c_cc[VERASE] = CERASE;
172 t->c_cc[VWERASE] = CWERASE;
173 t->c_cc[VKILL] = CKILL;
174 t->c_cc[VREPRINT] = CREPRINT;
175 t->c_cc[VINTR] = CINTR;
176 t->c_cc[VQUIT] = _POSIX_VDISABLE;
177 t->c_cc[VSUSP] = CSUSP;
178 t->c_cc[VSTART] = CSTART;
179 t->c_cc[VSTOP] = CSTOP;
180 t->c_cc[VLNEXT] = CLNEXT;
181 t->c_cc[VDISCARD] = CDISCARD;
182 t->c_cc[VMIN] = CMIN;
194 struct termios const *t = va_arg(args,
struct termios
const *);
static Env const * env() noexcept
Returns the initial environment for the current task.
C++ interface for capabilities.
Common factory related definitions.
long l4_error(l4_msgtag_t tag) L4_NOTHROW
Get IPC error code if any or message tag label otherwise for an IPC call.
l4_msg_regs_t * l4_utcb_mr(void) L4_NOTHROW L4_PURE
Get the message-register block of a UTCB.
@ L4_VCON_READ_SIZE
Maximum size that can be read with one l4_vcon_read* call.
@ L4_VCON_WRITE_SIZE
Maximum size that can be written with one l4_vcon_write call.
Vcon attribute structure.
l4_umword_t i_flags
input flags
l4_umword_t o_flags
output flags
l4_umword_t l_flags
local flags
Encapsulation of the message-register block in the UTCB.