Is there anyone here with some ndk experience? I'm...
# android
t
Is there anyone here with some ndk experience? I'm desperate for some help getting fdsan to work.. I'm following the guide to ensure I handle file descriptors properly: https://android.googlesource.com/platform/bionic/+/master/docs/fdsan.md But when I try to implement
unique_fd.h
, I get the error 'use of undeclared identifier:
android_fdsan_exchange_owner_tag
'
unique_fd.h
(Provided by me)
Copy code
static void exchange_tag(int fd, uint64_t old_tag, uint64_t new_tag) {
    if (android_fdsan_exchange_owner_tag) { // Fails to compile
        android_fdsan_exchange_owner_tag(fd, old_tag, new_tag);
    }
}
This seems to be because this function is only available on API >= 29:
fdsan.h
(Provided by the Android platform)
Copy code
#if __ANDROID_API__ >= 29

/*
 * Exchange a file descriptor's tag.
 *
 * Logs and aborts if the fd's tag does not match expected_tag.
 */
void android_fdsan_exchange_owner_tag(int fd, uint64_t expected_tag, uint64_t new_tag) __INTRODUCED_IN(29) __attribute__((__weak__));
google 1