FreeBSD kernel kern code
tty.c File Reference
#include <sys/cdefs.h>
#include "opt_capsicum.h"
#include "opt_printf.h"
#include <sys/param.h>
#include <sys/capsicum.h>
#include <sys/conf.h>
#include <sys/cons.h>
#include <sys/fcntl.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/filio.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/poll.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/serial.h>
#include <sys/signal.h>
#include <sys/stat.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/tty.h>
#include <sys/ttycom.h>
#include <sys/ttydefaults.h>
#include <sys/ucred.h>
#include <sys/vnode.h>
#include <fs/devfs/devfs.h>
#include <machine/stdarg.h>
#include "opt_ddb.h"
Include dependency graph for tty.c:

Go to the source code of this file.

Macros

#define TTYDEFCHARS
 
#define TTYSUP_IFLAG
 
#define TTYSUP_OFLAG   (OPOST|ONLCR|TAB3|ONOEOT|OCRNL|ONOCR|ONLRET)
 
#define TTYSUP_LFLAG
 
#define TTYSUP_CFLAG
 
#define TTY_CALLOUT(tp, d)   (dev2unit(d) & TTYUNIT_CALLOUT)
 
#define TTYBUF_MAX   65536
 
#define TTY_PRBUF_SIZE   256
 
#define PATCH_FUNC(x)
 
#define TF_ACTIVITY   (TF_GONE|TF_OPENED|TF_HOOK|TF_OPENCLOSE)
 

Functions

 __FBSDID ("$FreeBSD$")
 
static MALLOC_DEFINE (M_TTY, "tty", "tty device")
 
static void tty_rel_free (struct tty *tp)
 
static TAILQ_HEAD (tty)
 
static int tty_drain (struct tty *tp, int leaving)
 
static __inline int ttydev_enter (struct tty *tp)
 
static void ttydev_leave (struct tty *tp)
 
static int ttydev_open (struct cdev *dev, int oflags, int devtype __unused, struct thread *td)
 
static int ttydev_close (struct cdev *dev, int fflag, int devtype __unused, struct thread *td __unused)
 
static __inline int tty_is_ctty (struct tty *tp, struct proc *p)
 
int tty_wait_background (struct tty *tp, struct thread *td, int sig)
 
static int ttydev_read (struct cdev *dev, struct uio *uio, int ioflag)
 
static int ttydev_write (struct cdev *dev, struct uio *uio, int ioflag)
 
static int ttydev_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
 
static int ttydev_poll (struct cdev *dev, int events, struct thread *td)
 
static int ttydev_mmap (struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr)
 
static void tty_kqops_read_detach (struct knote *kn)
 
static int tty_kqops_read_event (struct knote *kn, long hint __unused)
 
static void tty_kqops_write_detach (struct knote *kn)
 
static int tty_kqops_write_event (struct knote *kn, long hint __unused)
 
static int ttydev_kqfilter (struct cdev *dev, struct knote *kn)
 
static int ttyil_open (struct cdev *dev, int oflags __unused, int devtype __unused, struct thread *td)
 
static int ttyil_close (struct cdev *dev __unused, int flag __unused, int mode __unused, struct thread *td __unused)
 
static int ttyil_rdwr (struct cdev *dev __unused, struct uio *uio __unused, int ioflag __unused)
 
static int ttyil_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
 
static void tty_init_termios (struct tty *tp)
 
void tty_init_console (struct tty *tp, speed_t s)
 
static int ttydevsw_defopen (struct tty *tp __unused)
 
static void ttydevsw_defclose (struct tty *tp __unused)
 
static void ttydevsw_defoutwakeup (struct tty *tp __unused)
 
static void ttydevsw_definwakeup (struct tty *tp __unused)
 
static int ttydevsw_defioctl (struct tty *tp __unused, u_long cmd __unused, caddr_t data __unused, struct thread *td __unused)
 
static int ttydevsw_defcioctl (struct tty *tp __unused, int unit __unused, u_long cmd __unused, caddr_t data __unused, struct thread *td __unused)
 
static int ttydevsw_defparam (struct tty *tp __unused, struct termios *t)
 
static int ttydevsw_defmodem (struct tty *tp __unused, int sigon __unused, int sigoff __unused)
 
static int ttydevsw_defmmap (struct tty *tp __unused, vm_ooffset_t offset __unused, vm_paddr_t *paddr __unused, int nprot __unused, vm_memattr_t *memattr __unused)
 
static void ttydevsw_defpktnotify (struct tty *tp __unused, char event __unused)
 
static void ttydevsw_deffree (void *softc __unused)
 
static bool ttydevsw_defbusy (struct tty *tp __unused)
 
struct tty * tty_alloc (struct ttydevsw *tsw, void *sc)
 
struct tty * tty_alloc_mutex (struct ttydevsw *tsw, void *sc, struct mtx *mutex)
 
static void tty_dealloc (void *arg)
 
void tty_rel_pgrp (struct tty *tp, struct pgrp *pg)
 
void tty_rel_sess (struct tty *tp, struct session *sess)
 
void tty_rel_gone (struct tty *tp)
 
static int tty_drop_ctty (struct tty *tp, struct proc *p)
 
static void tty_to_xtty (struct tty *tp, struct xtty *xt)
 
static int sysctl_kern_ttys (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_kern, OID_AUTO, ttys, CTLTYPE_OPAQUE|CTLFLAG_RD|CTLFLAG_MPSAFE, 0, 0, sysctl_kern_ttys, "S,xtty", "List of TTYs")
 
int tty_makedevf (struct tty *tp, struct ucred *cred, int flags, const char *fmt,...)
 
void tty_signal_sessleader (struct tty *tp, int sig)
 
void tty_signal_pgrp (struct tty *tp, int sig)
 
void tty_wakeup (struct tty *tp, int flags)
 
int tty_wait (struct tty *tp, struct cv *cv)
 
int tty_timedwait (struct tty *tp, struct cv *cv, int hz)
 
void tty_flush (struct tty *tp, int flags)
 
void tty_set_winsize (struct tty *tp, const struct winsize *wsz)
 
static int tty_generic_ioctl (struct tty *tp, u_long cmd, void *data, int fflag, struct thread *td)
 
int tty_ioctl (struct tty *tp, u_long cmd, void *data, int fflag, struct thread *td)
 
dev_t tty_udev (struct tty *tp)
 
int tty_checkoutq (struct tty *tp)
 
void tty_hiwat_in_block (struct tty *tp)
 
void tty_hiwat_in_unblock (struct tty *tp)
 
static int ttyhook_defrint (struct tty *tp, char c, int flags)
 
int ttyhook_register (struct tty **rtp, struct proc *p, int fd, struct ttyhook *th, void *softc)
 
void ttyhook_unregister (struct tty *tp)
 
static int ttyconsdev_open (struct cdev *dev, int oflags, int devtype, struct thread *td)
 
static int ttyconsdev_write (struct cdev *dev, struct uio *uio, int ioflag)
 
static void ttyconsdev_init (void *unused __unused)
 
 SYSINIT (tty, SI_SUB_DRIVERS, SI_ORDER_FIRST, ttyconsdev_init, NULL)
 
void ttyconsdev_select (const char *name)
 

Variables

static struct filterops tty_kqops_read
 
static struct filterops tty_kqops_write
 
static struct cdevsw ttydev_cdevsw
 
static struct cdevsw ttyil_cdevsw
 
static struct cdevsw ttyconsdev_cdevsw
 

Macro Definition Documentation

◆ PATCH_FUNC

#define PATCH_FUNC (   x)
Value:
do { \
if (tsw->tsw_ ## x == NULL) \
tsw->tsw_ ## x = ttydevsw_def ## x; \
} while (0)

◆ TF_ACTIVITY

#define TF_ACTIVITY   (TF_GONE|TF_OPENED|TF_HOOK|TF_OPENCLOSE)

◆ TTY_CALLOUT

#define TTY_CALLOUT (   tp,
 
)    (dev2unit(d) & TTYUNIT_CALLOUT)

◆ TTY_PRBUF_SIZE

#define TTY_PRBUF_SIZE   256

◆ TTYBUF_MAX

#define TTYBUF_MAX   65536

◆ TTYDEFCHARS

#define TTYDEFCHARS

Definition at line 64 of file tty.c.

◆ TTYSUP_CFLAG

#define TTYSUP_CFLAG
Value:
(CIGNORE|CSIZE|CSTOPB|CREAD|PARENB|PARODD|\
HUPCL|CLOCAL|CCTS_OFLOW|CRTS_IFLOW|CDTR_IFLOW|\
CDSR_OFLOW|CCAR_OFLOW|CNO_RTSDTR)

◆ TTYSUP_IFLAG

#define TTYSUP_IFLAG
Value:
(IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|ISTRIP|\
INLCR|IGNCR|ICRNL|IXON|IXOFF|IXANY|IMAXBEL)

◆ TTYSUP_LFLAG

#define TTYSUP_LFLAG
Value:
(ECHOKE|ECHOE|ECHOK|ECHO|ECHONL|ECHOPRT|\
ECHOCTL|ISIG|ICANON|ALTWERASE|IEXTEN|TOSTOP|\
FLUSHO|NOKERNINFO|NOFLSH)

◆ TTYSUP_OFLAG

#define TTYSUP_OFLAG   (OPOST|ONLCR|TAB3|ONOEOT|OCRNL|ONOCR|ONLRET)

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_TTY  ,
"tty"  ,
"tty device  
)
static

◆ sysctl_kern_ttys()

static int sysctl_kern_ttys ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 1309 of file tty.c.

References free(), malloc(), and tty_to_xtty().

Here is the call graph for this function:

◆ SYSCTL_PROC()

SYSCTL_PROC ( _kern  ,
OID_AUTO  ,
ttys  ,
CTLTYPE_OPAQUE|CTLFLAG_RD|  CTLFLAG_MPSAFE,
,
,
sysctl_kern_ttys  ,
S,
xtty"  ,
"List of TTYs"   
)

◆ SYSINIT()

SYSINIT ( tty  ,
SI_SUB_DRIVERS  ,
SI_ORDER_FIRST  ,
ttyconsdev_init  ,
NULL   
)

◆ TAILQ_HEAD()

static TAILQ_HEAD ( tty  )
static

Definition at line 78 of file tty.c.

◆ tty_alloc()

struct tty * tty_alloc ( struct ttydevsw *  tsw,
void *  sc 
)

Definition at line 1049 of file tty.c.

References tty_alloc_mutex().

Referenced by pts_alloc(), pts_alloc_external(), and terminal_maketty().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_alloc_mutex()

struct tty * tty_alloc_mutex ( struct ttydevsw *  tsw,
void *  sc,
struct mtx mutex 
)

Definition at line 1056 of file tty.c.

References busy, cv_init(), free(), knlist_init_mtx(), malloc(), PATCH_FUNC, tty_init_termios(), and TTY_PRBUF_SIZE.

Referenced by tty_alloc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_checkoutq()

int tty_checkoutq ( struct tty *  tp)

Definition at line 2000 of file tty.c.

Referenced by tty_info(), and vtprintf().

Here is the caller graph for this function:

◆ tty_dealloc()

static void tty_dealloc ( void *  arg)
static

Definition at line 1110 of file tty.c.

References cv_destroy(), free(), knlist_destroy(), seldrain(), ttyinq_free(), and ttyoutq_free().

Referenced by tty_rel_free().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_drain()

static int tty_drain ( struct tty *  tp,
int  leaving 
)
static

Definition at line 153 of file tty.c.

References hz, and tty_timedwait().

Referenced by tty_generic_ioctl(), and ttydev_leave().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_drop_ctty()

static int tty_drop_ctty ( struct tty *  tp,
struct proc *  p 
)
static

Definition at line 1219 of file tty.c.

References proctree_lock.

Referenced by tty_generic_ioctl().

Here is the caller graph for this function:

◆ tty_flush()

void tty_flush ( struct tty *  tp,
int  flags 
)

Definition at line 1593 of file tty.c.

References flags, tty_hiwat_in_unblock(), tty_wakeup(), ttyinq_flush(), and ttyoutq_flush().

Referenced by tty_generic_ioctl(), ttydev_close(), ttydisc_close(), ttydisc_modem(), and ttydisc_rint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_generic_ioctl()

static int tty_generic_ioctl ( struct tty *  tp,
u_long  cmd,
void *  data,
int  fflag,
struct thread *  td 
)
static

◆ tty_hiwat_in_block()

void tty_hiwat_in_block ( struct tty *  tp)

Definition at line 2008 of file tty.c.

References ttyoutq_write_nofrag().

Referenced by ttydisc_rint(), and ttydisc_rint_bypass().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_hiwat_in_unblock()

void tty_hiwat_in_unblock ( struct tty *  tp)

Definition at line 2028 of file tty.c.

References ttyoutq_write_nofrag().

Referenced by tty_flush(), and ttydisc_read().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_init_console()

void tty_init_console ( struct tty *  tp,
speed_t  s 
)

Definition at line 920 of file tty.c.

◆ tty_init_termios()

static void tty_init_termios ( struct tty *  tp)
static

Definition at line 904 of file tty.c.

Referenced by tty_alloc_mutex().

Here is the caller graph for this function:

◆ tty_ioctl()

int tty_ioctl ( struct tty *  tp,
u_long  cmd,
void *  data,
int  fflag,
struct thread *  td 
)

Definition at line 1973 of file tty.c.

References data, and tty_generic_ioctl().

Referenced by ptsdev_ioctl(), tty_ioctl_compat(), and ttydev_ioctl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_is_ctty()

static __inline int tty_is_ctty ( struct tty *  tp,
struct proc *  p 
)
static

Definition at line 414 of file tty.c.

Referenced by tty_generic_ioctl(), and tty_wait_background().

Here is the caller graph for this function:

◆ tty_kqops_read_detach()

static void tty_kqops_read_detach ( struct knote kn)
static

Definition at line 708 of file tty.c.

References knlist_remove().

Here is the call graph for this function:

◆ tty_kqops_read_event()

static int tty_kqops_read_event ( struct knote kn,
long hint  __unused 
)
static

Definition at line 716 of file tty.c.

◆ tty_kqops_write_detach()

static void tty_kqops_write_detach ( struct knote kn)
static

Definition at line 732 of file tty.c.

References knlist_remove().

Here is the call graph for this function:

◆ tty_kqops_write_event()

static int tty_kqops_write_event ( struct knote kn,
long hint  __unused 
)
static

Definition at line 740 of file tty.c.

◆ tty_makedevf()

int tty_makedevf ( struct tty *  tp,
struct ucred *  cred,
int  flags,
const char *  fmt,
  ... 
)

Definition at line 1347 of file tty.c.

References clock, destroy_dev(), dev_depends(), flags, make_dev_s(), mode, name, ttydev_cdevsw, ttyil_cdevsw, and vsnrprintf().

Here is the call graph for this function:

◆ tty_rel_free()

static void tty_rel_free ( struct tty *  tp)
static

Definition at line 1141 of file tty.c.

References destroy_dev_sched_cb(), funsetown(), TF_ACTIVITY, and tty_dealloc().

Referenced by tty_rel_gone(), tty_rel_sess(), ttydev_leave(), and ttyhook_unregister().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_rel_gone()

void tty_rel_gone ( struct tty *  tp)

Definition at line 1200 of file tty.c.

References tty_rel_free(), tty_wakeup(), and ttydisc_modem().

Referenced by ptsdev_close().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_rel_pgrp()

void tty_rel_pgrp ( struct tty *  tp,
struct pgrp *  pg 
)

Definition at line 1172 of file tty.c.

Referenced by pgdelete().

Here is the caller graph for this function:

◆ tty_rel_sess()

void tty_rel_sess ( struct tty *  tp,
struct session *  sess 
)

Definition at line 1185 of file tty.c.

References tty_rel_free().

Referenced by sess_release().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_set_winsize()

void tty_set_winsize ( struct tty *  tp,
const struct winsize *  wsz 
)

Definition at line 1617 of file tty.c.

References tty_signal_pgrp().

Referenced by terminal_sync_ttysize(), and tty_generic_ioctl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_signal_pgrp()

void tty_signal_pgrp ( struct tty *  tp,
int  sig 
)

Definition at line 1506 of file tty.c.

References pgsignal(), and tty_info().

Referenced by killjobc(), ptsdev_ioctl(), tty_set_winsize(), and ttydisc_rint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_signal_sessleader()

void tty_signal_sessleader ( struct tty *  tp,
int  sig 
)

Definition at line 1479 of file tty.c.

References kern_psignal().

Referenced by ttydisc_modem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_timedwait()

int tty_timedwait ( struct tty *  tp,
struct cv *  cv,
int  hz 
)

Definition at line 1571 of file tty.c.

References hz.

Referenced by tty_drain(), and ttydisc_read_raw_read_timer().

Here is the caller graph for this function:

◆ tty_to_xtty()

static void tty_to_xtty ( struct tty *  tp,
struct xtty *  xt 
)
static

Definition at line 1288 of file tty.c.

Referenced by sysctl_kern_ttys().

Here is the caller graph for this function:

◆ tty_udev()

dev_t tty_udev ( struct tty *  tp)

Definition at line 1990 of file tty.c.

Referenced by acct_process(), fill_kinfo_proc_pgrp(), ptsdev_fill_kinfo(), ptsdev_stat(), and sysctl_kern_proc_iterate().

Here is the caller graph for this function:

◆ tty_wait()

int tty_wait ( struct tty *  tp,
struct cv *  cv 
)

Definition at line 1549 of file tty.c.

Referenced by tty_wait_background(), ttydev_open(), ttydev_write(), ttydisc_read_canonical(), ttydisc_read_raw_interbyte_timer(), ttydisc_read_raw_no_timer(), and ttydisc_write().

Here is the caller graph for this function:

◆ tty_wait_background()

int tty_wait_background ( struct tty *  tp,
struct thread *  td,
int  sig 
)

Definition at line 423 of file tty.c.

References pgsignal(), tty_is_ctty(), and tty_wait().

Referenced by ttydev_ioctl(), ttydev_write(), ttydisc_read_canonical(), ttydisc_read_raw_interbyte_timer(), ttydisc_read_raw_no_timer(), and ttydisc_read_raw_read_timer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tty_wakeup()

void tty_wakeup ( struct tty *  tp,
int  flags 
)

Definition at line 1530 of file tty.c.

References flags, pgsigio(), and selwakeup().

Referenced by tty_flush(), tty_generic_ioctl(), tty_rel_gone(), ttydev_close(), ttydisc_rint_done(), and ttydisc_wakeup_watermark().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ttyconsdev_init()

static void ttyconsdev_init ( void *unused  __unused)
static

Definition at line 2226 of file tty.c.

References make_dev_credf(), and ttyconsdev_cdevsw.

Here is the call graph for this function:

◆ ttyconsdev_open()

static int ttyconsdev_open ( struct cdev *  dev,
int  oflags,
int  devtype,
struct thread *  td 
)
static

Definition at line 2172 of file tty.c.

References ttydev_open().

Here is the call graph for this function:

◆ ttyconsdev_select()

void ttyconsdev_select ( const char *  name)

Definition at line 2236 of file tty.c.

References name.

Referenced by cnadd(), cnremove(), and cnselect().

Here is the caller graph for this function:

◆ ttyconsdev_write()

static int ttyconsdev_write ( struct cdev *  dev,
struct uio *  uio,
int  ioflag 
)
static

Definition at line 2198 of file tty.c.

References log_console(), and ttydev_write().

Here is the call graph for this function:

◆ ttydev_close()

static int ttydev_close ( struct cdev *  dev,
int  fflag,
int devtype  __unused,
struct thread *td  __unused 
)
static

Definition at line 373 of file tty.c.

References tty_flush(), tty_wakeup(), and ttydev_leave().

Here is the call graph for this function:

◆ ttydev_enter()

static __inline int ttydev_enter ( struct tty *  tp)
static

Definition at line 215 of file tty.c.

Referenced by ttydev_ioctl(), ttydev_kqfilter(), ttydev_mmap(), ttydev_poll(), ttydev_read(), and ttydev_write().

Here is the caller graph for this function:

◆ ttydev_ioctl()

static int ttydev_ioctl ( struct cdev *  dev,
u_long  cmd,
caddr_t  data,
int  fflag,
struct thread *  td 
)
static

Definition at line 563 of file tty.c.

References data, TTY_CALLOUT, tty_ioctl(), tty_wait_background(), and ttydev_enter().

Here is the call graph for this function:

◆ ttydev_kqfilter()

static int ttydev_kqfilter ( struct cdev *  dev,
struct knote kn 
)
static

Definition at line 768 of file tty.c.

References knlist_add(), tty_kqops_read, tty_kqops_write, and ttydev_enter().

Here is the call graph for this function:

◆ ttydev_leave()

static void ttydev_leave ( struct tty *  tp)
static

Definition at line 230 of file tty.c.

References constty_clear(), tty_drain(), tty_rel_free(), ttydisc_close(), ttyinq_free(), and ttyoutq_free().

Referenced by ttydev_close(), and ttydev_open().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ttydev_mmap()

static int ttydev_mmap ( struct cdev *  dev,
vm_ooffset_t  offset,
vm_paddr_t *  paddr,
int  nprot,
vm_memattr_t *  memattr 
)
static

Definition at line 686 of file tty.c.

References ttydev_enter().

Here is the call graph for this function:

◆ ttydev_open()

static int ttydev_open ( struct cdev *  dev,
int  oflags,
int devtype  __unused,
struct thread *  td 
)
static

Definition at line 273 of file tty.c.

References priv_check(), TTY_CALLOUT, tty_wait(), ttydev_leave(), and ttydisc_open().

Referenced by ttyconsdev_open().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ttydev_poll()

static int ttydev_poll ( struct cdev *  dev,
int  events,
struct thread *  td 
)
static

Definition at line 649 of file tty.c.

References selrecord(), and ttydev_enter().

Here is the call graph for this function:

◆ ttydev_read()

static int ttydev_read ( struct cdev *  dev,
struct uio *  uio,
int  ioflag 
)
static

Definition at line 503 of file tty.c.

References ttydev_enter(), and ttydisc_read().

Here is the call graph for this function:

◆ ttydev_write()

static int ttydev_write ( struct cdev *  dev,
struct uio *  uio,
int  ioflag 
)
static

Definition at line 524 of file tty.c.

References cv_signal(), tty_wait(), tty_wait_background(), ttydev_enter(), and ttydisc_write().

Referenced by ttyconsdev_write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ttydevsw_defbusy()

static bool ttydevsw_defbusy ( struct tty *tp  __unused)
static

Definition at line 1036 of file tty.c.

◆ ttydevsw_defcioctl()

static int ttydevsw_defcioctl ( struct tty *tp  __unused,
int unit  __unused,
u_long cmd  __unused,
caddr_t data  __unused,
struct thread *td  __unused 
)
static

Definition at line 975 of file tty.c.

◆ ttydevsw_defclose()

static void ttydevsw_defclose ( struct tty *tp  __unused)
static

Definition at line 948 of file tty.c.

◆ ttydevsw_deffree()

static void ttydevsw_deffree ( void *softc  __unused)
static

Definition at line 1029 of file tty.c.

References panic().

Here is the call graph for this function:

◆ ttydevsw_definwakeup()

static void ttydevsw_definwakeup ( struct tty *tp  __unused)
static

Definition at line 961 of file tty.c.

◆ ttydevsw_defioctl()

static int ttydevsw_defioctl ( struct tty *tp  __unused,
u_long cmd  __unused,
caddr_t data  __unused,
struct thread *td  __unused 
)
static

Definition at line 967 of file tty.c.

◆ ttydevsw_defmmap()

static int ttydevsw_defmmap ( struct tty *tp  __unused,
vm_ooffset_t offset  __unused,
vm_paddr_t *paddr  __unused,
int nprot  __unused,
vm_memattr_t *memattr  __unused 
)
static

Definition at line 1014 of file tty.c.

◆ ttydevsw_defmodem()

static int ttydevsw_defmodem ( struct tty *tp  __unused,
int sigon  __unused,
int sigoff  __unused 
)
static

Definition at line 1005 of file tty.c.

◆ ttydevsw_defopen()

static int ttydevsw_defopen ( struct tty *tp  __unused)
static

Definition at line 941 of file tty.c.

◆ ttydevsw_defoutwakeup()

static void ttydevsw_defoutwakeup ( struct tty *tp  __unused)
static

Definition at line 954 of file tty.c.

References panic().

Here is the call graph for this function:

◆ ttydevsw_defparam()

static int ttydevsw_defparam ( struct tty *tp  __unused,
struct termios *  t 
)
static

Definition at line 983 of file tty.c.

◆ ttydevsw_defpktnotify()

static void ttydevsw_defpktnotify ( struct tty *tp  __unused,
char event  __unused 
)
static

Definition at line 1023 of file tty.c.

◆ ttyhook_defrint()

static int ttyhook_defrint ( struct tty *  tp,
char  c,
int  flags 
)
static

Definition at line 2055 of file tty.c.

Referenced by ttyhook_register().

Here is the caller graph for this function:

◆ ttyhook_register()

int ttyhook_register ( struct tty **  rtp,
struct proc *  p,
int  fd,
struct ttyhook *  th,
void *  softc 
)

Definition at line 2065 of file tty.c.

References badfileops, dev_relthread(), devvn_refthread(), fd, fget_cap_noref(), ttydev_cdevsw, ttydisc_optimize(), and ttyhook_defrint().

Here is the call graph for this function:

◆ ttyhook_unregister()

void ttyhook_unregister ( struct tty *  tp)

Definition at line 2150 of file tty.c.

References tty_rel_free(), and ttydisc_optimize().

Here is the call graph for this function:

◆ ttyil_close()

static int ttyil_close ( struct cdev *dev  __unused,
int flag  __unused,
int mode  __unused,
struct thread *td  __unused 
)
static

Definition at line 833 of file tty.c.

◆ ttyil_ioctl()

static int ttyil_ioctl ( struct cdev *  dev,
u_long  cmd,
caddr_t  data,
int  fflag,
struct thread *  td 
)
static

Definition at line 849 of file tty.c.

References data, and priv_check().

Here is the call graph for this function:

◆ ttyil_open()

static int ttyil_open ( struct cdev *  dev,
int oflags  __unused,
int devtype  __unused,
struct thread *  td 
)
static

Definition at line 816 of file tty.c.

◆ ttyil_rdwr()

static int ttyil_rdwr ( struct cdev *dev  __unused,
struct uio *uio  __unused,
int ioflag  __unused 
)
static

Definition at line 841 of file tty.c.

Variable Documentation

◆ tty_kqops_read

struct filterops tty_kqops_read
static
Initial value:
= {
.f_isfd = 1,
.f_detach = tty_kqops_read_detach,
}
static void tty_kqops_read_detach(struct knote *kn)
Definition: tty.c:708
static int tty_kqops_read_event(struct knote *kn, long hint __unused)
Definition: tty.c:716

Definition at line 755 of file tty.c.

Referenced by ttydev_kqfilter().

◆ tty_kqops_write

struct filterops tty_kqops_write
static
Initial value:
= {
.f_isfd = 1,
}
static int tty_kqops_write_event(struct knote *kn, long hint __unused)
Definition: tty.c:740
static void tty_kqops_write_detach(struct knote *kn)
Definition: tty.c:732

Definition at line 761 of file tty.c.

Referenced by ttydev_kqfilter().

◆ ttyconsdev_cdevsw

struct cdevsw ttyconsdev_cdevsw
static
Initial value:
= {
.d_version = D_VERSION,
.d_open = ttyconsdev_open,
.d_close = ttydev_close,
.d_read = ttydev_read,
.d_write = ttyconsdev_write,
.d_ioctl = ttydev_ioctl,
.d_kqfilter = ttydev_kqfilter,
.d_poll = ttydev_poll,
.d_mmap = ttydev_mmap,
.d_name = "ttyconsdev",
.d_flags = D_TTY,
}
static int ttydev_close(struct cdev *dev, int fflag, int devtype __unused, struct thread *td __unused)
Definition: tty.c:373
static int ttyconsdev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
Definition: tty.c:2172
static int ttyconsdev_write(struct cdev *dev, struct uio *uio, int ioflag)
Definition: tty.c:2198
static int ttydev_poll(struct cdev *dev, int events, struct thread *td)
Definition: tty.c:649
static int ttydev_read(struct cdev *dev, struct uio *uio, int ioflag)
Definition: tty.c:503
static int ttydev_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr)
Definition: tty.c:686
static int ttydev_kqfilter(struct cdev *dev, struct knote *kn)
Definition: tty.c:768
static int ttydev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
Definition: tty.c:563

Definition at line 2211 of file tty.c.

Referenced by ttyconsdev_init().

◆ ttydev_cdevsw

struct cdevsw ttydev_cdevsw
static
Initial value:
= {
.d_version = D_VERSION,
.d_open = ttydev_open,
.d_close = ttydev_close,
.d_read = ttydev_read,
.d_write = ttydev_write,
.d_ioctl = ttydev_ioctl,
.d_kqfilter = ttydev_kqfilter,
.d_poll = ttydev_poll,
.d_mmap = ttydev_mmap,
.d_name = "ttydev",
.d_flags = D_TTY,
}
static int ttydev_open(struct cdev *dev, int oflags, int devtype __unused, struct thread *td)
Definition: tty.c:273
static int ttydev_write(struct cdev *dev, struct uio *uio, int ioflag)
Definition: tty.c:524

Definition at line 797 of file tty.c.

Referenced by tty_makedevf(), and ttyhook_register().

◆ ttyil_cdevsw

struct cdevsw ttyil_cdevsw
static
Initial value:
= {
.d_version = D_VERSION,
.d_open = ttyil_open,
.d_close = ttyil_close,
.d_read = ttyil_rdwr,
.d_write = ttyil_rdwr,
.d_ioctl = ttyil_ioctl,
.d_name = "ttyil",
.d_flags = D_TTY,
}
static int ttyil_close(struct cdev *dev __unused, int flag __unused, int mode __unused, struct thread *td __unused)
Definition: tty.c:833
static int ttyil_rdwr(struct cdev *dev __unused, struct uio *uio __unused, int ioflag __unused)
Definition: tty.c:841
static int ttyil_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
Definition: tty.c:849
static int ttyil_open(struct cdev *dev, int oflags __unused, int devtype __unused, struct thread *td)
Definition: tty.c:816

Definition at line 892 of file tty.c.

Referenced by tty_makedevf().