Avoid deprecated sbrk(2) on OS X.
Avoid referencing sbrk(2) on OS X, because it is deprecated as of OS X 10.9 (Mavericks), and the compiler warns against using it.
This commit is contained in:
parent
52b30691f9
commit
6668853596
@ -256,6 +256,7 @@ case "${host}" in
|
|||||||
force_tls="0"
|
force_tls="0"
|
||||||
DSO_LDFLAGS='-shared -Wl,-dylib_install_name,$(@F)'
|
DSO_LDFLAGS='-shared -Wl,-dylib_install_name,$(@F)'
|
||||||
SOREV="${rev}.${so}"
|
SOREV="${rev}.${so}"
|
||||||
|
sbrk_deprecated="1"
|
||||||
;;
|
;;
|
||||||
*-*-freebsd*)
|
*-*-freebsd*)
|
||||||
CFLAGS="$CFLAGS"
|
CFLAGS="$CFLAGS"
|
||||||
@ -825,7 +826,12 @@ fi
|
|||||||
dnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support.
|
dnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support.
|
||||||
AC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"])
|
AC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"])
|
||||||
if test "x$have_sbrk" = "x1" ; then
|
if test "x$have_sbrk" = "x1" ; then
|
||||||
AC_DEFINE([JEMALLOC_HAVE_SBRK], [ ])
|
if test "x$sbrk_deprecated" == "x1" ; then
|
||||||
|
AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated])
|
||||||
|
enable_dss="0"
|
||||||
|
else
|
||||||
|
AC_DEFINE([JEMALLOC_HAVE_SBRK], [ ])
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
enable_dss="0"
|
enable_dss="0"
|
||||||
fi
|
fi
|
||||||
|
@ -28,16 +28,17 @@ static void *dss_max;
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
#ifndef JEMALLOC_HAVE_SBRK
|
|
||||||
static void *
|
static void *
|
||||||
sbrk(intptr_t increment)
|
chunk_dss_sbrk(intptr_t increment)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifdef JEMALLOC_HAVE_SBRK
|
||||||
|
return (sbrk(increment));
|
||||||
|
#else
|
||||||
not_implemented();
|
not_implemented();
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
dss_prec_t
|
dss_prec_t
|
||||||
chunk_dss_prec_get(void)
|
chunk_dss_prec_get(void)
|
||||||
@ -93,7 +94,7 @@ chunk_alloc_dss(size_t size, size_t alignment, bool *zero)
|
|||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
/* Get the current end of the DSS. */
|
/* Get the current end of the DSS. */
|
||||||
dss_max = sbrk(0);
|
dss_max = chunk_dss_sbrk(0);
|
||||||
/*
|
/*
|
||||||
* Calculate how much padding is necessary to
|
* Calculate how much padding is necessary to
|
||||||
* chunk-align the end of the DSS.
|
* chunk-align the end of the DSS.
|
||||||
@ -117,7 +118,7 @@ chunk_alloc_dss(size_t size, size_t alignment, bool *zero)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
incr = gap_size + cpad_size + size;
|
incr = gap_size + cpad_size + size;
|
||||||
dss_prev = sbrk(incr);
|
dss_prev = chunk_dss_sbrk(incr);
|
||||||
if (dss_prev == dss_max) {
|
if (dss_prev == dss_max) {
|
||||||
/* Success. */
|
/* Success. */
|
||||||
dss_max = dss_next;
|
dss_max = dss_next;
|
||||||
@ -163,7 +164,7 @@ chunk_dss_boot(void)
|
|||||||
|
|
||||||
if (malloc_mutex_init(&dss_mtx))
|
if (malloc_mutex_init(&dss_mtx))
|
||||||
return (true);
|
return (true);
|
||||||
dss_base = sbrk(0);
|
dss_base = chunk_dss_sbrk(0);
|
||||||
dss_prev = dss_base;
|
dss_prev = dss_base;
|
||||||
dss_max = dss_base;
|
dss_max = dss_base;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user