am cd767bfd: am d4649b2f: Merge change Ibaef6141 into eclair
Merge commit 'cd767bfd1c8e3103f99207ecfa34385e76518e82' into eclair-mr2-plus-aosp
* commit 'cd767bfd1c8e3103f99207ecfa34385e76518e82':
libbinder: add a NO_CACHING flag to MemoryHeapBase
diff --git a/include/binder/MemoryHeapBase.h b/include/binder/MemoryHeapBase.h
index 435540e..d793c24 100644
--- a/include/binder/MemoryHeapBase.h
+++ b/include/binder/MemoryHeapBase.h
@@ -35,7 +35,8 @@
MAP_ONCE = IMemoryHeap::MAP_ONCE,
// memory won't be mapped locally, but will be mapped in the remote
// process.
- DONT_MAP_LOCALLY = 0x00000100
+ DONT_MAP_LOCALLY = 0x00000100,
+ NO_CACHING = 0x00000200
};
/*
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 @@
: 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();