首页 > 图灵资讯 > 技术篇>正文

TTY之struct tty_ldisc

2023-05-30 09:33:04

struct tty_ldisc { struct tty_ldisc_ops *ops; struct tty_struct *tty;};struct tty_ldisc_ops { 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 (*read)(struct tty_struct *tty, struct file *file,   unsigned char __user *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); long (*compat_ioctl)(struct tty_struct *tty, struct file *file,    unsigned int cmd, unsigned long arg); void (*set_termios)(struct tty_struct *tty, struct ktermios *old); unsigned int (*poll)(struct tty_struct *, struct file *,        struct poll_table_struct *); int (*hangup)(struct tty_struct *tty); /*  * The following routines are called from below.  */ void (*receive_buf)(struct tty_struct *, const unsigned char *cp,          char *fp, int count); void (*write_wakeup)(struct tty_struct *); void (*dcd_change)(struct tty_struct *, unsigned int); int (*receive_buf2)(struct tty_struct *, const unsigned char *cp,    char *fp, int count); struct  module *owner; int refcount;};

上一篇 设计模式之模板方法模式
下一篇 Linux Kernel设备驱动模型之 核心SR管理

文章素材均来源于网络,如有侵权,请联系管理员删除。