Add legacy inlines for more termios stuff.
Test: make checkbuild # with my versioner-in-build patches Bug: https://github.com/android-ndk/ndk/issues/302 Change-Id: Ib00b5dadf23592d101486b4f2188285ec03c9e2a
This commit is contained in:
parent
45715b2a88
commit
4473e34acb
2 changed files with 14 additions and 3 deletions
|
@ -91,6 +91,18 @@ static __inline void cfmakeraw(struct termios *s) {
|
|||
s->c_cflag |= CS8;
|
||||
}
|
||||
|
||||
static __inline int cfsetspeed(struct termios* s, speed_t speed) {
|
||||
// TODO: check 'speed' is valid.
|
||||
s->c_cflag = (s->c_cflag & ~CBAUD) | (speed & CBAUD);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __inline int tcdrain(int fd) {
|
||||
// A non-zero argument to TCSBRK means "don't send a break".
|
||||
// The drain is a side-effect of the ioctl!
|
||||
return ioctl(fd, TCSBRK, __BIONIC_CAST(static_cast, unsigned long, 1));
|
||||
}
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
|
|
@ -40,8 +40,10 @@ __BEGIN_DECLS
|
|||
speed_t cfgetispeed(const struct termios*) __INTRODUCED_IN(21);
|
||||
speed_t cfgetospeed(const struct termios*) __INTRODUCED_IN(21);
|
||||
void cfmakeraw(struct termios*) __INTRODUCED_IN(21);
|
||||
int cfsetspeed(struct termios*, speed_t) __INTRODUCED_IN(21);
|
||||
int cfsetispeed(struct termios*, speed_t) __INTRODUCED_IN(21);
|
||||
int cfsetospeed(struct termios*, speed_t) __INTRODUCED_IN(21);
|
||||
int tcdrain(int) __INTRODUCED_IN(21);
|
||||
int tcflow(int, int) __INTRODUCED_IN(21);
|
||||
int tcflush(int, int) __INTRODUCED_IN(21);
|
||||
int tcgetattr(int, struct termios*) __INTRODUCED_IN(21);
|
||||
|
@ -50,9 +52,6 @@ int tcsendbreak(int, int) __INTRODUCED_IN(21);
|
|||
int tcsetattr(int, int, const struct termios*) __INTRODUCED_IN(21);
|
||||
#endif
|
||||
|
||||
int cfsetspeed(struct termios*, speed_t) __INTRODUCED_IN(21);
|
||||
int tcdrain(int) __INTRODUCED_IN(21);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#include <android/legacy_termios_inlines.h>
|
||||
|
|
Loading…
Reference in a new issue