Merge "The situation len = 0 and absolute = false need to be handled"
diff --git a/libpagemap/include/pagemap/pagemap.h b/libpagemap/include/pagemap/pagemap.h
index 2202567..210bc81 100644
--- a/libpagemap/include/pagemap/pagemap.h
+++ b/libpagemap/include/pagemap/pagemap.h
@@ -19,8 +19,11 @@
#include <stdint.h>
#include <stdio.h>
+#include <sys/cdefs.h>
#include <sys/types.h>
+__BEGIN_DECLS
+
typedef struct pm_memusage pm_memusage_t;
/* Holds the various metrics for memory usage of a process or a mapping. */
@@ -198,4 +201,6 @@
/* Get the working set of this map alone. */
int pm_map_workingset(pm_map_t *map, pm_memusage_t *ws_out);
+__END_DECLS
+
#endif
diff --git a/libpagemap/pm_process.c b/libpagemap/pm_process.c
index d1f9bb7..dcc9a55 100644
--- a/libpagemap/pm_process.c
+++ b/libpagemap/pm_process.c
@@ -107,9 +107,15 @@
off_t off;
int error;
- if (!proc || (low >= high) || !range_out || !len)
+ if (!proc || (low > high) || !range_out || !len)
return -1;
+ if (low == high) {
+ *range_out = NULL;
+ *len = 0;
+ return 0;
+ }
+
firstpage = low / proc->ker->pagesize;
numpages = (high - low) / proc->ker->pagesize;
diff --git a/tests/bionic/libc/Android.mk b/tests/bionic/libc/Android.mk
index 32900a8..a29b792 100644
--- a/tests/bionic/libc/Android.mk
+++ b/tests/bionic/libc/Android.mk
@@ -142,11 +142,6 @@
other/test_sysconf.c \
other/test_vfprintf_leak.c \
-ifeq ($(TARGET_ARCH),arm)
-sources += \
- other/test_atomics.c
-endif
-
$(call device-test, $(sources))
# The relocations test is a bit special, since we need
diff --git a/tests/bionic/libc/other/test_atomics.c b/tests/bionic/libc/other/test_atomics.c
deleted file mode 100644
index 0de2a93..0000000
--- a/tests/bionic/libc/other/test_atomics.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <stdio.h>
-
-
-extern int __atomic_dec(volatile int* addr);
-
-int main(int argc, const char *argv[])
-{
- int x = 5;
-
- while (x > -20) {
- printf("old_x=%d\n", __atomic_dec(&x));
- printf("x=%d\n", x);
- }
-
- printf ("OK\n");
- return 0;
-}