# HG changeset patch # User Bruno Haible # Date 1548561449 -3600 # Node ID e1f68c6256cf4724f6b607ff304170589b237d81 # Parent 5be6b690b930f7461518452ea4eae67a54f12e94 vma-iter: Add support for Android. * lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Define on Android as well. * lib/vma-iter.c: Treat Android like Linux. * lib/get-rusage-data.c (get_rusage_data): Likewise. diff -r 5be6b690b930 -r e1f68c6256cf ChangeLog --- a/ChangeLog Sun Jan 27 04:57:27 2019 +0100 +++ b/ChangeLog Sun Jan 27 04:57:29 2019 +0100 @@ -1,3 +1,10 @@ +2019-01-26 Bruno Haible + + vma-iter: Add support for Android. + * lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Define on Android as well. + * lib/vma-iter.c: Treat Android like Linux. + * lib/get-rusage-data.c (get_rusage_data): Likewise. + 2019-01-26 Bruno Haible fts: Optimize on Android. diff -r 5be6b690b930 -r e1f68c6256cf lib/get-rusage-data.c --- a/lib/get-rusage-data.c Sun Jan 27 04:57:27 2019 +0100 +++ b/lib/get-rusage-data.c Sun Jan 27 04:57:29 2019 +0100 @@ -413,7 +413,7 @@ Prefer get_rusage_data_via_iterator(). */ return get_rusage_data_via_iterator (); #elif HAVE_SETRLIMIT && defined RLIMIT_DATA && !defined __HAIKU__ -# if defined __linux__ || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __hpux || defined __sgi || defined __osf__ || defined __sun /* Linux, FreeBSD, NetBSD, OpenBSD, AIX, HP-UX, IRIX, OSF/1, Solaris */ +# if defined __linux__ || defined __ANDROID__ || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __hpux || defined __sgi || defined __osf__ || defined __sun /* Linux, FreeBSD, NetBSD, OpenBSD, AIX, HP-UX, IRIX, OSF/1, Solaris */ /* get_rusage_data_via_setrlimit() works. */ return get_rusage_data_via_setrlimit (); # else diff -r 5be6b690b930 -r e1f68c6256cf lib/vma-iter.c --- a/lib/vma-iter.c Sun Jan 27 04:57:27 2019 +0100 +++ b/lib/vma-iter.c Sun Jan 27 04:57:29 2019 +0100 @@ -40,11 +40,11 @@ #include /* open, O_RDONLY */ #include /* getpagesize, lseek, read, close, getpid */ -#if defined __linux__ +#if defined __linux__ || defined __ANDROID__ # include /* PATH_MAX */ #endif -#if defined __linux__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __minix /* || defined __CYGWIN__ */ +#if defined __linux__ || defined __ANDROID__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __minix /* || defined __CYGWIN__ */ # include # include /* mmap, munmap */ #endif @@ -112,7 +112,7 @@ /* Support for reading text files in the /proc file system. */ -#if defined __linux__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __minix /* || defined __CYGWIN__ */ +#if defined __linux__ || defined __ANDROID__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __minix /* || defined __CYGWIN__ */ /* Buffered read-only streams. We cannot use here, because fopen() calls malloc(), and a malloc() @@ -129,7 +129,7 @@ VMAs with nonsensical addresses. So use mmap(), and ignore the resulting VMA. */ -# ifdef __linux__ +# if defined __linux__ || defined __ANDROID__ /* On Linux, if the file does not entirely fit into the buffer, the read() function stops before the line that would come out truncated. The maximum size of such a line is 73 + PATH_MAX bytes. To be sure that we @@ -205,7 +205,7 @@ { /* The buffer was sufficiently large. */ rof->filled = n; -# ifdef __linux__ +# if defined __linux__ || defined __ANDROID__ /* On Linux, the read() call may stop even if the buffer was large enough. We need the equivalent of full_read(). */ for (;;) @@ -342,7 +342,7 @@ /* Support for reading the info from a text file in the /proc file system. */ -#if defined __linux__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) /* || defined __CYGWIN__ */ +#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) /* || defined __CYGWIN__ */ /* GNU/kFreeBSD mounts /proc as linprocfs, which looks like a Linux /proc file system. */ @@ -866,7 +866,7 @@ int vma_iterate (vma_iterate_callback_fn callback, void *data) { -#if defined __linux__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __minix /* || defined __CYGWIN__ */ +#if defined __linux__ || defined __ANDROID__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __minix /* || defined __CYGWIN__ */ # if defined __FreeBSD__ /* On FreeBSD with procfs (but not GNU/kFreeBSD, which uses linprocfs), the diff -r 5be6b690b930 -r e1f68c6256cf lib/vma-iter.h --- a/lib/vma-iter.h Sun Jan 27 04:57:27 2019 +0100 +++ b/lib/vma-iter.h Sun Jan 27 04:57:29 2019 +0100 @@ -52,7 +52,7 @@ this platform. Note that even when this macro is defined, vma_iterate() may still fail to find any virtual memory area, for example if /proc is not mounted. */ -#if defined __linux__ || defined __GNU__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sgi || defined __osf__ || defined __sun || HAVE_PSTAT_GETPROCVM || (defined __APPLE__ && defined __MACH__) || defined _WIN32 || defined __CYGWIN__ || defined __BEOS__ || defined __HAIKU__ || defined __minix || HAVE_MQUERY +#if defined __linux__ || defined __ANDROID__ || defined __GNU__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sgi || defined __osf__ || defined __sun || HAVE_PSTAT_GETPROCVM || (defined __APPLE__ && defined __MACH__) || defined _WIN32 || defined __CYGWIN__ || defined __BEOS__ || defined __HAIKU__ || defined __minix || HAVE_MQUERY # define VMA_ITERATE_SUPPORTED 1 #endif