diff options
Diffstat (limited to 'drivers/char/tty_ioctl.c')
| -rw-r--r-- | drivers/char/tty_ioctl.c | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index f19cf9d7792d..4ad47d321bd4 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
| @@ -36,6 +36,18 @@ | |||
| 36 | #define TERMIOS_WAIT 2 | 36 | #define TERMIOS_WAIT 2 |
| 37 | #define TERMIOS_TERMIO 4 | 37 | #define TERMIOS_TERMIO 4 |
| 38 | 38 | ||
| 39 | |||
| 40 | /** | ||
| 41 | * tty_wait_until_sent - wait for I/O to finish | ||
| 42 | * @tty: tty we are waiting for | ||
| 43 | * @timeout: how long we will wait | ||
| 44 | * | ||
| 45 | * Wait for characters pending in a tty driver to hit the wire, or | ||
| 46 | * for a timeout to occur (eg due to flow control) | ||
| 47 | * | ||
| 48 | * Locking: none | ||
| 49 | */ | ||
| 50 | |||
| 39 | void tty_wait_until_sent(struct tty_struct * tty, long timeout) | 51 | void tty_wait_until_sent(struct tty_struct * tty, long timeout) |
| 40 | { | 52 | { |
| 41 | DECLARE_WAITQUEUE(wait, current); | 53 | DECLARE_WAITQUEUE(wait, current); |
| @@ -94,6 +106,18 @@ static void unset_locked_termios(struct termios *termios, | |||
| 94 | old->c_cc[i] : termios->c_cc[i]; | 106 | old->c_cc[i] : termios->c_cc[i]; |
| 95 | } | 107 | } |
| 96 | 108 | ||
| 109 | /** | ||
| 110 | * change_termios - update termios values | ||
| 111 | * @tty: tty to update | ||
| 112 | * @new_termios: desired new value | ||
| 113 | * | ||
| 114 | * Perform updates to the termios values set on this terminal. There | ||
| 115 | * is a bit of layering violation here with n_tty in terms of the | ||
| 116 | * internal knowledge of this function. | ||
| 117 | * | ||
| 118 | * Locking: termios_sem | ||
| 119 | */ | ||
| 120 | |||
| 97 | static void change_termios(struct tty_struct * tty, struct termios * new_termios) | 121 | static void change_termios(struct tty_struct * tty, struct termios * new_termios) |
| 98 | { | 122 | { |
| 99 | int canon_change; | 123 | int canon_change; |
| @@ -155,6 +179,19 @@ static void change_termios(struct tty_struct * tty, struct termios * new_termios | |||
| 155 | up(&tty->termios_sem); | 179 | up(&tty->termios_sem); |
| 156 | } | 180 | } |
| 157 | 181 | ||
| 182 | /** | ||
| 183 | * set_termios - set termios values for a tty | ||
| 184 | * @tty: terminal device | ||
| 185 | * @arg: user data | ||
| 186 | * @opt: option information | ||
| 187 | * | ||
| 188 | * Helper function to prepare termios data and run neccessary other | ||
| 189 | * functions before using change_termios to do the actual changes. | ||
| 190 | * | ||
| 191 | * Locking: | ||
| 192 | * Called functions take ldisc and termios_sem locks | ||
| 193 | */ | ||
| 194 | |||
| 158 | static int set_termios(struct tty_struct * tty, void __user *arg, int opt) | 195 | static int set_termios(struct tty_struct * tty, void __user *arg, int opt) |
| 159 | { | 196 | { |
| 160 | struct termios tmp_termios; | 197 | struct termios tmp_termios; |
| @@ -284,6 +321,17 @@ static void set_sgflags(struct termios * termios, int flags) | |||
| 284 | } | 321 | } |
| 285 | } | 322 | } |
| 286 | 323 | ||
| 324 | /** | ||
| 325 | * set_sgttyb - set legacy terminal values | ||
| 326 | * @tty: tty structure | ||
| 327 | * @sgttyb: pointer to old style terminal structure | ||
| 328 | * | ||
| 329 | * Updates a terminal from the legacy BSD style terminal information | ||
| 330 | * structure. | ||
| 331 | * | ||
| 332 | * Locking: termios_sem | ||
| 333 | */ | ||
| 334 | |||
| 287 | static int set_sgttyb(struct tty_struct * tty, struct sgttyb __user * sgttyb) | 335 | static int set_sgttyb(struct tty_struct * tty, struct sgttyb __user * sgttyb) |
| 288 | { | 336 | { |
| 289 | int retval; | 337 | int retval; |
| @@ -369,9 +417,16 @@ static int set_ltchars(struct tty_struct * tty, struct ltchars __user * ltchars) | |||
| 369 | } | 417 | } |
| 370 | #endif | 418 | #endif |
| 371 | 419 | ||
| 372 | /* | 420 | /** |
| 373 | * Send a high priority character to the tty. | 421 | * send_prio_char - send priority character |
| 422 | * | ||
| 423 | * Send a high priority character to the tty even if stopped | ||
| 424 | * | ||
| 425 | * Locking: none | ||
| 426 | * | ||
| 427 | * FIXME: overlapping calls with start/stop tty lose state of tty | ||
| 374 | */ | 428 | */ |
| 429 | |||
| 375 | static void send_prio_char(struct tty_struct *tty, char ch) | 430 | static void send_prio_char(struct tty_struct *tty, char ch) |
| 376 | { | 431 | { |
| 377 | int was_stopped = tty->stopped; | 432 | int was_stopped = tty->stopped; |
