summaryrefslogtreecommitdiffstats
path: root/libs/binder
diff options
context:
space:
mode:
authorIliyan Malchev <malchev@google.com>2009-10-29 22:55:00 -0700
committerIliyan Malchev <malchev@google.com>2009-10-30 18:35:47 -0700
commitbaef6141a3239c7dd9bad0e2cd8a9ece5eef5a7e (patch)
tree50df32f2a31006f4ea4572cffdf390012541027b /libs/binder
parent05cb5610fdfb7b69cf90a9230853e59b4ae5e219 (diff)
downloadframeworks_base-baef6141a3239c7dd9bad0e2cd8a9ece5eef5a7e.zip
frameworks_base-baef6141a3239c7dd9bad0e2cd8a9ece5eef5a7e.tar.gz
frameworks_base-baef6141a3239c7dd9bad0e2cd8a9ece5eef5a7e.tar.bz2
libbinder: add a NO_CACHING flag to MemoryHeapBase
The NO_CACHING flag translates to opening a memory region with O_SYNC. Signed-off-by: Iliyan Malchev <malchev@google.com>
Diffstat (limited to 'libs/binder')
-rw-r--r--libs/binder/MemoryHeapBase.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/binder/MemoryHeapBase.cpp b/libs/binder/MemoryHeapBase.cpp
index 5df078f..624f7eb 100644
--- a/libs/binder/MemoryHeapBase.cpp
+++ b/libs/binder/MemoryHeapBase.cpp
@@ -67,7 +67,11 @@ MemoryHeapBase::MemoryHeapBase(const char* device, size_t size, uint32_t flags)
: mFD(-1), mSize(0), mBase(MAP_FAILED), mFlags(flags),
mDevice(0), mNeedUnmap(false)
{
- int fd = open(device, O_RDWR);
+ int open_flags = O_RDWR;
+ if (flags & NO_CACHING)
+ open_flags |= O_SYNC;
+
+ int fd = open(device, open_flags);
LOGE_IF(fd<0, "error opening %s: %s", device, strerror(errno));
if (fd >= 0) {
const size_t pagesize = getpagesize();