diff options
author | Tor Egge <tegge@FreeBSD.org> | 2005-07-22 22:20:21 +0000 |
---|---|---|
committer | Tor Egge <tegge@FreeBSD.org> | 2005-07-22 22:20:21 +0000 |
commit | 20fa307449d9fa0d99a080cc66a5b037f8ca0b78 (patch) | |
tree | a25a5a9e4e6e2741431b6712a2713d885f958a84 /devel/linuxthreads | |
parent | 04202121111cdfaa74e7fa1d89e71a9d42bca813 (diff) | |
download | ports-20fa307449d9fa0d99a080cc66a5b037f8ca0b78.tar.gz ports-20fa307449d9fa0d99a080cc66a5b037f8ca0b78.zip |
Notes
Diffstat (limited to 'devel/linuxthreads')
-rw-r--r-- | devel/linuxthreads/Makefile | 57 | ||||
-rw-r--r-- | devel/linuxthreads/files/README.FreeBSD | 21 | ||||
-rw-r--r-- | devel/linuxthreads/files/_pthreadtypes.h | 45 | ||||
-rw-r--r-- | devel/linuxthreads/files/patch-aa | 67 | ||||
-rw-r--r-- | devel/linuxthreads/files/wraputhread.c | 14 | ||||
-rw-r--r-- | devel/linuxthreads/pkg-descr | 4 | ||||
-rw-r--r-- | devel/linuxthreads/pkg-plist | 2 |
7 files changed, 183 insertions, 27 deletions
diff --git a/devel/linuxthreads/Makefile b/devel/linuxthreads/Makefile index 95b34c8d3b82..d9938fbfca21 100644 --- a/devel/linuxthreads/Makefile +++ b/devel/linuxthreads/Makefile @@ -7,7 +7,7 @@ PORTNAME= linuxthreads PORTVERSION= 2.2.3 -PORTREVISION= 16 +PORTREVISION= 18 CATEGORIES= devel MASTER_SITES= ${MASTER_SITE_GNU} MASTER_SITE_SUBDIR= glibc @@ -25,10 +25,6 @@ USE_PERL5_BUILD=true # This port only works on i386 right now. ONLY_FOR_ARCHS= i386 -.if ${OSVERSION} >= 600031 -BROKEN= "Does not compile on FreeBSD >= 6.0" -.endif - .if ${OSVERSION} < 400015 BROKEN="Requires FreeBSD 4.0 or newer" .endif @@ -36,9 +32,15 @@ BROKEN="Requires FreeBSD 4.0 or newer" USING_GCC3=true MAKE_ENV+= USING_GCC3=true .endif -.if defined(INSTALL_LIBLTHREAD_PIC_ARCHIVE) +.if defined(LINUXTHREADS_INSTALL_LIBLTHREAD_PIC_ARCHIVE) MAKE_ENV+= INSTALL_LIBLTHREAD_PIC_ARCHIVE=yes .endif +.if defined(LINUXTHREADS_MAX_STACK_SIZE) +MAKE_ENV+= LINUXTHREADS_STACK_SIZE=${LINUXTHREADS_MAX_STACK_SIZE} +.endif +.if defined(LINUXTHREADS_MAX_THREADS) +MAKE_ENV+= LINUXTHREADS_MAX_THREADS=${LINUXTHREADS_MAX_THREADS} +.endif .if defined(LINUXTHREADS_DETECT_UNSAFE_EXIT) MAKE_ENV+= LINUXTHREADS_DETECT_UNSAFE_EXIT=yes .endif @@ -49,22 +51,27 @@ MAKE_ENV+= LINUXTHREADS_WRAP_LD="sh ${FILESDIR}/ldwrap" .if defined(LINUXTHREADS_NO_POSIX_PRIORITY_SCHEDULING) MAKE_ENV+= LINUXTHREADS_NO_POSIX_PRIORITY_SCHEDULING=yes .endif +.if defined(LINUXTHREADS_ALT_RESTARTSIG) +MAKE_ENV+= LINUXTHREADS_ALT_RESTARTSIG=${LINUXTHREADS_ALT_RESTARTSIG} +.endif threads_files := README.FreeBSD clone.S clone.h freebsd-compat.h getgr_r.c \ gethostby_r.c getnetby_r.c getprotoby_r.c getpw_r.c getservby_r.c \ lclone.c libc_calls.c libc_thread.c sched.c uthread_file.c \ wraputhread.c localtime.c getlogin.c telldir.c ttyname.c +threads_files2 := _pthreadtypes.h + WRKSRC= ${WRKDIR}/${PKGNAME} SRC_BASE= /usr/src LIBSRC_BASE= ${SRC_BASE}/lib pre-fetch: -.if !defined(WITH_CONDWAIT_PATCH) +.if !defined(LINUXTHREADS_WITH_CONDWAIT_PATCH) @${ECHO} @${ECHO} You can use an experimental patch to reduce the number of @${ECHO} condition variable triggered context switches by defining - @${ECHO} WITH_CONDWAIT_PATCH + @${ECHO} LINUXTHREADS_WITH_CONDWAIT_PATCH @${ECHO} .endif .if !defined(LINUXTHREADS_DETECT_UNSAFE_EXIT) @@ -74,6 +81,20 @@ pre-fetch: @${ECHO} "for more info." @${ECHO} .endif +.if !defined(LINUXTHREADS_MAX_STACK_SIZE) + @${ECHO} + @${ECHO} "The maximum stack size (default 2097152) can be overridden" + @${ECHO} "by defining LINUXTHREADS_MAX_STACK_SIZE," + @${ECHO} "see files/README.FreeBSD for more info." + @${ECHO} +.endif +.if !defined(LINUXTHREADS_MAX_THREADS) + @${ECHO} + @${ECHO} "The maximum number of threads (default 1024) can be" + @${ECHO} "overriden by defining LINUXTHREADS_MAX_THREADS," + @${ECHO} "see files/README.FreeBSD for more info." + @${ECHO} +.endif .if !defined(LINUXTHREADS_WRAP_API) @${ECHO} @${ECHO} "Some conflicts with native threads can be avoided by defining" @@ -88,6 +109,13 @@ pre-fetch: @${ECHO} "see files/README.FreeBSD for more info." @${ECHO} .endif +.if !defined(LINUXTHREADS_ALT_RESTARTSIG) + @${ECHO} + @${ECHO} "An alternate restart signal can be selected by" + @${ECHO} "defining LINUXTHREADS_ALT_RESTARTSIG," + @${ECHO} "see files/README.FreeBSD for more info." + @${ECHO} +.endif @if ${TEST} -f /usr/src/gnu/lib/libgcc/Makefile; then \ : ; \ else \ @@ -124,6 +152,9 @@ post-extract: @${SED} -f ${FILESDIR}/strptime.sed \ /usr/src/lib/libc/stdtime/strptime.c \ > ${WRKSRC}/strptime.c + @${MKDIR} ${WRKSRC}/sys + @cd ${FILESDIR} ; \ + ${CP} -p ${threads_files2} ${WRKSRC}/sys/. @${MKDIR} ${WRKSRC}/libgcc_r @${TEST} -f ${WRKSRC}/libgcc_r/Makefile || \ ${LN} -s ${FILESDIR}/Makefile.libgcc_r ${WRKSRC}/libgcc_r/Makefile @@ -154,9 +185,9 @@ post-extract: ${WRKSRC}/libsupc++/Makefile.inc .endif -.if defined(WITH_CONDWAIT_PATCH) || defined(LINUXTHREADS_WRAP_API) +.if defined(LINUXTHREADS_WITH_CONDWAIT_PATCH) || defined(LINUXTHREADS_WRAP_API) post-patch: -.if defined(WITH_CONDWAIT_PATCH) +.if defined(LINUXTHREADS_WITH_CONDWAIT_PATCH) @${ECHO_MSG} "===> Applying experimental patch condwait-patch" @if ${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/condwait-patch; then \ ${ECHO_MSG} "===> Patch condwait-patch applied successfully"; \ @@ -198,12 +229,12 @@ post-install: # @sh ${PKGINSTALL} ${PKGNAME} POST-INSTALL -.if defined(NOPROFILE) +.if (defined(NOPROFILE) && ${OSVERSION} < 600007) || (defined(NO_PROFILE) && ${OSVERSION} >= 600007) PLIST_SUB= PROFILE:="@comment " .else PLIST_SUB= PROFILE:="" .endif -.if defined(NOPIC) +.if (defined(NOPIC) && ${OSVERSION} < 600007) || (defined(NO_PIC) && ${OSVERSION} >= 600007) PLIST_SUB+= PIC:="@comment " .else PLIST_SUB+= PIC:="" @@ -218,7 +249,7 @@ PLIST_SUB+= LIBLGCC_R_PICARCHIVE:="" .else PLIST_SUB+= LIBLGCC_R_PICARCHIVE:="@comment " .endif -.if defined(INSTALL_PIC_ARCHIVE) || defined(INSTALL_LIBLTHREAD_PIC_ARCHIVE) +.if defined(INSTALL_PIC_ARCHIVE) || defined(LINUXTHREADS_INSTALL_LIBLTHREAD_PIC_ARCHIVE) PLIST_SUB+= LIBLTHREADPICARCHIVE:="" .else PLIST_SUB+= LIBLTHREADPICARCHIVE:="@comment " diff --git a/devel/linuxthreads/files/README.FreeBSD b/devel/linuxthreads/files/README.FreeBSD index d59a697de9d1..7aacaa3b5190 100644 --- a/devel/linuxthreads/files/README.FreeBSD +++ b/devel/linuxthreads/files/README.FreeBSD @@ -138,3 +138,24 @@ set at 20 + 16 * MAXUSERS. as if the kernel was compiled without the _KPOSIX_PRIORITY_SCHEDULING option, but limited to the linuxthread library. +7) libraries using SIGUSR2 or SIGUSR1 will conflict with linuxthreads. + SIGUSR1 is hardcoded in the FreeBSD kernel (cf. RFLINUXTHPN flag + passed to rfork()), but the linuxthreads library can be changed to use + another signal instead of SIGUSR2 by defining LINUXTHREADS_ALT_RESTARTSIG + to the alternate signal number (e.g. 32). + +8) By default, the maximum thread stack size is 2 MB, and the maximum + number of threads is 1024. Layout of stacks are based on the + maximum thread stack size. This means that 2 GB of the address space + can be used by thread stacks, limiting what is left for other + purposes (text, data, bss, heap, mmap). To shrink the address range + used for thread stacks, the maximum thread stack size can be changed + by defining LINUXTHREADS_MAX_STACK_SIZE to a suitable value, e.g. + 1048576. The maximum number of threads can be changed by defining + LINUXTHREADS_MAX_THREADS to a suitable value, e.g. 2048. + The product of the maximum thread stack size and the maximum number + of threads should not exceed 2 GB. The maximum stack size must be + a power of 2. + +9) The complete FreeBSD source code matching the installed userland + must be installed in /usr/src before building linuxthreads. diff --git a/devel/linuxthreads/files/_pthreadtypes.h b/devel/linuxthreads/files/_pthreadtypes.h new file mode 100644 index 000000000000..7b485dc568de --- /dev/null +++ b/devel/linuxthreads/files/_pthreadtypes.h @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2005 Yahoo! Technologies Norway AS + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LINUXTHREADS_SYS__PTHREADTYPES_H +#define _LINUXTHREADS_SYS__PTHREADTYPES_H + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +#include <sched.h> + +#ifdef _BITS_TYPES_H +#include <bits/pthreadtypes.h> +#else +#define _BITS_TYPES_H +#include <bits/pthreadtypes.h> +#undef _BITS_TYPES_H +#endif + +#endif diff --git a/devel/linuxthreads/files/patch-aa b/devel/linuxthreads/files/patch-aa index 58e262ed0b75..31cb50737af6 100644 --- a/devel/linuxthreads/files/patch-aa +++ b/devel/linuxthreads/files/patch-aa @@ -13,7 +13,7 @@ diff -ru ../../work/linuxthreads-2.2.3/Examples/Makefile ./Examples/Makefile diff -ru ../../work/linuxthreads-2.2.3/Makefile ./Makefile --- ../../work/linuxthreads-2.2.3/Makefile Wed Apr 25 21:50:59 2001 +++ ./Makefile Thu Jun 7 23:13:52 2001 -@@ -1,128 +1,126 @@ +@@ -1,128 +1,143 @@ -# Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. -# This file is part of the GNU C Library. +LIB=lthread @@ -65,6 +65,12 @@ diff -ru ../../work/linuxthreads-2.2.3/Makefile ./Makefile +CFLAGS += -DLINUXTHREADS +CFLAGS += -D__USE_UNIX98 +CFLAGS += -D__USE_XOPEN2K -D_STACK_GROWS_DOWN -DNEWLIBC -D_THREAD_SAFE ++.if defined(LINUXTHREADS_MAX_STACK_SIZE) ++CFLAGS += -DSTACK_SIZE=$(LINUXTHREADS_MAX_STACK_SIZE) ++.endif ++.if defined(LINUXTHREADS_MAX_THREADS) ++CFLAGS += -DPTHREAD_THREADS_MAX=$(LINUXTHREADS_MAX_THREADS) ++.endif +.if defined(LINUXTHREADS_DETECT_UNSAFE_EXIT) +CFLAGS += -DLINUXTHREADS_DETECT_UNSAFE_EXIT +.endif @@ -78,6 +84,10 @@ diff -ru ../../work/linuxthreads-2.2.3/Makefile ./Makefile +CFLAGS += -DLINUXTHREADS_NO_POSIX_PRIORITY_SCHEDULING +.endif + ++.if defined(LINUXTHREADS_ALT_RESTARTSIG) ++CFLAGS += -DLINUXTHREADS_ALT_RESTARTSIG=${LINUXTHREADS_ALT_RESTARTSIG} ++.endif ++ +CFLAGS += -I${LIBSRC_BASE}/libc/${MACHINE_ARCH} -I${.CURDIR}/sysdeps/${MACHINE_ARCH} + +# Contents of the library. @@ -115,6 +125,13 @@ diff -ru ../../work/linuxthreads-2.2.3/Makefile ./Makefile + ${.CURDIR}/sysdeps/unix/sysv/linux/bits/$(hdr) \ + ${PREFIX}/include/pthread/linuxthreads/bits/$(hdr) +.endfor ++ ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 0755 \ ++ ${PREFIX}/include/pthread/linuxthreads/sys ++.for hdr in _pthreadtypes.h ++ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ ++ ${.CURDIR}/sys/$(hdr) \ ++ ${PREFIX}/include/pthread/linuxthreads/sys/$(hdr) ++.endfor +.for hdr in pt-machine.h useldt.h + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ + ${.CURDIR}/sysdeps/i386/$(hdr) \ @@ -749,13 +766,17 @@ diff -ru ../../work/linuxthreads-2.2.3/pthread.c ./pthread.c static void pthread_handle_sigcancel(int sig); static void pthread_handle_sigrestart(int sig); static void pthread_handle_sigdebug(int sig); -@@ -238,8 +246,8 @@ +@@ -238,8 +246,12 @@ #ifndef __SIGRTMIN static int current_rtmin = -1; static int current_rtmax = -1; -int __pthread_sig_restart = SIGUSR1; -int __pthread_sig_cancel = SIGUSR2; ++#ifdef LINUXTHREADS_ALT_RESTARTSIG ++int __pthread_sig_restart = LINUXTHREADS_ALT_RESTARTSIG; ++#else +int __pthread_sig_restart = SIGUSR2; ++#endif +int __pthread_sig_cancel = SIGUSR1; int __pthread_sig_debug; #else @@ -1105,7 +1126,15 @@ diff -ru ../../work/linuxthreads-2.2.3/signals.c ./signals.c { pthread_descr self; char * in_sighandler; -@@ -145,9 +144,9 @@ +@@ -130,6 +129,7 @@ + { + struct sigaction newact; + struct sigaction *newactp; ++ arch_sighandler_t user_oact; + + if (sig == __pthread_sig_restart || + sig == __pthread_sig_cancel || +@@ -145,20 +145,34 @@ && sig > 0 && sig < NSIG) { if (act->sa_flags & SA_SIGINFO) @@ -1117,12 +1146,30 @@ diff -ru ../../work/linuxthreads-2.2.3/signals.c ./signals.c } newactp = &newact; } -@@ -158,7 +157,7 @@ + else + newactp = NULL; ++ if (sig > 0 && sig < NSIG) ++ { ++ user_oact = sighandler[sig].old; ++ if (act && ++ ((__sighandler_t *) user_oact == SIG_IGN || ++ (__sighandler_t *) user_oact == SIG_DFL)) ++ /* For the assignment is does not matter whether it's a normal ++ or real-time signal. */ ++ sighandler[sig].old = (arch_sighandler_t) act->sa_handler; ++ } + if (__libc_sigaction(sig, newactp, oact) == -1) +- return -1; ++ { ++ if (act && sig > 0 && sig < NSIG) ++ sighandler[sig].old = user_oact; ++ return -1; ++ } if (sig > 0 && sig < NSIG) { if (oact != NULL) - oact->sa_handler = (__sighandler_t) sighandler[sig].old; -+ oact->sa_handler = (__sighandler_t *) sighandler[sig].old; ++ oact->sa_handler = (__sighandler_t *) user_oact; if (act) /* For the assignment is does not matter whether it's a normal or real-time signal. */ @@ -1225,6 +1272,16 @@ diff -ru ../../work/linuxthreads-2.2.3/sysdeps/unix/sysv/linux/bits/local_lim.h /* Have to remove NR_OPEN? */ #ifdef __undef_NR_OPEN +@@ -64,7 +64,9 @@ + /* The number of threads per process. */ + #define _POSIX_THREAD_THREADS_MAX 64 + /* This is the value this implementation supports. */ ++#ifndef PTHREAD_THREADS_MAX + #define PTHREAD_THREADS_MAX 1024 ++#endif + + /* Maximum amount by which a process can descrease its asynchronous I/O + priority level. */ diff -ru ../../work/linuxthreads-2.2.3/sysdeps/unix/sysv/linux/bits/sigthread.h ./sysdeps/unix/sysv/linux/bits/sigthread.h --- ../../work/linuxthreads-2.2.3/sysdeps/unix/sysv/linux/bits/sigthread.h Thu Aug 31 21:45:04 2000 +++ ./sysdeps/unix/sysv/linux/bits/sigthread.h Thu Jun 7 22:59:29 2001 diff --git a/devel/linuxthreads/files/wraputhread.c b/devel/linuxthreads/files/wraputhread.c index 0394f53ba07f..b59c2cae4a82 100644 --- a/devel/linuxthreads/files/wraputhread.c +++ b/devel/linuxthreads/files/wraputhread.c @@ -1,4 +1,6 @@ /* + * Copyright (c) 2005 Yahoo! Technologies Norway AS + * Copyright (c) 2003 Overture Services Norway AS * Copyright (c) 2001 Daniel Eischen <deischen@FreeBSD.org>. * All rights reserved. * @@ -23,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: /tmp/pcvs/ports/devel/linuxthreads/files/wraputhread.c,v 1.3 2003-06-09 03:48:31 tegge Exp $ + * $FreeBSD: /tmp/pcvs/ports/devel/linuxthreads/files/wraputhread.c,v 1.4 2005-07-22 22:20:21 tegge Exp $ */ #ifdef LINUXTHREADS_WRAP_API @@ -242,14 +244,14 @@ enum { }; enum { - UTHREAD_PTHREAD_INHERIT_SCHED = 0, - UTHREAD_PTHREAD_EXPLICIT_SCHED = 1 + UTHREAD_PTHREAD_INHERIT_SCHED = 4, + UTHREAD_PTHREAD_EXPLICIT_SCHED = 0 }; enum { - UTHREAD_PTHREAD_SCOPE_SYSTEM = 0, - UTHREAD_PTHREAD_SCOPE_PROCESS = 1 + UTHREAD_PTHREAD_SCOPE_SYSTEM = 2, + UTHREAD_PTHREAD_SCOPE_PROCESS = 0 }; enum { @@ -1050,8 +1052,6 @@ _pthread_getspecific(pthread_key_t key) int _pthread_join(pthread_t tid, void **treturn) { - if (treturn == NULL) - return EINVAL; return __pthread_join(tid, treturn); } diff --git a/devel/linuxthreads/pkg-descr b/devel/linuxthreads/pkg-descr index 889fdda33eae..69652339201d 100644 --- a/devel/linuxthreads/pkg-descr +++ b/devel/linuxthreads/pkg-descr @@ -10,5 +10,5 @@ LinuxThreads implementation see: Note that LinuxThreads has been integrated with the GNU C library (glibc) since version 2.0, so the above URL points to dated information. -The FreeBSD source code should be installed in /usr/src before building -linuxthreads. +The complete FreeBSD source code matching the installed userland +must be installed in /usr/src before building linuxthreads. diff --git a/devel/linuxthreads/pkg-plist b/devel/linuxthreads/pkg-plist index 2873ab232559..9cf633ab2ad1 100644 --- a/devel/linuxthreads/pkg-plist +++ b/devel/linuxthreads/pkg-plist @@ -26,7 +26,9 @@ include/pthread/linuxthreads/bits/stdio-lock.h include/pthread/linuxthreads/bits/local_lim.h include/pthread/linuxthreads/bits/posix_opt.h include/pthread/linuxthreads/bits/sigthread.h +include/pthread/linuxthreads/sys/_pthreadtypes.h @exec /sbin/ldconfig -m %D/lib +@dirrm include/pthread/linuxthreads/sys @dirrm include/pthread/linuxthreads/bits @dirrm include/pthread/linuxthreads @dirrm include/pthread |