Last active
February 8, 2018 10:12
-
-
Save rightson/fe966689117f63cc7ccc2a60fa949cec to your computer and use it in GitHub Desktop.
TTY discipline example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct tty_ldisc { | |
int magic; | |
char* name; | |
int num; | |
int flags; | |
/* | |
* The following routines are called from above. | |
*/ | |
int (*open)(struct tty_struct*); | |
void (*close)(struct tty_struct*); | |
void (*flush_buffer)(struct tty_struct* tty); | |
ssize_t (*chars_in_buffer)(struct tty_struct* tty); | |
ssize_t (*read)(struct tty_struct* tty, struct file* file, unsigned char* buf, size_t nr); | |
ssize_t (*write)(struct tty_struct* tty, struct file* file, const unsigned char* buf, size_t nr); | |
int (*ioctl)(struct tty_struct* tty, struct file* file, unsigned int cmd, unsigned long arg); | |
void (*set_termios)(struct tty_struct* tty, struct termios* old); | |
unsigned int (*poll)(struct tty_struct*, struct file*, struct poll_table_struct*); | |
/* | |
* The following routines are called from below. | |
*/ | |
void (*receive_buf)(struct tty_struct*, const unsigned char* cp, char* fp, int count); | |
int (*receive_room)(struct tty_struct*); | |
void (*write_wakeup)(struct tty_struct*); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment