10#include <l4/cxx/minmax>
12#include "vcon_stream.h"
17#include <sys/ttydefaults.h>
19namespace L4Re {
namespace Core {
22 _s(s), _irq(L4Re::virt_cap_alloc->alloc<L4::Semaphore>()), _irq_bound(
false)
30Vcon_stream::readv(
const struct iovec *iovec,
int iovcnt)
noexcept
37 bool was_bound = __atomic_exchange_n(&_irq_bound,
true, __ATOMIC_SEQ_CST);
44 for (; iovcnt > 0; --iovcnt, ++iovec)
46 size_t len = cxx::min<size_t>(iovec->iov_len, SSIZE_MAX - bytes);
50 char *buf =
static_cast<char *
>(iovec->iov_base);
55 int ret = _s->read(buf, l);
57 if (ret >
static_cast<int>(l))
67 ret = _s->read(buf, l);
90Vcon_stream::writev(
const struct iovec *iovec,
int iovcnt)
noexcept
98 Vfs_config::memcpy(&store, mr,
sizeof(store));
103 size_t sl = cxx::min<size_t>(iovec->iov_len, SSIZE_MAX - written);
104 char const *b =
static_cast<char const *
>(iovec->iov_base);
118 Vfs_config::memcpy(mr, &store,
sizeof(store));
123Vcon_stream::fstat64(
struct stat64 *buf)
const noexcept
127 buf->st_dev = _s.cap();
133Vcon_stream::ioctl(
unsigned long request, va_list args)
noexcept
140 struct termios *t = va_arg(args,
struct termios *);
151 t->c_iflag = t->c_oflag = t->c_cflag = t->c_lflag = 0;
154 t->c_lflag |= ICANON;
157 t->c_cc[VEOF] = CEOF;
158 t->c_cc[VEOL] = _POSIX_VDISABLE;
159 t->c_cc[VEOL2] = _POSIX_VDISABLE;
160 t->c_cc[VERASE] = CERASE;
161 t->c_cc[VWERASE] = CWERASE;
162 t->c_cc[VKILL] = CKILL;
163 t->c_cc[VREPRINT] = CREPRINT;
164 t->c_cc[VINTR] = CINTR;
165 t->c_cc[VQUIT] = _POSIX_VDISABLE;
166 t->c_cc[VSUSP] = CSUSP;
167 t->c_cc[VSTART] = CSTART;
168 t->c_cc[VSTOP] = CSTOP;
169 t->c_cc[VLNEXT] = CLNEXT;
170 t->c_cc[VDISCARD] = CDISCARD;
171 t->c_cc[VMIN] = CMIN;
183 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.