Back to index

glibc  2.9
Functions
termios.h File Reference
#include <features.h>
#include <bits/termios.h>

Go to the source code of this file.

Functions

__BEGIN_DECLS speed_t cfgetospeed (__const struct termios *__termios_p) __THROW
speed_t cfgetispeed (__const struct termios *__termios_p) __THROW
int cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW
int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW
int tcgetattr (int __fd, struct termios *__termios_p) __THROW
int tcsetattr (int __fd, int __optional_actions, __const struct termios *__termios_p) __THROW
int tcsendbreak (int __fd, int __duration) __THROW
int tcdrain (int __fd)
int tcflush (int __fd, int __queue_selector) __THROW
int tcflow (int __fd, int __action) __THROW

Function Documentation

speed_t cfgetispeed ( __const struct termios __termios_p)
__BEGIN_DECLS speed_t cfgetospeed ( __const struct termios __termios_p)
int cfsetispeed ( struct termios __termios_p,
speed_t  __speed 
)

Here is the caller graph for this function:

int cfsetospeed ( struct termios __termios_p,
speed_t  __speed 
)

Definition at line 63 of file speed.c.

{
  register unsigned int i;

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

  /* This allows either B1200 or 1200 to work.   XXX
     Do we really want to try to support this, given that
     fetching the speed must return one or the other?  */

  for (i = 0; i < sizeof (speeds) / sizeof (speeds[0]); ++i)
    if (i == speed || speeds[i] == speed)
      {
       termios_p->c_cflag &= ~CBAUD;
       termios_p->c_cflag |= i;
       return 0;
      }

  __set_errno (EINVAL);
  return -1;
}

Here is the caller graph for this function:

int tcdrain ( int  __fd)

Here is the caller graph for this function:

int tcflow ( int  __fd,
int  __action 
)

Definition at line 25 of file tcflow.c.

{
  return __ioctl (fd, TCXONC, action);
}

Here is the call graph for this function:

int tcflush ( int  __fd,
int  __queue_selector 
)

Definition at line 25 of file tcflush.c.

{
  return __ioctl (fd, TCFLSH, queue_selector);
}

Here is the caller graph for this function:

int tcgetattr ( int  __fd,
struct termios __termios_p 
)

Definition at line 24 of file tcgetattr.c.

{
  struct aixtermios aixtermios;
  int result;

  result = /* make syscall */;

  if (result != -1)
    {
      /* Convert the result.  */

      linuxtermios_p->c_cc[VINTR] = aixtermios.c_cc[AIX_VINTR];
      linuxtermios_p->c_cc[VQUIT] = aixtermios.c_cc[AIX_VQUIT];
      linuxtermios_p->c_cc[VERASE] = aixtermios.c_cc[AIX_VERASE];
      linuxtermios_p->c_cc[VKILL] = aixtermios.c_cc[AIX_VKILL];
      linuxtermios_p->c_cc[VEOF] = aixtermios.c_cc[AIX_VEOF];
      // XXX VMIN has the same value as VEOF !?
      linuxtermios_p->c_cc[VEOL] = aixtermios.c_cc[AIX_VEOL];
      // XXX VTIME has the same value as VEOL !?
      linuxtermios_p->c_cc[VEOL2] = aixtermios.c_cc[AIX_VEOL2];
      linuxtermios_p->c_cc[VSTART] = aixtermios.c_cc[AIX_VSTART];
      linuxtermios_p->c_cc[VSTOP] = aixtermios.c_cc[AIX_VSTOP];
      linuxtermios_p->c_cc[VSUSP] = aixtermios.c_cc[AIX_VSUSP];
      // XXX No Linux equivalent for VDSUSP !?
      linuxtermios_p->c_cc[VREPRINT] = aixtermios.c_cc[AIX_VREPRINT];
      linuxtermios_p->c_cc[VDISCARD] = aixtermios.c_cc[AIX_VDISCARD];
      linuxtermios_p->c_cc[VWERASE] = aixtermios.c_cc[AIX_VWERASE];
      linuxtermios_p->c_cc[VLNEXT] = aixtermios.c_cc[AIX_VLNEXT];

      linuxtermios_p->c_cflag = aixtermios.c_c_flag & AIX_CBAUD;

      /* Only the IUCLC, IXANY, and IMAXBEL values are different in the
        c_iflag member.  */
      linuxtermios_p->c_iflag = aixtermios.c_iflag & 0x7ff;
      if (aixtermios.c_iflag & AIX_IXANY)
       linuxtermios_p->c_iflag |= IXANY;
      if (aixtermios.c_iflag & AIX_IUCLC)
       linuxtermios_p->c_iflag |= IUCLC;
      if (aixtermios.c_iflag & AIX_IMAXBEL)
       linuxtermios_p->c_iflag |= IMAXBEL;

      /* Many of the c_oflag files differ.  Bummer.  */
      linuxtermios_p->c_oflag = (aixtermios.c_oflag
                             & (OPOST | OCRNL | ONOCR | ONLRET | OFILL
                                | OFDEL | TABDLY));
      if (aixtermios.c_oflag & AIX_OLCUC)
       linuxtermios_p->c_oflag |= OLCUC;
      if (aixtermios.c_oflag & AIX_ONLCR)
       linuxtermios_p->c_oflag |= ONLCR;
      if (aixtermiosc_oflag & AIX_NLDLY)
       linuxtermios_p->c_oflag |= NL1;

      if (aixtermiosc_oflag.c_oflag & AIX_TABDLY)
       {
#define offset 2
#if AIX_TAB1 << offset != TAB1 || AIX_TAB3 << offset != TAB3
# error "Check the offset"
#endif
         linuxtermios_p->c_oflag |= (aixtermios.c_oflag >> offset) & TABDLY;
#undef offset
       }
      if (aixtermios.c_oflag & AIX_FFDLY)
       linuxtermios_p->c_oflag |= FF1;
      if (aixtermios.c_oflag & AIX_BSDLY)
       linuxtermios_p->c_oflag |= BS1;
      if (aixtermios.c_oflag & AIX_VTDLY)
       linuxtermios_p->c_oflag |= VT1;

      /* A lot of the c_cflag member is also different.  */
      if (aixtermios.c_cflag & AIX_CSIZE)
       {
#define offset 4
#if CSIZE >> offset != AIX_CSIZE
# error "Check the offset"
#endif
         linuxtermios_p->c_cflag |= (aixtermios.c_cflag >> offset) & CSIZE;
#undef offset
       }

      if (aixtermios.c_cflag & AIX_STOPB)
       linuxtermios_p->c_cflag |= STOPB;
      if (aixtermios.c_cflag & AIX_CREAD)
       linuxtermios_p->c_cflag |= CREAD;
      if (aixtermios.cflag & AIX_PARENB)
       linuxtermios_p->c_cflag |= PARENB;
      if (aixtermios.cflag & AIX_PARODD)
       linuxtermios_p->c_cflag |= PARODD;
      if (aixtermios.c_cflag & AIX_HUPCL)
       linuxtermios_p->c_cflag |= HUPCL;
      if (aixtermios.c_cflag & AIX_CLOCAL)
       linuxtermios_p->c_cflag |= CLOCAL;

      /* The c_lflag is information is also different.  */
      aixtermios.c_lflag = 0;
      if (aixtermios.c_lflag & AIX_ISIG)
       linuxtermios_p->c_lflag |= ISIG;
      if (aixtermios.c_lflag & AIX_ICANON)
       linuxtermios_p->c_lflag |= ICANON;
      if (aixtermios.c_lflag & AIX_XCASE)
       linuxtermios_p->c_lflag |= XCASE;
      if (aixtermios.c_lflag & AIX_ECHO)
       linuxtermios_p->c_lflag |= ECHO;
      if (aixtermios.c_lflag & AIX_ECHOE)
       linuxtermios_p->c_lflag |= ECHOE;
      if (aixtermios.c_lflag & AIX_ECHOK)
       linuxtermios_p->c_lflag |= ECHOK;
      if (aixtermios.c_lflag & AIX_ECHONL)
       linuxtermios_p->c_lflag |= ECHONL;
      if (aixtermios.c_lflag & AIX_NOFLSH)
       linuxtermios_p->c_lflag |= NOFLSH;
      if (aixtermios.c_lflag & AIX_TOSTOP)
       linuxtermios_p->c_lflag |= TOSTOP;
      if (aixtermios.c_lflag & AIX_ECHOCTL)
       linuxtermios_p->c_lflag |= ECHOCTL;
      if (aixtermios.c_lflag & AIX_ECHOPRT)
       linuxtermios_p->c_lflag |= ECHOPRT;
      if (aixtermios.c_lflag & AIX_ECHOKE)
       linuxtermios_p->c_lflag |= ECHOKE;
      if (aixtermios.c_lflag & AIX_FLUSHO)
       linuxtermios_p->c_lflag |= FLUSHO;
      if (aixtermios.c_lflag & AIX_PENDIN)
       linuxtermios_p->c_lflag |= PENDIN;
      if (aixtermios->c_lflag & AIX_IEXTEN)
       linuxtermios_p->c_lflag |= IEXTEN;
    }
  else
    // Convert error here or in syscall.
    ;

  return result;
}

Here is the caller graph for this function:

int tcsendbreak ( int  __fd,
int  __duration 
)

Definition at line 26 of file tcsendbrk.c.

{
  /* According to SunOS 4.1's termios(4), you can't specify a duration.  */
  return __ioctl (fd, TCSBRK, 0);
}

Here is the call graph for this function:

int tcsetattr ( int  __fd,
int  __optional_actions,
__const struct termios __termios_p 
)