]> Savannah Git Hosting - gnulib.git/commitdiff
vma-iter: Add support for Android.
authorBruno Haible <bruno@clisp.org>
Sun, 27 Jan 2019 03:57:29 +0000 (04:57 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 27 Jan 2019 03:57:29 +0000 (04:57 +0100)
* 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.

ChangeLog
lib/get-rusage-data.c
lib/vma-iter.c
lib/vma-iter.h

index eec6a5021aad650de64fa9379881d2374216edfa..6fb03bcf2731a70654702f8bcf0c10328e8061d3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2019-01-26  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        fts: Optimize on Android.
index cdd5d99e14541f9fd6edd3a8af3a812bc357958c..131cca75d4c10959aff764332363dc2037263bc8 100644 (file)
@@ -413,7 +413,7 @@ get_rusage_data (void)
      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
index d641570579304773763d8cbfb542046d08efb80a..5bf3906742a5d0a6a478007701a951a4e7047ed1 100644 (file)
 #include <fcntl.h> /* open, O_RDONLY */
 #include <unistd.h> /* getpagesize, lseek, read, close, getpid */
 
-#if defined __linux__
+#if defined __linux__ || defined __ANDROID__
 # include <limits.h> /* 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 <sys/types.h>
 # include <sys/mman.h> /* mmap, munmap */
 #endif
 
 /* 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 <stdio.h> here, because fopen() calls malloc(), and a malloc()
        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 @@ rof_open (struct rofile *rof, const char *filename)
                 {
                   /* 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 @@ rof_close (struct rofile *rof)
 
 /* 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 @@ vma_iterate_bsd (vma_iterate_callback_fn callback, void *data)
 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
index c1e1e5af4cf3ba092ba6dd7004c6c73f975142a0..e319d5d8777a5359fcdc685fff91f127e5db9fa3 100644 (file)
@@ -52,7 +52,7 @@ extern int vma_iterate (vma_iterate_callback_fn callback, void *data);
    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