summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/tcsetattr.c
blob: cf70354d2188b1710ce3b639469d64e43a45b4a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#define tcsetattr libc_tcsetattr
#include <termios.h>
#include <sys/ioctl.h>
#undef tcsetattr

#include <asm/errno.h>

extern int errno;

/* Hack around a kernel bug; value must correspond to the one used in speed.c */
#define IBAUD0	020000000000

int tcsetattr(int fildes, int optional_actions, struct termios *termios_p)
{
  termios_p->c_iflag &= ~IBAUD0;
  switch (optional_actions) {
  case TCSANOW:
    return ioctl(fildes, TCSETS, termios_p);
  case TCSADRAIN:
    return ioctl(fildes, TCSETSW, termios_p);
  case TCSAFLUSH:
    return ioctl(fildes, TCSETSF, termios_p);
  default:
    errno = EINVAL;
    return -1;
  }
}