Back to index

glibc  2.9
Functions
speed.c File Reference
#include <stddef.h>
#include <errno.h>
#include <termios.h>

Go to the source code of this file.

Functions

speed_t cfgetospeed (struct termios *termios_p) const
speed_t cfgetispeed (struct termios *termios_p) const
int cfsetospeed (struct termios *termios_p, speed_t speed)
 libc_hidden_def (cfsetospeed)

Function Documentation

speed_t cfgetispeed ( struct termios termios_p) const

Definition at line 34 of file speed.c.

{
  return (termios_p->c_cflag & 0x000f0000) >> 16;
}
speed_t cfgetospeed ( struct termios termios_p) const

Definition at line 26 of file speed.c.

{
  return termios_p->c_cflag & 0x0000000f;
}
int cfsetospeed ( struct termios termios_p,
speed_t  speed 
)

Definition at line 42 of file speed.c.

{
  if (termios_p == NULL)
    {
      __set_errno (EINVAL);
      return -1;
    }

  termios_p->c_cflag &= ~0x0000000f;
  termios_p->c_cflag |= speed & 0x0000000f;
  return 0;
}

Definition at line 56 of file speed.c.

{
  if (termios_p == NULL)
    {
      __set_errno (EINVAL);
      return -1;
    }

  termios_p->c_cflag &= ~0x000f0000;
  termios_p->c_cflag |= (speed << 16) & ~0x000f0000;
  return 0;
}