android: backport pty implementation from aosp/master

This is not (yet) in l-preview branch but on master
The only way to prevent duplicated includes was to
test the existence of a new constant added after
l-preview bionic source release.

Also use compatible hasmntopt() return type
(swapon/off compilation warnings)

Signed-off-by: Tanguy Pruvot <tanguy.pruvot@gmail.com>

Change-Id: I4ee6e7752eab84de4566ae86a90171b8241fcaea
Fix remaining bionic warnings

smemcap: uid_t is unsigned,
and will change again...

Tested on arm and x86 (kitkat),
aosp/master has some other ones

Change-Id: I170b16f2e091b99f971fb518bf0106c0e92adfdd
ping6 warning

Change-Id: Ia954f334864e7bb18b447ad6f85eedd72a28ae68