summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/tcflush.c
blob: a19fe11d1e9be481171fe50bf91f1b0a0abbfd70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <unistd.h>
#include <termios.h>
#include <sys/ioctl.h>

#include <asm/errno.h>

extern int errno;

/* Flush pending data on FD.  */
int tcflush(int fd, int queue_selector)
{
	switch (queue_selector) {
	case TCIFLUSH:
		return ioctl(fd, TCFLSH, 0);
	case TCOFLUSH:
		return ioctl(fd, TCFLSH, 1);
	case TCIOFLUSH:
		return ioctl(fd, TCFLSH, 2);
	default:
		errno = EINVAL;
		return -1;
	}
}