diff options
author | Ting-Wei Lan <lantw@src.gnome.org> | 2019-12-02 21:46:50 +0800 |
---|---|---|
committer | Robert Roth <robert.roth.off@gmail.com> | 2020-01-20 07:24:34 +0000 |
commit | 4229d1ea2018ccd7be94858f4d06013ce59f03cf (patch) | |
tree | 8730fdd324ea9ec9ad39299abf82e2964c8e58f6 | |
parent | 9e98bbd98b6a86f4c1aa48c5b8012dab559696cb (diff) | |
download | libgtop-4229d1ea2018ccd7be94858f4d06013ce59f03cf.tar.gz |
Check if sbrk is available
The only use of sbrk in libgtop is in an example which always calls it
with 0. Since the use of sbrk provides no functionality, just skip these
calls when sbrk is not available.
This problem was first reported on FreeBSD Bugzilla because FreeBSD
decides not to support sbrk on ARM64 and RISC-V:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221751
Fix https://gitlab.gnome.org/GNOME/libgtop/issues/46
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | examples/mountlist.c | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 712b787c..d7215bf0 100644 --- a/configure.ac +++ b/configure.ac @@ -213,7 +213,7 @@ AC_FUNC_ALLOCA AC_FUNC_MMAP AC_TYPE_SIGNAL AC_FUNC_STRFTIME -AC_CHECK_FUNCS(getcwd gettimeofday getwd putenv strdup strtoul uname) +AC_CHECK_FUNCS(getcwd gettimeofday getwd putenv sbrk strdup strtoul uname) # FIXME: Remove AM_GNU_GETTEXT_VERSION once autoreconf supports REQUIRE_VERSION AM_GNU_GETTEXT_VERSION([0.19.6]) diff --git a/examples/mountlist.c b/examples/mountlist.c index bbb005fc..6feacf91 100644 --- a/examples/mountlist.c +++ b/examples/mountlist.c @@ -71,7 +71,9 @@ main (int argc, char *argv []) printf ("Host = '%s' - %u\n\n", buffer, port); +#ifdef HAVE_SBRK printf ("sbrk (0) = %p\n\n", sbrk (0)); +#endif for (c = 0; c < PROFILE_COUNT; c++) { mount_entries = glibtop_get_mountlist (&mount_list, 1); @@ -79,7 +81,9 @@ main (int argc, char *argv []) g_free (mount_entries); } +#ifdef HAVE_SBRK printf ("sbrk (0) = %p\n\n", sbrk (0)); +#endif mount_entries = glibtop_get_mountlist (&mount_list, 1); @@ -108,7 +112,9 @@ main (int argc, char *argv []) g_free (mount_entries); +#ifdef HAVE_SBRK printf ("\nsbrk (0) = %p\n\n", sbrk (0)); +#endif glibtop_close (); |