2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
10 #include "chan_user.h"
11 #include "user_util.h"
14 #include "um_malloc.h"
22 static void *tty_chan_init(char *str, int device, const struct chan_opts *opts)
24 struct tty_chan *data;
27 printk("tty_init : channel type 'tty' must specify "
33 data = um_kmalloc(sizeof(*data));
36 *data = ((struct tty_chan) { .dev = str,
42 static int tty_open(int input, int output, int primary, void *d,
45 struct tty_chan *data = d;
48 fd = os_open_file(data->dev, of_set_rw(OPENFLAGS(), input, output), 0);
53 CATCH_EINTR(err = tcgetattr(fd, &data->tt));
66 const struct chan_ops tty_ops = {
68 .init = tty_chan_init,
70 .close = generic_close,
72 .write = generic_write,
73 .console_write = generic_console_write,
74 .window_size = generic_window_size,