1999-11-30 09:07:29 +00:00
|
|
|
Some brief notes:
|
|
|
|
|
2000-05-24 04:14:41 +00:00
|
|
|
1) This package is intended to run on FreeBSD 5.0-current or
|
|
|
|
FreeBSD 4.X i386 processors only.
|
1999-11-30 09:07:29 +00:00
|
|
|
|
2000-05-24 04:14:41 +00:00
|
|
|
Compile your applications that use LinuxThreads with the following
|
1999-11-30 20:21:56 +00:00
|
|
|
command line options:
|
1999-11-30 09:07:29 +00:00
|
|
|
|
1999-12-24 01:12:08 +00:00
|
|
|
-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads -llthread -llgcc_r
|
1999-11-30 09:07:29 +00:00
|
|
|
|
1999-12-24 01:12:08 +00:00
|
|
|
Note that the include (-I<path>) 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 fails in many odd and maybe spectacular
|
|
|
|
ways.
|
1999-11-30 09:07:29 +00:00
|
|
|
|
1999-12-24 01:12:08 +00:00
|
|
|
In order to facilitate porting applications which expect a libpthread, you can
|
|
|
|
create the following symlinks if you want:
|
1999-11-30 20:21:56 +00:00
|
|
|
|
1999-12-24 01:12:08 +00:00
|
|
|
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.2 /usr/lib/libpthread.so.2
|
|
|
|
ln -s /usr/local/lib/liblthread.so.0 /usr/lib/libpthread.so
|
|
|
|
/sbin/ldconfig -m /usr/lib
|
1999-11-30 20:21:56 +00:00
|
|
|
|
|
|
|
If you do this, you can instead use:
|
|
|
|
|
1999-12-24 01:12:08 +00:00
|
|
|
-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads -lpthread -llgcc_r
|
1999-11-30 20:21:56 +00:00
|
|
|
or
|
1999-12-24 01:12:08 +00:00
|
|
|
-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads -kthread -llgcc_r
|
1999-11-30 20:21:56 +00:00
|
|
|
|
2000-05-24 04:14:41 +00:00
|
|
|
Do not use libc_r with LinuxThreads, and do not compile/link with the -pthread
|
1999-12-24 01:12:08 +00:00
|
|
|
option (which pulls in libc_r). Rather, link with libc (which you will get by
|
|
|
|
default).
|
1999-11-30 09:07:29 +00:00
|
|
|
|
1999-12-24 01:12:08 +00:00
|
|
|
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 re-make the kernel should suffice.
|
1999-11-30 09:07:29 +00:00
|
|
|
|
|
|
|
options "P1003_1B"
|
|
|
|
options "_KPOSIX_PRIORITY_SCHEDULING"
|
|
|
|
options "_KPOSIX_VERSION=199309L"
|
|
|
|
|
1999-12-24 01:12:08 +00:00
|
|
|
These options are not mandatory.
|
1999-11-30 09:07:29 +00:00
|
|
|
|
1999-12-24 01:12:08 +00:00
|
|
|
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.
|
1999-11-30 09:07:29 +00:00
|
|
|
|
1999-12-04 18:45:00 +00:00
|
|
|
4) Be aware of the following libc issues:
|
1999-11-30 09:07:29 +00:00
|
|
|
|
1999-12-24 01:12:08 +00:00
|
|
|
a) Not all libc calls are thread safe. 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) Not all of the libc calls that are supposed to be cancellation points are
|
2000-05-24 04:14:41 +00:00
|
|
|
implemented as such. While linux threads has the cancel functions
|
|
|
|
implemented, deferred cancellation will not work as required by POSIX
|
|
|
|
1003.1c-1995, since the co-operation needed from libc is not complete.
|
1999-12-24 01:12:08 +00:00
|
|
|
|
|
|
|
5) Known problems and issues:
|
|
|
|
|
2000-05-24 04:14:41 +00:00
|
|
|
It is possible that the instructions given above for including liblgcc_r
|
1999-12-24 01:12:08 +00:00
|
|
|
are not sufficent. liblgcc_r is a version of libgcc_r linked against this
|
|
|
|
linuxthreads package. It is intended that applications link against this,
|
|
|
|
rather than libgcc_r (which is linked against libc_r) or libgcc (which is not
|
|
|
|
thread safe).
|
|
|
|
|
|
|
|
The normal gcc link options cause libgcc to be included twice in the link line
|
|
|
|
(and libgcc_r twice when linking with the -pthread option). It is therefore
|
|
|
|
possible that a custom link line needs to be generated that specifically
|
|
|
|
excludes the default libgcc and which includes liblgcc_r twice. There are no
|
|
|
|
known problems resulting from the link procedure suggested above. However,
|
2000-05-24 04:14:41 +00:00
|
|
|
compiling/linking with the "-v" option will illustrate the issue, where libgcc
|
1999-12-24 01:12:08 +00:00
|
|
|
is included twice in addition to liblgcc_r.
|