summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpagemap/include/pagemap/pagemap.h5
-rw-r--r--libpagemap/pm_process.c8
-rw-r--r--tests/bionic/libc/Android.mk5
-rw-r--r--tests/bionic/libc/other/test_atomics.c17
4 files changed, 12 insertions, 23 deletions
diff --git a/libpagemap/include/pagemap/pagemap.h b/libpagemap/include/pagemap/pagemap.h
index 22025672..210bc815 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 @@ int pm_map_usage_flags(pm_map_t *map, pm_memusage_t *usage_out,
/* 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 d1f9bb78..dcc9a554 100644
--- a/libpagemap/pm_process.c
+++ b/libpagemap/pm_process.c
@@ -107,9 +107,15 @@ int pm_process_pagemap_range(pm_process_t *proc,
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 32900a8e..a29b7925 100644
--- a/tests/bionic/libc/Android.mk
+++ b/tests/bionic/libc/Android.mk
@@ -142,11 +142,6 @@ sources := \
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 0de2a938..00000000
--- 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;
-}