Lines Matching refs:tty

65  *	@(#)tty.c	8.8 (Berkeley) 1/21/94
118 * Debugging assertions for tty locks
133 static int ttnread(struct tty *tp);
134 static void ttyecho(int c, struct tty *tp);
135 static int ttyoutput(int c, struct tty *tp);
136 static void ttypend(struct tty *tp);
137 static void ttyretype(struct tty *tp);
138 static void ttyrub(int c, struct tty *tp);
139 static void ttyrubo(struct tty *tp, int count);
140 static void ttystop(struct tty *tp, int rw);
141 static void ttyunblock(struct tty *tp);
142 static int ttywflush(struct tty *tp);
145 static void ttyhold(struct tty *tp);
146 static void ttydeallocate(struct tty *tp);
148 static int isctty(proc_t p, struct tty *tp);
149 static int isctty_sp(proc_t p, struct tty *tp, struct session *sessp);
273 * Initialize the tty line discipline subsystem.
279 * Locks: No ttys can be allocated and no tty locks can be used
283 * lock group, and loc atribute for subsequent per-tty locks.
291 tty_lck_grp = lck_grp_alloc_init("tty", tty_lck_grp_attr);
299 * Lock the requested tty structure.
301 * Parameters: tp The tty we want to lock
308 tty_lock(struct tty *tp)
318 * Unlock the requested tty structure.
320 * Parameters: tp The tty we want to unlock
327 tty_unlock(struct tty *tp)
337 * Initial open of tty, or (re)entry to standard tty line discipline.
342 ttyopen(dev_t device, struct tty *tp)
347 struct tty *oldtp;
364 * First tty open affter setsid() call makes this tty its controlling
365 * tty, if the tty does not already have a session associated with it.
368 sessp->s_ttyvp == NULL && /* but has no controlling tty */
369 tp->t_session == NULL ) { /* and tty not controlling */
417 * Handle close() on a tty line: flush and set to initial state,
419 * can detect recycling of the tty.
427 ttyclose(struct tty *tp)
439 * Closing current console tty; disable printing of console
486 * Process input of a single character received on a tty.
489 * tp The tty on which it was received
496 ttyinput(int c, struct tty *tp)
867 * Output a single character on a tty, doing output processing
871 * tp The tty on which to output on the tty
881 ttyoutput(int c, struct tty *tp)
982 ttioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, proc_t p)
997 * Ioctls for all tty devices.
1015 * ENOTTY TIOCGPGRP on a non-controlling tty
1020 * tty
1052 ttioctl_locked(struct tty *tp, u_long cmd, caddr_t data, int flag, proc_t p)
1058 struct tty *oldtp;
1136 case TIOCEXCL: /* set exclusive use of tty */
1203 case TIOCGPGRP: /* get pgrp of tty */
1215 case TIOCNXCL: /* reset exclusive use of tty */
1386 case TIOCSCTTY: /* become controlling tty */
1431 case TIOCSPGRP: { /* set pgrp of tty */
1510 ttyselect(struct tty *tp, int rw, void *wql, proc_t p)
1560 struct tty *tp = cdevsw[major(dev)].d_ttys[minor(dev)];
1574 ttnread(struct tty *tp)
1611 ttywait(struct tty *tp)
1646 ttystop(struct tty *tp, int rw)
1659 ttywflush(struct tty *tp)
1671 * Flush tty read and/or write queues, notifying anyone waiting.
1676 ttyflush(struct tty *tp, int rw)
1761 ttyblock(struct tty *tp)
1781 ttyunblock(struct tty *tp)
1796 * Start tty output
1798 * Parameters: tp tty on which to start output
1810 ttstart(struct tty *tp)
1829 ttylclose(struct tty *tp, int flag)
1843 * Handle modem control transition on a tty.
1850 ttymodem(struct tty *tp, int flag)
1910 ttypend(struct tty *tp)
1931 * Process a read call on a tty device.
1936 ttread(struct tty *tp, struct uio *uio, int flag)
2237 * lose messages due to normal flow control, but don't let the tty run amok.
2246 ttycheckoutq(struct tty *tp, int wait)
2276 * Process a write call on a tty device.
2281 ttwrite(struct tty *tp, struct uio *uio, int flag)
2484 ttyrub(int c, struct tty *tp)
2570 ttyrubo(struct tty *tp, int count)
2590 ttyretype(struct tty *tp)
2625 ttyecho(int c, struct tty *tp)
2650 * Wake up any readers on a tty.
2655 ttwakeup(struct tty *tp)
2663 * XXX: Callers may not revalidate it the tty is closed
2681 * Wake up any writers on a tty.
2686 ttwwakeup(struct tty *tp)
2712 * directly access struct tty.
2725 * Set tty hi and low water marks.
2733 ttsetwater(struct tty *tp)
2766 ttyinfo_locked(struct tty *tp)
2901 * tty_lock(tp) for p2's tty, for which p2 is the foreground
2958 * Output char to tty; console putchar style.
2965 tputchar(int c, struct tty *tp)
3004 * Sleep on chan, returning ERESTART if tty changed while we napped and
3006 * the tty is revoked, restarting a pending call will redo validation done
3010 ttysleep(struct tty *tp, void *chan, int pri, const char *wmesg, int timo)
3027 * Allocate a tty structure and its associated buffers.
3031 * Returns: !NULL Address of new struct tty
3034 * Locks: The tty_lock() of the returned tty is not held when it
3037 struct tty *
3040 struct tty *tp;
3042 MALLOC(tp, struct tty *, sizeof(struct tty), M_TTYS, M_WAITOK|M_ZERO);
3058 * Increment the reference count on a tty.
3061 ttyhold(struct tty *tp)
3068 * Drops a reference count on a tty structure; if the reference count reaches
3072 ttyfree(struct tty *tp)
3081 panic("%s: freeing free tty %p", __func__, tp);
3087 * Deallocate a tty structure and its buffers.
3093 ttydeallocate(struct tty *tp)
3099 panic("knotes hooked into a tty when the tty is freed.\n");
3115 isbackground(proc_t p, struct tty *tp)
3123 isctty(proc_t p, struct tty *tp)
3135 isctty_sp(proc_t p, struct tty *tp, struct session *sessp)