source:
rtems/cpukit/libcsupport/src/tcflush.c
@
1c6926c1
Last change on this file since 1c6926c1 was 1c6926c1, checked in by Kevin Kirspel <kevin-kirspel@…>, on 03/21/17 at 19:39:48 | |
---|---|
|
|
File size: 850 bytes |
Rev | Line | |
---|---|---|
[3cad2919] | 1 | /* |
2 | * tcflush() - POSIX 1003.1b 7.2.2 - Line Control Functions | |
3 | * | |
[fab27e47] | 4 | * COPYRIGHT (c) 1989-2010. |
[3cad2919] | 5 | * On-Line Applications Research Corporation (OAR). |
6 | * | |
7 | * The license and distribution terms for this file may be | |
8 | * found in the file LICENSE in this distribution or at | |
[c499856] | 9 | * http://www.rtems.org/license/LICENSE. |
[3cad2919] | 10 | */ |
11 | ||
[9c49db4] | 12 | #if HAVE_CONFIG_H |
[b0da5796] | 13 | #include "config.h" |
[9c49db4] | 14 | #endif |
15 | ||
[1c6926c1] | 16 | #include <sys/fcntl.h> |
[3cad2919] | 17 | #include <termios.h> |
[b0da5796] | 18 | #include <stdint.h> |
19 | #include <sys/ioccom.h> | |
[1c6926c1] | 20 | #include <rtems/libio.h> |
21 | #include <rtems/libio_.h> | |
22 | #include <rtems/seterr.h> | |
[3cad2919] | 23 | |
[1c6926c1] | 24 | int tcflush( int fd, int which ) |
[3cad2919] | 25 | { |
[1c6926c1] | 26 | int com; |
27 | ||
28 | switch (which) { | |
29 | case TCIFLUSH: | |
30 | com = FREAD; | |
31 | break; | |
32 | case TCOFLUSH: | |
33 | com = FWRITE; | |
34 | break; | |
35 | case TCIOFLUSH: | |
36 | com = FREAD | FWRITE; | |
37 | break; | |
38 | default: | |
39 | rtems_set_errno_and_return_minus_one( EINVAL ); | |
40 | } | |
41 | return ioctl( fd, TIOCFLUSH, &com ); | |
[3cad2919] | 42 | } |
Note: See TracBrowser
for help on using the repository browser.