2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
11 #include "chan_user.h"
12 #include "user_util.h"
22 void *tty_chan_init(char *str, int device, struct chan_opts *opts)
24 struct tty_chan *data;
27 printk("tty_init : channel type 'tty' must specify "
33 if((data = um_kmalloc(sizeof(*data))) == NULL)
35 *data = ((struct tty_chan) { .dev = str,
41 int tty_open(int input, int output, int primary, void *d, char **dev_out)
43 struct tty_chan *data = d;
46 fd = os_open_file(data->dev, of_set_rw(OPENFLAGS(), input, output), 0);
47 if(fd < 0) return(fd);
49 tcgetattr(fd, &data->tt);
57 int tty_console_write(int fd, const char *buf, int n, void *d)
59 struct tty_chan *data = d;
61 return(generic_console_write(fd, buf, n, &data->tt));
64 struct chan_ops tty_ops = {
66 .init = tty_chan_init,
68 .close = generic_close,
70 .write = generic_write,
71 .console_write = tty_console_write,
72 .window_size = generic_window_size,
78 * Overrides for Emacs so that we follow Linus's tabbing style.
79 * Emacs will notice this stuff at the end of the file and automatically
80 * adjust the settings for this buffer only. This must remain at the end
82 * ---------------------------------------------------------------------------
84 * c-file-style: "linux"