source: rtems/cpukit/libcsupport/src/tcsetattr.c @ 1c6926c1

Last change on this file since 1c6926c1 was 1c6926c1, checked in by Kevin Kirspel <kevin-kirspel@…>, on Mar 21, 2017 at 7:39:48 PM

termios: Synchronize with latest FreeBSD headers

Adding modified FreeBSD headers to synchronize RTEMS termios with
FreeBSD. Modify termios to support dedicated input and output baud for
termios structure. Updated BSPs to use dedicated input and output baud
in termios structure. Updated tools to use dedicated input and output
baud in termios structure. Updated termios testsuites to use dedicated
input and output baud in termios structure.

Close #2897.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Get and Set State
5 *  @ingroup libcsupport
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-1999.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems.h>
22#if defined(RTEMS_NEWLIB)
23
24#include <sys/types.h>
25#include <sys/stat.h>
26#include <errno.h>
27#include <termios.h>
28/* #include <sys/ioctl.h> */
29
30#include <rtems/libio.h>
31#include <rtems/libio_.h>
32#include <rtems/seterr.h>
33
34/**
35 *  POSIX 1003.1b 7.2.1 - Get and Set State
36 */
37int tcsetattr(
38  int                   fd,
39  int                   opt,
40  const struct termios *tp
41)
42{
43  struct termios localterm;
44
45  if (opt & TCSASOFT) {
46    localterm = *tp;
47    localterm.c_cflag |= CIGNORE;
48    tp = &localterm;
49  }
50
51  switch (opt & ~TCSASOFT) {
52
53  case TCSANOW:
54    return ioctl( fd, TIOCSETA, tp );
55
56  case TCSADRAIN:
57    return ioctl( fd, TIOCSETAW, tp );
58
59  case TCSAFLUSH:
60    return ioctl( fd, TIOCSETAF, tp );
61
62  default:
63    rtems_set_errno_and_return_minus_one( EINVAL );
64  }
65}
66#endif
Note: See TracBrowser for help on using the repository browser.