# HG changeset patch # User Bruno Haible # Date 1548561452 -3600 # Node ID dd38f4180e3f3455d98a3d78e4ab9e31bdf83f1e # Parent e1f68c6256cf4724f6b607ff304170589b237d81 getloadavg: Add support for Android. * lib/getloadavg.c: Treat Android like Linux. diff -r e1f68c6256cf -r dd38f4180e3f ChangeLog --- a/ChangeLog Sun Jan 27 04:57:29 2019 +0100 +++ b/ChangeLog Sun Jan 27 04:57:32 2019 +0100 @@ -1,3 +1,8 @@ +2019-01-26 Bruno Haible + + getloadavg: Add support for Android. + * lib/getloadavg.c: Treat Android like Linux. + 2019-01-26 Bruno Haible vma-iter: Add support for Android. diff -r e1f68c6256cf -r dd38f4180e3f lib/getloadavg.c --- a/lib/getloadavg.c Sun Jan 27 04:57:29 2019 +0100 +++ b/lib/getloadavg.c Sun Jan 27 04:57:32 2019 +0100 @@ -47,8 +47,8 @@ N_NAME_POINTER The nlist n_name element is a pointer, not an array. HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'. - LINUX_LDAV_FILE [__linux__, __CYGWIN__]: File containing - load averages. + LINUX_LDAV_FILE [__linux__, __ANDROID__, __CYGWIN__]: File + containing load averages. Specific system predefines this file uses, aside from setting default values if not emacs: @@ -65,7 +65,7 @@ UMAX4_3 VMS _WIN32 Native Windows (possibly also defined on Cygwin) - __linux__ Linux: assumes /proc file system mounted. + __linux__, __ANDROID__ Linux: assumes /proc file system mounted. Support from Michael K. Johnson. __CYGWIN__ Cygwin emulates linux /proc/loadavg. __NetBSD__ NetBSD: assumes /kern file system mounted. @@ -263,7 +263,7 @@ # ifdef LOAD_AVE_TYPE # ifndef __VMS -# ifndef __linux__ +# if !(defined __linux__ || defined __ANDROID__) # ifndef NLIST_STRUCT # include # else /* NLIST_STRUCT */ @@ -286,7 +286,7 @@ # ifndef LDAV_SYMBOL # define LDAV_SYMBOL "_avenrun" # endif /* LDAV_SYMBOL */ -# endif /* __linux__ */ +# endif /* __linux__ || __ANDROID__ */ # else /* __VMS */ @@ -359,7 +359,8 @@ # include # endif -# if (defined __linux__ || defined __CYGWIN__ || defined SUNOS_5 \ +# if (defined __linux__ || defined __ANDROID__ \ + || defined __CYGWIN__ || defined SUNOS_5 \ || (defined LOAD_AVE_TYPE && ! defined __VMS)) # include # endif @@ -388,7 +389,7 @@ /* Offset in kmem to seek to read load average, or 0 means invalid. */ static long offset; -# if ! defined __VMS && ! defined sgi && ! defined __linux__ +# if ! defined __VMS && ! defined sgi && ! (defined __linux__ || defined __ANDROID__) static struct nlist name_list[2]; # endif @@ -498,8 +499,8 @@ } # endif -# if !defined (LDAV_DONE) && (defined (__linux__) || defined (__CYGWIN__)) - /* Linux without glibc, Cygwin */ +# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__ || defined __CYGWIN__) + /* Linux without glibc, Android, Cygwin */ # define LDAV_DONE # undef LOAD_AVE_TYPE @@ -554,7 +555,7 @@ return elem; -# endif /* __linux__ || __CYGWIN__ */ +# endif /* __linux__ || __ANDROID__ || __CYGWIN__ */ # if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */ # define LDAV_DONE