Mark fdsan functions as __attribute__((weak)).

Make it so that users can check for availability of fdsan at runtime.

Bug: http://b/110100358
Test: treehugger
Test: make libjnitest
Change-Id: Ief3054161f3e255d048370975f7dd90cf7ad3687
This commit is contained in:
Josh Gao 2018-07-20 13:12:31 -07:00
parent 170540398a
commit e899e798b8

View file

@ -113,21 +113,21 @@ enum android_fdsan_owner_type {
/*
* Create an owner tag with the specified type and least significant 56 bits of tag.
*/
uint64_t android_fdsan_create_owner_tag(enum android_fdsan_owner_type type, uint64_t tag) __INTRODUCED_IN_FUTURE;
uint64_t android_fdsan_create_owner_tag(enum android_fdsan_owner_type type, uint64_t tag) __INTRODUCED_IN_FUTURE __attribute__((__weak__));
/*
* 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_FUTURE;
void android_fdsan_exchange_owner_tag(int fd, uint64_t expected_tag, uint64_t new_tag) __INTRODUCED_IN_FUTURE __attribute__((__weak__));
/*
* Close a file descriptor with a tag, and resets the tag to 0.
*
* Logs and aborts if the tag is incorrect.
*/
int android_fdsan_close_with_tag(int fd, uint64_t tag) __INTRODUCED_IN_FUTURE;
int android_fdsan_close_with_tag(int fd, uint64_t tag) __INTRODUCED_IN_FUTURE __attribute__((__weak__));
enum android_fdsan_error_level {
// No errors.
@ -146,7 +146,7 @@ enum android_fdsan_error_level {
/*
* Get the error level.
*/
enum android_fdsan_error_level android_fdsan_get_error_level() __INTRODUCED_IN_FUTURE;
enum android_fdsan_error_level android_fdsan_get_error_level() __INTRODUCED_IN_FUTURE __attribute__((__weak__));
/*
* Set the error level and return the previous state.
@ -161,6 +161,6 @@ enum android_fdsan_error_level android_fdsan_get_error_level() __INTRODUCED_IN_F
* value, and so should probably only be called in single-threaded contexts
* (e.g. postfork).
*/
enum android_fdsan_error_level android_fdsan_set_error_level(enum android_fdsan_error_level new_level) __INTRODUCED_IN_FUTURE;
enum android_fdsan_error_level android_fdsan_set_error_level(enum android_fdsan_error_level new_level) __INTRODUCED_IN_FUTURE __attribute__((__weak__));
__END_DECLS