Back to index

glibc  2.9
Defines | Functions
tcsetattr.c File Reference
#include <errno.h>
#include <string.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sysdep.h>
#include <kernel_termios.h>

Go to the source code of this file.

Defines

#define IBAUD0   020000000000

Functions

int tcsetattr (int fd, int optional_actions, const struct termios *termios_p)

Define Documentation

#define IBAUD0   020000000000

Definition at line 40 of file tcsetattr.c.


Function Documentation

int tcsetattr ( int  fd,
int  optional_actions,
const struct termios termios_p 
)

Definition at line 45 of file tcsetattr.c.

{
  struct __kernel_termios k_termios;
  unsigned long int cmd;

  switch (optional_actions)
    {
    case TCSANOW:
      cmd = TCSETS;
      break;
    case TCSADRAIN:
      cmd = TCSETSW;
      break;
    case TCSAFLUSH:
      cmd = TCSETSF;
      break;
    default:
      __set_errno (EINVAL);
      return -1;
    }

  k_termios.c_iflag = termios_p->c_iflag & ~IBAUD0;
  k_termios.c_oflag = termios_p->c_oflag;
  k_termios.c_cflag = termios_p->c_cflag;
  k_termios.c_lflag = termios_p->c_lflag;
  k_termios.c_line = termios_p->c_line;
#if defined _HAVE_C_ISPEED && defined _HAVE_STRUCT_TERMIOS_C_ISPEED
  k_termios.c_ispeed = termios_p->c_ispeed;
#endif
#if defined _HAVE_C_OSPEED && defined _HAVE_STRUCT_TERMIOS_C_OSPEED
  k_termios.c_ospeed = termios_p->c_ospeed;
#endif
  memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
         __KERNEL_NCCS * sizeof (cc_t));

  return INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
}

Here is the call graph for this function: