Reputation: 197
I'm trying to use tcdrain function call defined in termios.h by compiling my c code with the android ndk.
I'm having issues because when I build the newest android ndk, tcdrain is not defined in termios.h, however if I go inside the android source code 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 build the ndk, it seems to have a different termios.h file in sysroot/usr/include/termios.h?
Why would the newest ndk not have the same include files as the newest bionic/libc files?
Upvotes: 3
Views: 829
Reputation: 368
The source code you linked states that those functions are defined only if the following holds
#if __ANDROID_API__ >= 21
so, as nayuta said you will have tcdrain
only with build environment configured with --platform=android21
.
If you can not use plafform android21, you may still define yourself the functions you need.
In case of tcdrain a possible replacement would be
#define tcdrain(fd) ioctl(fd, TCSBRK, 1)
Upvotes: 4
Reputation: 51
Did you configure your build environment with --platform=android21
or later?
Before android 5.0, api level 20 and older, function declarations is replaced with android/legacy_termios_inlines. h
.
If you configure for android 5.0 or later, you can use tcdrain
.
Upvotes: 1