using namespace L4Re::Vfs;
-class in_ops : public Be_file
+class in_ops : public Be_file_stream
{
private:
Event::Event _event;
+ L4::Cap<L4::Vcon> _s;
public:
- in_ops() throw() : Be_file(), _event(this) {}
+ in_ops(L4::Cap<L4::Vcon> v) throw()
+ : Be_file_stream(), _event(this), _s(v) {}
~in_ops() throw() {}
int bind_irq(unsigned irq, L4::Cap<L4::Irq> const &irq_cap) throw()
if (len == 0)
return -EINVAL;
- int ret = L4Re::Env::env()->log()->read((char *)buf, len);
+ int ret = _s->read((char *)buf, len);
if (ret > (int)len)
ret = len;
// nothing read, read needs to block
_event.wait();
- ret = L4Re::Env::env()->log()->read((char *)buf, len);
+ ret = _s->read((char *)buf, len);
if (ret > (int)len)
ret = len;
}
struct termios *t = va_arg(args, struct termios *);
- // XXX: well, we're cheating, get this from the other side!
-
- t->c_iflag = 0;
- t->c_oflag = 0; // output flags
- t->c_cflag = 0; // control flags
-
- t->c_lflag = 0; // local flags
+ l4_vcon_attr_t l4a;
+ if (!l4_error(_s->get_attr(&l4a)))
+ {
+ t->c_iflag = l4a.i_flags;
+ t->c_oflag = l4a.o_flags; // output flags
+ t->c_cflag = 0; // control flags
+ t->c_lflag = l4a.l_flags; // local flags
+ }
+ else
+ t->c_iflag = t->c_oflag = t->c_cflag = t->c_lflag = 0;
+#if 0
//t->c_lflag |= ECHO; // if term->echo
t->c_lflag |= ICANON; // if term->term_mode == VT100MODE_COOKED
+#endif
t->c_cc[VEOF] = CEOF;
t->c_cc[VEOL] = _POSIX_VDISABLE;
t->c_cc[VTIME] = 0;
//printf("TCGETS: c_lflags = %08x\n", t->c_lflag);
-
}
return 0;
case TCSETSF:
{
//vt100_tcsetattr(term, (struct termios *)argp);
- //struct termios *t = va_arg(args, struct termios *);
+ struct termios *t = va_arg(args, struct termios *);
//XXX: probably we need to get this over to the other side!
//printf("TCSETS*: c_lflags = %08x\n", t->c_lflag);
+
+ l4_vcon_attr_t l4a;
+ l4a.i_flags = t->c_iflag;
+ l4a.o_flags = t->c_oflag; // output flags
+ l4a.l_flags = t->c_lflag; // local flags
+ _s->set_attr(&l4a);
}
return 0;
static void get_in_ops() __attribute__((constructor));
static void get_in_ops()
{
- static in_ops _myops;
+ static in_ops _myops(L4Re::Env::env()->log());
_myops.add_ref(); // prevent the static object from beeing deleted
L4Re::Vfs::vfs_ops->set_fd(STDIN_FILENO, cxx::ref_ptr(&_myops));
}