mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
freebsd implementation of get_thread_stack_base
* configure.ac: Check for pthread_np.h and pthread_attr_get_np. Patch by Jim Pryor. * libguile/threads.c (get_thread_stack_base): Provide an implementation for FreeBSD.
This commit is contained in:
parent
34cf38c3a2
commit
c1d5d6d755
2 changed files with 32 additions and 2 deletions
|
@ -775,6 +775,7 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime
|
||||||
# sys/param.h - not in mingw
|
# sys/param.h - not in mingw
|
||||||
# pthread.h - only available with pthreads. ACX_PTHREAD doesn't
|
# pthread.h - only available with pthreads. ACX_PTHREAD doesn't
|
||||||
# check this specifically, we need it for the timespec test below.
|
# check this specifically, we need it for the timespec test below.
|
||||||
|
# pthread_np.h - available on FreeBSD
|
||||||
# sethostname - the function itself check because it's not in mingw,
|
# sethostname - the function itself check because it's not in mingw,
|
||||||
# the DECL is checked because Solaris 10 doens't have in any header
|
# the DECL is checked because Solaris 10 doens't have in any header
|
||||||
# hstrerror - on Tru64 5.1b the symbol is available in libc but the
|
# hstrerror - on Tru64 5.1b the symbol is available in libc but the
|
||||||
|
@ -782,7 +783,7 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime
|
||||||
# cuserid - on Tru64 5.1b the declaration is documented to be available
|
# cuserid - on Tru64 5.1b the declaration is documented to be available
|
||||||
# only with `_XOPEN_SOURCE' or some such.
|
# only with `_XOPEN_SOURCE' or some such.
|
||||||
#
|
#
|
||||||
AC_CHECK_HEADERS([crypt.h netdb.h pthread.h sys/param.h sys/resource.h sys/file.h sys/mman.h])
|
AC_CHECK_HEADERS([crypt.h netdb.h pthread.h pthread_np.h sys/param.h sys/resource.h sys/file.h sys/mman.h])
|
||||||
AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
|
AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
|
||||||
AC_CHECK_DECLS([sethostname, hstrerror, cuserid])
|
AC_CHECK_DECLS([sethostname, hstrerror, cuserid])
|
||||||
|
|
||||||
|
@ -1364,9 +1365,11 @@ case "$with_threads" in
|
||||||
# all; not present on MacOS X or Solaris 10
|
# all; not present on MacOS X or Solaris 10
|
||||||
# pthread_get_stackaddr_np - "np" meaning "non portable" says it
|
# pthread_get_stackaddr_np - "np" meaning "non portable" says it
|
||||||
# all; specific to MacOS X
|
# all; specific to MacOS X
|
||||||
|
# pthread_attr_get_np - "np" meaning "non portable" says it
|
||||||
|
# all; specific to FreeBSD
|
||||||
# pthread_sigmask - not available on mingw
|
# pthread_sigmask - not available on mingw
|
||||||
#
|
#
|
||||||
AC_CHECK_FUNCS(pthread_attr_getstack pthread_getattr_np pthread_get_stackaddr_np pthread_sigmask)
|
AC_CHECK_FUNCS(pthread_attr_getstack pthread_getattr_np pthread_get_stackaddr_np pthread_attr_get_np pthread_sigmask)
|
||||||
|
|
||||||
# On past versions of Solaris, believe 8 through 10 at least, you
|
# On past versions of Solaris, believe 8 through 10 at least, you
|
||||||
# had to write "pthread_once_t foo = { PTHREAD_ONCE_INIT };".
|
# had to write "pthread_once_t foo = { PTHREAD_ONCE_INIT };".
|
||||||
|
|
|
@ -38,6 +38,10 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_PTHREAD_NP_H
|
||||||
|
# include <pthread_np.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <nproc.h>
|
#include <nproc.h>
|
||||||
|
@ -141,6 +145,29 @@ get_thread_stack_base ()
|
||||||
return pthread_get_stackaddr_np (pthread_self ());
|
return pthread_get_stackaddr_np (pthread_self ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif HAVE_PTHREAD_ATTR_GET_NP
|
||||||
|
/* This one is for FreeBSD 9. */
|
||||||
|
static void *
|
||||||
|
get_thread_stack_base ()
|
||||||
|
{
|
||||||
|
pthread_attr_t attr;
|
||||||
|
void *start, *end;
|
||||||
|
size_t size;
|
||||||
|
|
||||||
|
pthread_attr_init (&attr);
|
||||||
|
pthread_attr_get_np (pthread_self (), &attr);
|
||||||
|
pthread_attr_getstack (&attr, &start, &size);
|
||||||
|
pthread_attr_destroy (&attr);
|
||||||
|
|
||||||
|
end = (char *)start + size;
|
||||||
|
|
||||||
|
#if SCM_STACK_GROWS_UP
|
||||||
|
return start;
|
||||||
|
#else
|
||||||
|
return end;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error Threads enabled with old BDW-GC, but missing get_thread_stack_base impl. Please upgrade to libgc >= 7.1.
|
#error Threads enabled with old BDW-GC, but missing get_thread_stack_base impl. Please upgrade to libgc >= 7.1.
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue