Tcdrain function call with ndk toolchain for android
I am trying to use the tcdrain function call defined in termios.h by compiling my c code using android ndk.
I am having problems because when I build the newest android ndk the tcdrain is not defined in termios.h, however if I go into the android source it is defined in termios.h for bionic.
For example: https://github.com/android/platform_bionic/blob/master/libc/include/termios.h#L44
But when I create ndk it seems to have another termios.h file in sysroot / usr / include / termios.h?
Why won't the newest ndk have the same include files as the newest bionic / libc files?
source to share
The source code you are linking indicates that these functions are only defined if the following is executed
#if __ANDROID_API__ >= 21
since nayuta said that you will tcdrain
only have with build environment configured with --platform=android21
.
If you cannot use plafform android21, you can still define the actual functions you need.
In the case of tcdrain, a possible replacement would be
#define tcdrain(fd) ioctl(fd, TCSBRK, 1)
source to share