Add strerrordesc_np() and strerrorname_np().
strerrordesc_np() isn't very useful (being just another name for
strerror()), but strerrorname_np() lets you get "ENOSYS" for ENOSYS,
which will make some of our test assertion messages clearer when we
switch over from strerror().
This also adds `%#m` formatting to all the relevant functions.
Test: treehugger
Change-Id: Icfe07a39a307d591c3f4f2a09d008dc021643062
diff --git a/tests/async_safe_test.cpp b/tests/async_safe_test.cpp
index cc1b598..ffb8651 100644
--- a/tests/async_safe_test.cpp
+++ b/tests/async_safe_test.cpp
@@ -79,6 +79,18 @@
async_safe_format_buffer(buf, sizeof(buf), "a%mZ");
EXPECT_STREQ("aInvalid argumentZ", buf);
+#if __ANDROID_API_LEVEL__ >= 35
+ errno = EINVAL;
+ async_safe_format_buffer(buf, sizeof(buf), "a%#mZ");
+ EXPECT_STREQ("aEINVALZ", buf);
+#endif
+
+#if __ANDROID_API_LEVEL__ >= 35
+ errno = -1;
+ async_safe_format_buffer(buf, sizeof(buf), "a%#mZ");
+ EXPECT_STREQ("a-1Z", buf);
+#endif
+
async_safe_format_buffer(buf, sizeof(buf), "a%pb", reinterpret_cast<void*>(0xb0001234));
EXPECT_STREQ("a0xb0001234b", buf);