* [PATCH] get_thread_stack_base for FreeBSD
@ 2008-03-09 0:07 Amatus
2008-03-11 14:52 ` Ludovic Courtès
0 siblings, 1 reply; 2+ messages in thread
From: Amatus @ 2008-03-09 0:07 UTC (permalink / raw)
To: bug-guile
[-- Attachment #1: Type: text/plain, Size: 926 bytes --]
From: David Barksdale <amatus@gnu.org>
This change adds get_thread_stack_base support for FreeBSD.
--
This patch was generated against guile-1.8.4
************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering to the intended recipient, be advised that you have received this email in error and that any use of the information contained within this email or attachments is strictly prohibited.
************************************************************
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
[-- Attachment #2: 2978506763-guile-1.8.4-get_thread_stack_base.patch --]
[-- Type: application/octet-stream, Size: 3966 bytes --]
diff -rupN guile-1.8.4.orig/config.h.in guile-1.8.4/config.h.in
--- guile-1.8.4.orig/config.h.in 2008-02-16 16:12:15.000000000 -0600
+++ guile-1.8.4/config.h.in 2008-03-08 17:34:40.229216282 -0600
@@ -432,9 +432,15 @@ Boston, MA 02110-1301, USA.
/* Define to 1 if you have the `pthread_get_stackaddr_np' function. */
#undef HAVE_PTHREAD_GET_STACKADDR_NP
+/* Define to 1 if you have the `pthread_attr_get_np' function. */
+#undef HAVE_PTHREAD_ATTR_GET_NP
+
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
+/* Define to 1 if you have the <pthread_np.h> header file. */
+#undef HAVE_PTHREAD_NP_H
+
/* Define to 1 if you have the `pthread_sigmask' function. */
#undef HAVE_PTHREAD_SIGMASK
diff -rupN guile-1.8.4.orig/configure.in guile-1.8.4/configure.in
--- guile-1.8.4.orig/configure.in 2008-02-16 17:15:18.000000000 -0600
+++ guile-1.8.4/configure.in 2008-03-08 17:34:20.980031818 -0600
@@ -692,10 +692,11 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chs
# sys/param.h - not in mingw
# pthread.h - only available with pthreads. ACX_PTHREAD doesn't
# 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,
# the DECL is checked because Solaris 10 doens't have in any header
#
-AC_CHECK_HEADERS(crypt.h netdb.h pthread.h sys/param.h sys/resource.h sys/file.h)
+AC_CHECK_HEADERS(crypt.h netdb.h pthread.h pthread_np.h sys/param.h sys/resource.h sys/file.h)
AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
AC_CHECK_DECLS([sethostname])
@@ -1185,9 +1186,11 @@ case "$with_threads" in
# all; not present on MacOS X or Solaris 10
# pthread_get_stackaddr_np - "np" meaning "non portable" says it
# 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
#
- 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
# had to write "pthread_once_t foo = { PTHREAD_ONCE_INIT };".
diff -rupN guile-1.8.4.orig/libguile/pthread-threads.h guile-1.8.4/libguile/pthread-threads.h
--- guile-1.8.4.orig/libguile/pthread-threads.h 2007-10-10 11:58:57.000000000 -0500
+++ guile-1.8.4/libguile/pthread-threads.h 2008-03-08 17:36:35.943388334 -0600
@@ -26,6 +26,9 @@
*/
#include <pthread.h>
+#if HAVE_PTHREAD_NP_H
+# include <pthread_np.h>
+#endif
#include <sched.h>
/* Threads
diff -rupN guile-1.8.4.orig/libguile/threads.c guile-1.8.4/libguile/threads.c
--- guile-1.8.4.orig/libguile/threads.c 2007-10-02 11:38:40.000000000 -0500
+++ guile-1.8.4/libguile/threads.c 2008-03-08 17:37:16.099795084 -0600
@@ -593,7 +593,7 @@ scm_i_init_thread_for_guile (SCM_STACKIT
#if SCM_USE_PTHREAD_THREADS
-#if HAVE_PTHREAD_ATTR_GETSTACK && HAVE_PTHREAD_GETATTR_NP
+#if HAVE_PTHREAD_ATTR_GETSTACK && (HAVE_PTHREAD_GETATTR_NP || HAVE_PTHREAD_ATTR_GET_NP)
/* This method for GNU/Linux and perhaps some other systems.
It's not for MacOS X or Solaris 10, since pthread_getattr_np is not
available on them. */
@@ -606,8 +606,15 @@ get_thread_stack_base ()
void *start, *end;
size_t size;
+#if HAVE_PTHREAD_ATTR_GET_NP
+ pthread_attr_init (&attr);
+ pthread_attr_get_np (pthread_self (), &attr);
+ pthread_attr_getstack (&attr, &start, &size);
+ pthread_attr_destroy (&attr);
+#elif HAVE_PTHREAD_GETATTR_NP
pthread_getattr_np (pthread_self (), &attr);
pthread_attr_getstack (&attr, &start, &size);
+#endif
end = (char *)start + size;
/* XXX - pthread_getattr_np from LinuxThreads does not seem to work
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] get_thread_stack_base for FreeBSD
2008-03-09 0:07 [PATCH] get_thread_stack_base for FreeBSD Amatus
@ 2008-03-11 14:52 ` Ludovic Courtès
0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2008-03-11 14:52 UTC (permalink / raw)
To: bug-guile
Hi,
Amatus <c11h15no2@yahoo.com> writes:
> This change adds get_thread_stack_base support for FreeBSD.
Can you explain what it fixes? Doesn't the current method work? Does
it build at all? Does it fail at run-time?
Furthermore, can you summarize your solution: What's <pthread_np.h>?
What's `pthread_attr_get_np ()'?
Sorry but since I don't use FreeBSD, I really need your help to
understand what's currently wrong and how your patch fixes it.
> ************************************************************
> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering to the intended recipient, be advised that you have received this email in error and that any use of the information contained within this email or attachments is strictly prohibited.
> ************************************************************
You are writing to a public mailing list, so this kind of disclaimer is
moot.
Thanks,
Ludovic.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-11 14:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-09 0:07 [PATCH] get_thread_stack_base for FreeBSD Amatus
2008-03-11 14:52 ` Ludovic Courtès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).