1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
11 #include <um_malloc.h>
19 static void *tty_chan_init(char *str
, int device
, const struct chan_opts
*opts
)
21 struct tty_chan
*data
;
24 printk(UM_KERN_ERR
"tty_init : channel type 'tty' must specify "
30 data
= uml_kmalloc(sizeof(*data
), UM_GFP_KERNEL
);
33 *data
= ((struct tty_chan
) { .dev
= str
,
39 static int tty_open(int input
, int output
, int primary
, void *d
,
42 struct tty_chan
*data
= d
;
43 int fd
, err
, mode
= 0;
52 fd
= open(data
->dev
, mode
);
57 CATCH_EINTR(err
= tcgetattr(fd
, &data
->tt
));
70 const struct chan_ops tty_ops
= {
72 .init
= tty_chan_init
,
74 .close
= generic_close
,
76 .write
= generic_write
,
77 .console_write
= generic_console_write
,
78 .window_size
= generic_window_size
,