1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-04 22:33:27 +00:00
freebsd-ports/devel/linuxthreads/files/README.FreeBSD
Julian Elischer 61b377a1eb Update some of the Documentation files.
Submitted by: "Richard Seaman, Jr." <dick@tar.com>, rcarter@pinyon.org
1999-11-30 20:21:56 +00:00

94 lines
3.8 KiB
Plaintext

Some brief notes:
1) This package is intended to run on FreeBSD 4.0-current or
FreeBSD 3.X, with sources more recent than March 1, 1999, i386
processors only.
Compile your applications that use Linux Threads with the following
command line options:
-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads -llthread
Note that the include (-I..) directive shown here should appear before any other include
directive that would cause the compiler to find the FreeBSD file /usr/include/pthread.h.
Using the FreeBSD pthread.h instead of the linuxthreads pthread.h will result in an app
fails in many odd and maybe spectacular ways.
In order to facilitate porting applications witch expect a libpthread, you can create
the following symlinks if you want:
ln -s /usr/local/lib/liblthread.a /usr/lib/libpthread.a
ln -s /usr/local/lib/liblthread_p.a /usr/lib/libpthread_p.a
ln -s /usr/local/lib/liblthread.so.0 /usr/lib/libpthread.so.0
ln -s /usr/local/lib/liblthread.so.0 /usr/lib/libpthread.so
/sbin/ldconfig -m /usr/lib
If you do this, you can instead use:
-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads -lpthread
or
-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads -kthread
DO NOT use libc_r with Linux Threads, and do not compile/link with
the -pthread option (which pulls in libc_r). DO link with libc
(which you will get by default).
2) You should consider enabling the posix priority extensions
in your kernel. Adding the following to your kernel config
file before you execute config and before you remake the kernel
should suffice.
options "P1003_1B"
options "_KPOSIX_PRIORITY_SCHEDULING"
options "_KPOSIX_VERSION=199309L"
These options are not manditory.
3) If you plan on having lots of threads, check the sysctl value
of kern.maxproc. Each kernel thread counts against maxproc. You
can increase maxproc by changing the MAXUSERS value in your kernel
config file. maxproc is set at 20 + 16 * MAXUSERS.
4) This package should work on a normal SMP machine, however,
there appear to be some problems introduced with the recent changes
to the kernel signal handling, which have yet to be resolved.
5) Be aware of the following libc issues:
a) Not all libc calls are thread safe. Many are.
In particular gmtime, localtime, etc are not thread
safe. In general, where the pthreads spec calls for "_r"
functions, these are either not provided, or if provided
are not thread safe (in most cases) and the related
libc calls are not thread safe. This differs somewhat
from the FreeBSD libc_r library, where some, but not
all, of these functions are both thread safe and have
"_r" versions.
b) None of the libc calls that are supposed to be
cancellation points are implemented as such. There
is a lot of work that needs to be done on libc before
cancellation points will work correctly. Therefore,
while linux threads has the cancel functions implemented,
deferred cancellation will not really do anything, since
the co-operation needed from libc is not there.
6) There is a call implemented for FreeBSD (see stack.c):
int _pthread_setstackspacing(size_t spacing, size_t guardsize)
By default, Linux Threads spaces thread stacks 2MB apart, and
makes each thread stack an "autogrow" stack. If you know that
your maximum stack for any thread can be less than that, you
can decrease the spacing by calling this function. It must
be called before any other pthreads function calls, and it
will only succeed the first time its called. Note that the
pthread TLS and the guardsize will be included in the spacing.
ie. maximum stack size = spacing - TLSpagesize - guardsize.
The spacing must be a power of 2 times the pagesize (and if its
not, it will be rounded up to the next highest value that is).
7) Note that this is an older version of linuxthreads. More current
versions are at http://www.kernel.org/pub/linux/libs/glibc.