diff options
Diffstat (limited to 'cpukit/libcsupport/src/tcflush.c')
-rw-r--r-- | cpukit/libcsupport/src/tcflush.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/cpukit/libcsupport/src/tcflush.c b/cpukit/libcsupport/src/tcflush.c index eacae1c1f2..cd781cf5a0 100644 --- a/cpukit/libcsupport/src/tcflush.c +++ b/cpukit/libcsupport/src/tcflush.c @@ -13,11 +13,30 @@ #include "config.h" #endif +#include <sys/fcntl.h> #include <termios.h> #include <stdint.h> #include <sys/ioccom.h> +#include <rtems/libio.h> +#include <rtems/libio_.h> +#include <rtems/seterr.h> -int tcflush( int fd, int queue ) +int tcflush( int fd, int which ) { - return ioctl( fd, RTEMS_IO_TCFLUSH, (intptr_t) queue ); + int com; + + switch (which) { + case TCIFLUSH: + com = FREAD; + break; + case TCOFLUSH: + com = FWRITE; + break; + case TCIOFLUSH: + com = FREAD | FWRITE; + break; + default: + rtems_set_errno_and_return_minus_one( EINVAL ); + } + return ioctl( fd, TIOCFLUSH, &com ); } |