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
This commit is contained in:
committed by
Robert Roth
parent
9e98bbd98b
commit
4229d1ea20
@@ -213,7 +213,7 @@ AC_FUNC_ALLOCA
|
|||||||
AC_FUNC_MMAP
|
AC_FUNC_MMAP
|
||||||
AC_TYPE_SIGNAL
|
AC_TYPE_SIGNAL
|
||||||
AC_FUNC_STRFTIME
|
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
|
# FIXME: Remove AM_GNU_GETTEXT_VERSION once autoreconf supports REQUIRE_VERSION
|
||||||
AM_GNU_GETTEXT_VERSION([0.19.6])
|
AM_GNU_GETTEXT_VERSION([0.19.6])
|
||||||
|
@@ -71,7 +71,9 @@ main (int argc, char *argv [])
|
|||||||
|
|
||||||
printf ("Host = '%s' - %u\n\n", buffer, port);
|
printf ("Host = '%s' - %u\n\n", buffer, port);
|
||||||
|
|
||||||
|
#ifdef HAVE_SBRK
|
||||||
printf ("sbrk (0) = %p\n\n", sbrk (0));
|
printf ("sbrk (0) = %p\n\n", sbrk (0));
|
||||||
|
#endif
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++) {
|
for (c = 0; c < PROFILE_COUNT; c++) {
|
||||||
mount_entries = glibtop_get_mountlist (&mount_list, 1);
|
mount_entries = glibtop_get_mountlist (&mount_list, 1);
|
||||||
@@ -79,7 +81,9 @@ main (int argc, char *argv [])
|
|||||||
g_free (mount_entries);
|
g_free (mount_entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SBRK
|
||||||
printf ("sbrk (0) = %p\n\n", sbrk (0));
|
printf ("sbrk (0) = %p\n\n", sbrk (0));
|
||||||
|
#endif
|
||||||
|
|
||||||
mount_entries = glibtop_get_mountlist (&mount_list, 1);
|
mount_entries = glibtop_get_mountlist (&mount_list, 1);
|
||||||
|
|
||||||
@@ -108,7 +112,9 @@ main (int argc, char *argv [])
|
|||||||
|
|
||||||
g_free (mount_entries);
|
g_free (mount_entries);
|
||||||
|
|
||||||
|
#ifdef HAVE_SBRK
|
||||||
printf ("\nsbrk (0) = %p\n\n", sbrk (0));
|
printf ("\nsbrk (0) = %p\n\n", sbrk (0));
|
||||||
|
#endif
|
||||||
|
|
||||||
glibtop_close ();
|
glibtop_close ();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user