Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56313
b: refs/heads/master
c: c5c34d4
h: refs/heads/master
i:
  56311: 544f854
v: v3
  • Loading branch information
Paul Fulghum authored and Linus Torvalds committed May 12, 2007
1 parent a0b7226 commit 054b7d8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e3bf460f3eb86cdbc76725a0dac1f191e796676c
refs/heads/master: c5c34d4862e18ef07c1276d233507f540fb5a532
33 changes: 33 additions & 0 deletions trunk/drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,29 @@ static void tty_buffer_free(struct tty_struct *tty, struct tty_buffer *b)
}
}

/**
* tty_buffer_flush - flush full tty buffers
* @tty: tty to flush
*
* flush all the buffers containing receive data
*
* Locking: none
*/

static void tty_buffer_flush(struct tty_struct *tty)
{
struct tty_buffer *thead;
unsigned long flags;

spin_lock_irqsave(&tty->buf.lock, flags);
while((thead = tty->buf.head) != NULL) {
tty->buf.head = thead->next;
tty_buffer_free(tty, thead);
}
tty->buf.tail = NULL;
spin_unlock_irqrestore(&tty->buf.lock, flags);
}

/**
* tty_buffer_find - find a free tty buffer
* @tty: tty owning the buffer
Expand Down Expand Up @@ -1248,6 +1271,7 @@ void tty_ldisc_flush(struct tty_struct *tty)
ld->flush_buffer(tty);
tty_ldisc_deref(ld);
}
tty_buffer_flush(tty);
}

EXPORT_SYMBOL_GPL(tty_ldisc_flush);
Expand Down Expand Up @@ -3350,6 +3374,15 @@ int tty_ioctl(struct inode * inode, struct file * file,
case TIOCMBIC:
case TIOCMBIS:
return tty_tiocmset(tty, file, cmd, p);
case TCFLSH:
switch (arg) {
case TCIFLUSH:
case TCIOFLUSH:
/* flush tty buffer and allow ldisc to process ioctl */
tty_buffer_flush(tty);
break;
}
break;
}
if (tty->driver->ioctl) {
retval = (tty->driver->ioctl)(tty, file, cmd, arg);
Expand Down

0 comments on commit 054b7d8

Please sign in to comment.