summaryrefslogtreecommitdiff
path: root/tests/stdio_ext_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-01-20 18:09:05 -0800
committerElliott Hughes <enh@google.com>2015-01-21 10:33:30 -0800
commit8c4994bbc1a9a01e34ea92c91eb5b2d1a27bd074 (patch)
tree8b632cea0832373b9cb843427bb5976b3668f1a2 /tests/stdio_ext_test.cpp
parentf374358414812d3e5a45ba75a2b1926693924420 (diff)
Implement __fsetlocking.
The old __isthreaded hack was never very useful on Android because all user code runs in a VM where there are lots of threads running. But __fsetlocking lets a caller say "I'll worry about the locking for this FILE*", which is useful for the normal case where you don't share a FILE* between threads so you don't need any locking. Bug: 17154740 Bug: 18593728 Change-Id: I2a8dddc29d3edff39a3d7d793387f2253608a68d
Diffstat (limited to 'tests/stdio_ext_test.cpp')
-rw-r--r--tests/stdio_ext_test.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/stdio_ext_test.cpp b/tests/stdio_ext_test.cpp
index 950c7ed06..c95cbbdd5 100644
--- a/tests/stdio_ext_test.cpp
+++ b/tests/stdio_ext_test.cpp
@@ -133,7 +133,10 @@ TEST(stdio_ext, __freadable__fwritable) {
TEST(stdio_ext, __fsetlocking) {
FILE* fp = fopen("/proc/version", "r");
- // Android doesn't actually support the other modes.
+ ASSERT_EQ(FSETLOCKING_INTERNAL, __fsetlocking(fp, FSETLOCKING_QUERY));
+ ASSERT_EQ(FSETLOCKING_INTERNAL, __fsetlocking(fp, FSETLOCKING_BYCALLER));
+ ASSERT_EQ(FSETLOCKING_BYCALLER, __fsetlocking(fp, FSETLOCKING_QUERY));
+ ASSERT_EQ(FSETLOCKING_BYCALLER, __fsetlocking(fp, FSETLOCKING_INTERNAL));
ASSERT_EQ(FSETLOCKING_INTERNAL, __fsetlocking(fp, FSETLOCKING_QUERY));
fclose(fp);
}