FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/fcntl.h>
#include <sys/filio.h>
#include <sys/kernel.h>
#include <sys/signal.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/tty.h>
#include <sys/ttycom.h>
#include <sys/ttydefaults.h>
#include <sys/uio.h>
#include <sys/vnode.h>
Go to the source code of this file.
Data Structures | |
struct | ttydisc_recalc_length |
Macros | |
#define | CMP_CC(v, c) |
#define | CMP_FLAG(field, opt) (tp->t_termios.c_ ## field ## flag & (opt)) |
#define | CTAB '\t' |
#define | CNL '\n' |
#define | CCR '\r' |
#define | CTL_VALID(c) ((c) == 0x7f || (unsigned char)(c) < 0x20) |
#define | CTL_ECHO(c, q) |
#define | CTL_PRINT(c, q) |
#define | CTL_WHITE(c) ((c) == ' ' || (c) == CTAB) |
#define | CTL_ALNUM(c) |
#define | TTY_STACKBUF 256 |
#define | BREAK_ADD(c) |
#define | PRINT_NORMAL() ttyoutq_write_nofrag(&tp->t_outq, &c, 1) |
Functions | |
__FBSDID ("$BSDSUniX$") | |
SYSCTL_ULONG (_kern, OID_AUTO, tty_nin, CTLFLAG_RD,&tty_nin, 0,"Total amount of bytes received") | |
SYSCTL_ULONG (_kern, OID_AUTO, tty_nout, CTLFLAG_RD,&tty_nout, 0,"Total amount of bytes transmitted") | |
void | ttydisc_open (struct tty *tp) |
void | ttydisc_close (struct tty *tp) |
static int | ttydisc_read_canonical (struct tty *tp, struct uio *uio, int ioflag) |
static int | ttydisc_read_raw_no_timer (struct tty *tp, struct uio *uio, int ioflag) |
static int | ttydisc_read_raw_read_timer (struct tty *tp, struct uio *uio, int ioflag, int oresid) |
static int | ttydisc_read_raw_interbyte_timer (struct tty *tp, struct uio *uio, int ioflag) |
int | ttydisc_read (struct tty *tp, struct uio *uio, int ioflag) |
static __inline unsigned int | ttydisc_findchar (const char *obstart, unsigned int oblen) |
static int | ttydisc_write_oproc (struct tty *tp, char c) |
int | ttydisc_write (struct tty *tp, struct uio *uio, int ioflag) |
void | ttydisc_optimize (struct tty *tp) |
void | ttydisc_modem (struct tty *tp, int open) |
static int | ttydisc_echo_force (struct tty *tp, char c, int quote) |
static int | ttydisc_echo (struct tty *tp, char c, int quote) |
static void | ttydisc_reprint_char (void *d, char c, int quote) |
static void | ttydisc_reprint (struct tty *tp) |
static void | ttydisc_recalc_charlength (void *d, char c, int quote) |
static unsigned int | ttydisc_recalc_linelength (struct tty *tp) |
static int | ttydisc_rubchar (struct tty *tp) |
static void | ttydisc_rubword (struct tty *tp) |
int | ttydisc_rint (struct tty *tp, char c, int flags) |
size_t | ttydisc_rint_simple (struct tty *tp, const void *buf, size_t len) |
size_t | ttydisc_rint_bypass (struct tty *tp, const void *buf, size_t len) |
void | ttydisc_rint_done (struct tty *tp) |
size_t | ttydisc_rint_poll (struct tty *tp) |
static void | ttydisc_wakeup_watermark (struct tty *tp) |
size_t | ttydisc_getc (struct tty *tp, void *buf, size_t len) |
int | ttydisc_getc_uio (struct tty *tp, struct uio *uio) |
size_t | ttydisc_getc_poll (struct tty *tp) |
int | tty_putchar (struct tty *tp, char c) |
Variables | |
static unsigned long | tty_nin = 0 |
static unsigned long | tty_nout = 0 |
#define BREAK_ADD | ( | c | ) |
Referenced by ttydisc_read_canonical().
#define CCR '\r' |
Definition at line 66 of file tty_ttydisc.c.
Referenced by ttydisc_rint(), and ttydisc_write_oproc().
#define CMP_CC | ( | v, | |
c | |||
) |
Definition at line 59 of file tty_ttydisc.c.
Referenced by ttydisc_echo_force(), ttydisc_read_canonical(), and ttydisc_rint().
#define CMP_FLAG | ( | field, | |
opt | |||
) | (tp->t_termios.c_ ## field ## flag & (opt)) |
Definition at line 61 of file tty_ttydisc.c.
Referenced by ttydisc_echo(), ttydisc_echo_force(), ttydisc_modem(), ttydisc_optimize(), ttydisc_read(), ttydisc_recalc_charlength(), ttydisc_rint(), ttydisc_rubchar(), ttydisc_rubword(), ttydisc_write(), and ttydisc_write_oproc().
#define CNL '\n' |
Definition at line 65 of file tty_ttydisc.c.
Referenced by ttydisc_echo(), ttydisc_read_canonical(), ttydisc_reprint(), ttydisc_rint(), and ttydisc_write_oproc().
#define CTAB '\t' |
Definition at line 64 of file tty_ttydisc.c.
Referenced by ttydisc_recalc_charlength(), ttydisc_rubchar(), and ttydisc_write_oproc().
#define CTL_ALNUM | ( | c | ) |
Definition at line 79 of file tty_ttydisc.c.
Referenced by ttydisc_rubword().
#define CTL_ECHO | ( | c, | |
q | |||
) |
Definition at line 71 of file tty_ttydisc.c.
Referenced by ttydisc_echo_force().
#define CTL_PRINT | ( | c, | |
q | |||
) |
Definition at line 74 of file tty_ttydisc.c.
Referenced by ttydisc_echo_force(), ttydisc_recalc_charlength(), and ttydisc_rubchar().
#define CTL_VALID | ( | c | ) | ((c) == 0x7f || (unsigned char)(c) < 0x20) |
Definition at line 69 of file tty_ttydisc.c.
Referenced by ttydisc_findchar(), and ttydisc_write_oproc().
#define CTL_WHITE | ( | c | ) | ((c) == ' ' || (c) == CTAB) |
Definition at line 77 of file tty_ttydisc.c.
Referenced by ttydisc_rubword().
#define PRINT_NORMAL | ( | ) | ttyoutq_write_nofrag(&tp->t_outq, &c, 1) |
Referenced by ttydisc_write_oproc().
#define TTY_STACKBUF 256 |
Definition at line 82 of file tty_ttydisc.c.
Referenced by ttydisc_getc_uio(), and ttydisc_write().
__FBSDID | ( | "$BSDSUniX$" | ) |
SYSCTL_ULONG | ( | _kern | , |
OID_AUTO | , | ||
tty_nin | , | ||
CTLFLAG_RD | , | ||
& | tty_nin, | ||
0 | , | ||
"Total amount of bytes received" | |||
) |
SYSCTL_ULONG | ( | _kern | , |
OID_AUTO | , | ||
tty_nout | , | ||
CTLFLAG_RD | , | ||
& | tty_nout, | ||
0 | , | ||
"Total amount of bytes transmitted" | |||
) |
int tty_putchar | ( | struct tty * | tp, |
char | c | ||
) |
Definition at line 1256 of file tty_ttydisc.c.
References ttydisc_echo_force(), and ttyinq_reprintpos_set().
Referenced by constty_timeout(), and putchar().
void ttydisc_close | ( | struct tty * | tp | ) |
Definition at line 91 of file tty_ttydisc.c.
References ttyinq_flush(), and ttyoutq_flush().
Referenced by ttydev_leave().
|
static |
Definition at line 666 of file tty_ttydisc.c.
References CMP_FLAG, CNL, and ttydisc_echo_force().
Referenced by ttydisc_reprint(), ttydisc_reprint_char(), ttydisc_rint(), and ttydisc_rubchar().
|
static |
Definition at line 630 of file tty_ttydisc.c.
References CMP_CC, CMP_FLAG, CTL_ECHO, CTL_PRINT, ttydisc_write_oproc(), and ttyoutq_write_nofrag().
Referenced by tty_putchar(), and ttydisc_echo().
|
static |
Definition at line 355 of file tty_ttydisc.c.
References CTL_VALID.
Referenced by ttydisc_write().
size_t ttydisc_getc | ( | struct tty * | tp, |
void * | buf, | ||
size_t | len | ||
) |
Definition at line 1167 of file tty_ttydisc.c.
References tty_nout, ttydisc_wakeup_watermark(), and ttyoutq_read().
Referenced by termtty_outwakeup(), and ttydisc_getc_uio().
size_t ttydisc_getc_poll | ( | struct tty * | tp | ) |
Definition at line 1235 of file tty_ttydisc.c.
Referenced by pts_kqops_read_event(), ptsdev_ioctl(), ptsdev_poll(), and ptsdev_read().
int ttydisc_getc_uio | ( | struct tty * | tp, |
struct uio * | uio | ||
) |
Definition at line 1190 of file tty_ttydisc.c.
References buf, tty_nout, TTY_STACKBUF, ttydisc_getc(), ttydisc_wakeup_watermark(), ttyoutq_read_uio(), and uiomove().
Referenced by ptsdev_read().
void ttydisc_modem | ( | struct tty * | tp, |
int | open | ||
) |
Definition at line 595 of file tty_ttydisc.c.
References CMP_FLAG, tty_flush(), and tty_signal_sessleader().
Referenced by tty_rel_gone().
void ttydisc_open | ( | struct tty * | tp | ) |
Definition at line 85 of file tty_ttydisc.c.
References ttydisc_optimize().
Referenced by ttydev_open().
void ttydisc_optimize | ( | struct tty * | tp | ) |
Definition at line 575 of file tty_ttydisc.c.
References CMP_FLAG.
Referenced by tty_generic_ioctl(), ttydisc_open(), ttyhook_register(), and ttyhook_unregister().
int ttydisc_read | ( | struct tty * | tp, |
struct uio * | uio, | ||
int | ioflag | ||
) |
Definition at line 326 of file tty_ttydisc.c.
References CMP_FLAG, tty_hiwat_in_unblock(), ttydisc_read_canonical(), ttydisc_read_raw_interbyte_timer(), ttydisc_read_raw_no_timer(), and ttydisc_read_raw_read_timer().
Referenced by ttydev_read().
|
static |
Definition at line 111 of file tty_ttydisc.c.
References BREAK_ADD, CMP_CC, CNL, tty_wait(), tty_wait_background(), ttyinq_findchar(), and ttyinq_read_uio().
Referenced by ttydisc_read().
|
static |
Definition at line 277 of file tty_ttydisc.c.
References tty_wait(), tty_wait_background(), ttydisc_read_raw_read_timer(), and ttyinq_read_uio().
Referenced by ttydisc_read().
|
static |
Definition at line 184 of file tty_ttydisc.c.
References tty_wait(), tty_wait_background(), and ttyinq_read_uio().
Referenced by ttydisc_read().
|
static |
Definition at line 223 of file tty_ttydisc.c.
References getmicrotime(), hz, timevaladd(), timevalsub(), tty_timedwait(), tty_wait_background(), ttyinq_read_uio(), and tvtohz().
Referenced by ttydisc_read(), and ttydisc_read_raw_interbyte_timer().
|
static |
Definition at line 710 of file tty_ttydisc.c.
References CMP_FLAG, CTAB, CTL_PRINT, ttydisc_recalc_length::curlen, and ttydisc_recalc_length::tp.
Referenced by ttydisc_recalc_linelength().
|
static |
Definition at line 726 of file tty_ttydisc.c.
References ttydisc_recalc_length::curlen, ttydisc_recalc_length::tp, ttydisc_recalc_charlength(), and ttyinq_line_iterate_from_reprintpos().
Referenced by ttydisc_rubchar().
|
static |
Definition at line 690 of file tty_ttydisc.c.
References CNL, ttydisc_echo(), ttydisc_reprint_char(), ttyinq_line_iterate_from_linestart(), and ttyinq_reprintpos_reset().
Referenced by ttydisc_rint(), and ttydisc_rubchar().
|
static |
Definition at line 682 of file tty_ttydisc.c.
References ttydisc_echo().
Referenced by ttydisc_reprint().
int ttydisc_rint | ( | struct tty * | tp, |
char | c, | ||
int | flags | ||
) |
Definition at line 841 of file tty_ttydisc.c.
References CCR, CMP_CC, CMP_FLAG, CNL, tty_flush(), tty_hiwat_in_block(), tty_nin, tty_signal_pgrp(), ttydisc_echo(), ttydisc_reprint(), ttydisc_rubchar(), ttydisc_rubword(), ttyinq_canonicalize(), ttyinq_write_nofrag(), and ttyoutq_write_nofrag().
Referenced by terminal_input_char(), terminal_input_raw(), tty_generic_ioctl(), and ttydisc_rint_simple().
size_t ttydisc_rint_bypass | ( | struct tty * | tp, |
const void * | buf, | ||
size_t | len | ||
) |
Definition at line 1086 of file tty_ttydisc.c.
References tty_hiwat_in_block(), tty_nin, ttyinq_canonicalize(), and ttyinq_write().
Referenced by ttydisc_rint_simple().
void ttydisc_rint_done | ( | struct tty * | tp | ) |
Definition at line 1108 of file tty_ttydisc.c.
References tty_wakeup().
Referenced by ptsdev_write(), terminal_input_char(), terminal_input_raw(), terminal_input_special(), termteken_respond(), and tty_generic_ioctl().
size_t ttydisc_rint_poll | ( | struct tty * | tp | ) |
Definition at line 1123 of file tty_ttydisc.c.
Referenced by pts_kqops_write_event(), and ptsdev_poll().
size_t ttydisc_rint_simple | ( | struct tty * | tp, |
const void * | buf, | ||
size_t | len | ||
) |
Definition at line 1070 of file tty_ttydisc.c.
References ttydisc_rint(), and ttydisc_rint_bypass().
Referenced by ptsdev_write(), terminal_input_char(), terminal_input_special(), and termteken_respond().
|
static |
Definition at line 736 of file tty_ttydisc.c.
References CMP_FLAG, CTAB, CTL_PRINT, ttydisc_echo(), ttydisc_recalc_linelength(), ttydisc_reprint(), ttyinq_peekchar(), ttyinq_unputchar(), and ttyoutq_write_nofrag().
Referenced by ttydisc_rint(), and ttydisc_rubword().
|
static |
Definition at line 809 of file tty_ttydisc.c.
References CMP_FLAG, CTL_ALNUM, CTL_WHITE, ttydisc_rubchar(), and ttyinq_peekchar().
Referenced by ttydisc_rint().
|
static |
Definition at line 1146 of file tty_ttydisc.c.
References tty_wakeup().
Referenced by ttydisc_getc(), and ttydisc_getc_uio().
int ttydisc_write | ( | struct tty * | tp, |
struct uio * | uio, | ||
int | ioflag | ||
) |
Definition at line 455 of file tty_ttydisc.c.
References CMP_FLAG, TTY_STACKBUF, tty_wait(), ttydisc_findchar(), ttydisc_write_oproc(), ttyinq_reprintpos_set(), ttyoutq_write(), and uiomove().
Referenced by ttydev_write().
|
static |
Definition at line 369 of file tty_ttydisc.c.
References CCR, CMP_FLAG, CNL, CTAB, CTL_VALID, PRINT_NORMAL, ttyinq_reprintpos_set(), and ttyoutq_write_nofrag().
Referenced by ttydisc_echo_force(), and ttydisc_write().
|
static |
Definition at line 51 of file tty_ttydisc.c.
Referenced by ttydisc_rint(), and ttydisc_rint_bypass().
|
static |
Definition at line 54 of file tty_ttydisc.c.
Referenced by ttydisc_getc(), and ttydisc_getc_uio().