33 Commits

Author SHA1 Message Date
7a138c6d80 WIP 2018-07-29 15:45:45 +02:00
291f1cd8c3 pthreads wip 2018-01-21 09:59:02 +01:00
4093f9857a Remove unnecessary patch 4 2018-01-21 09:56:17 +01:00
38ba81e87f Remove unnecessary patch 3 2018-01-21 09:56:04 +01:00
428c4f0fc8 Remove unnecessary patch 2 2018-01-21 09:53:56 +01:00
837396d38c Remove unnecessary patch 2018-01-21 09:51:26 +01:00
8138e16526 libc: Drop commented out patch 2018-01-07 20:16:39 +01:00
6bee946b37 pthread_ enabling tls, not yet working 2018-01-07 20:16:07 +01:00
8e9c072e44 Updating distrib sets 2018-01-04 08:17:58 +01:00
7f03957e75 libc_pthread_fix 2018-01-03 23:15:46 +01:00
c0907f494b pthread_mi_lists 2018-01-03 23:15:29 +01:00
962565259d xz fixes 2018-01-03 23:13:50 +01:00
31db02c17d X11 fixes 2018-01-03 23:13:28 +01:00
d72a587778 Remove a circular dependency in headers 2018-01-02 21:49:00 +01:00
5097ca635a Replace i16_t by int16_t 2018-01-02 21:48:54 +01:00
851b44975e Replace i32_t by int32_t 2018-01-02 21:48:48 +01:00
afcc707b2b Replace u64_t by uint64_t 2018-01-02 21:48:27 +01:00
7b6f6eb8b6 Replace u32_t by uint32_t 2018-01-02 21:44:33 +01:00
662d40e304 Replace u16_t by uint16_t 2018-01-02 21:44:26 +01:00
925bb832c4 Replace u8_t by uint8_t 2018-01-02 21:44:19 +01:00
798554fd92 Still removing pthread patches 2018-01-02 13:12:24 +01:00
dc28ad6910 pthread wip 2017-11-27 03:08:20 +00:00
7b560afcf0 Remove pthread patches for Xorg 2017-11-26 11:31:22 +00:00
09f6dfc808 Remove compat support from mthread 2017-11-26 11:26:22 +00:00
ae9be57160 Remove pthread patches from libc++ 2017-11-26 08:17:07 +00:00
7aa4cea6f7 h_exit now passes 2017-11-23 07:13:00 +00:00
f64c80da9a pthread_wip 2017-10-16 10:28:24 +00:00
0686959e93 fix remove _REENTRANT 2017-09-20 02:43:38 +00:00
db6b37260c WIP 2017-09-20 02:32:31 +00:00
54a7d18c67 libpthread compiles, with empty stubs 2017-06-19 01:05:41 +00:00
9815ad49a1 Enable pthread_kill prototype 2017-06-19 00:36:41 +00:00
6a278b1af0 Remove disabling of the reentrant macros 2017-06-18 20:11:22 +00:00
aa2076a2eb pthread yet again 2017-05-12 17:53:28 +00:00
609 changed files with 19452 additions and 4962 deletions

View File

@@ -1,17 +0,0 @@
# Build MINIX/arm with clang
It is now possible to build a full minix distribution for BeaglBone White/Black and BeagleBoardxM using clang instead of GCC.
This also add support to run the Kuya tests on ARM, which was not possible when GCC was used, because of problems in the C++ exception handling.
## Known Bugs
The following tests still fails:
1. 53: Division by zero does not trigger exceptions
2. 75: ru.tv_secs can't be zero (and is zero)
3. 85: hangs
4. isofs: Fails because of an out of memory condition
5. vnd: crash
6. Running two times the kyua tests in a row, without rebooting in between will lead to a mostly failed second run because of copy-on-write errors.

View File

@@ -81,9 +81,6 @@
./usr/include/arm/vm.h minix-comp
./usr/include/arm/vmparam.h minix-comp
./usr/include/arm/wchar_limits.h minix-comp
./usr/include/clang-3.6/arm_acle.h minix-comp llvm,llvmcmds
./usr/include/clang-3.6/arm_neon.h minix-comp llvm,llvmcmds
./usr/include/clang-3.6/stdatomic.h minix-comp llvm,llvmcmds
./usr/include/evbarm minix-comp
./usr/include/evbarm/disklabel.h minix-comp
./usr/include/evbarm/intr.h minix-comp

View File

@@ -1510,6 +1510,9 @@
./usr/include/protocols/rwhod.h minix-comp
./usr/include/protocols/talkd.h minix-comp
./usr/include/protocols/timed.h minix-comp
./usr/include/pthread.h minix-comp
./usr/include/pthread_queue.h minix-comp
./usr/include/pthread_types.h minix-comp
./usr/include/puffs.h minix-comp
./usr/include/pwd.h minix-comp
./usr/include/quota.h minix-comp
@@ -2052,6 +2055,11 @@
./usr/lib/libelf_pic.a minix-comp
./usr/lib/libevent.a minix-comp
./usr/lib/libevent_pic.a minix-comp
./usr/lib/libevent_pthreads.a minix-comp
./usr/lib/libevent_pthreads.so minix-comp
./usr/lib/libevent_pthreads.so.4 minix-comp
./usr/lib/libevent_pthreads.so.4.0 minix-comp
./usr/lib/libevent_pthreads_pic.a minix-comp
./usr/lib/libexec.a minix-comp
./usr/lib/libexec_pic.a minix-comp
./usr/lib/libexecinfo.a minix-comp
@@ -2119,6 +2127,11 @@
./usr/lib/libpci_pic.a minix-comp
./usr/lib/libprop.a minix-comp
./usr/lib/libprop_pic.a minix-comp
./usr/lib/libpthread.a minix-comp
./usr/lib/libpthread.so minix-comp
./usr/lib/libpthread.so.1 minix-comp
./usr/lib/libpthread.so.1.2 minix-comp
./usr/lib/libpthread_pic.a minix-comp
./usr/lib/libpuffs.a minix-comp
./usr/lib/libpuffs_pic.a minix-comp
./usr/lib/librefuse.a minix-comp

View File

@@ -836,6 +836,7 @@
./usr/man/man3/addnstr.3 minix-man
./usr/man/man3/addr.3 minix-man
./usr/man/man3/addstr.3 minix-man
./usr/man/man3/affinity.3 minix-man
./usr/man/man3/alarm.3 minix-man
./usr/man/man3/alloca.3 minix-man
./usr/man/man3/allocaddrinfo.3 minix-man
@@ -2657,7 +2658,111 @@
./usr/man/man3/proplib.3 minix-man
./usr/man/man3/psiginfo.3 minix-man
./usr/man/man3/psignal.3 minix-man
./usr/man/man3/pthread.3 minix-man
./usr/man/man3/pthread_atfork.3 minix-man
./usr/man/man3/pthread_attr.3 minix-man
./usr/man/man3/pthread_attr_destroy.3 minix-man
./usr/man/man3/pthread_attr_get_np.3 minix-man
./usr/man/man3/pthread_attr_getdetachstate.3 minix-man
./usr/man/man3/pthread_attr_getguardsize.3 minix-man
./usr/man/man3/pthread_attr_getinheritsched.3 minix-man
./usr/man/man3/pthread_attr_getname_np.3 minix-man
./usr/man/man3/pthread_attr_getschedparam.3 minix-man
./usr/man/man3/pthread_attr_getschedpolicy.3 minix-man
./usr/man/man3/pthread_attr_getscope.3 minix-man
./usr/man/man3/pthread_attr_getstack.3 minix-man
./usr/man/man3/pthread_attr_getstackaddr.3 minix-man
./usr/man/man3/pthread_attr_getstacksize.3 minix-man
./usr/man/man3/pthread_attr_init.3 minix-man
./usr/man/man3/pthread_attr_setcreatesuspend_np.3 minix-man
./usr/man/man3/pthread_attr_setdetachstate.3 minix-man
./usr/man/man3/pthread_attr_setguardsize.3 minix-man
./usr/man/man3/pthread_attr_setinheritsched.3 minix-man
./usr/man/man3/pthread_attr_setname_np.3 minix-man
./usr/man/man3/pthread_attr_setschedparam.3 minix-man
./usr/man/man3/pthread_attr_setschedpolicy.3 minix-man
./usr/man/man3/pthread_attr_setscope.3 minix-man
./usr/man/man3/pthread_attr_setstack.3 minix-man
./usr/man/man3/pthread_attr_setstackaddr.3 minix-man
./usr/man/man3/pthread_attr_setstacksize.3 minix-man
./usr/man/man3/pthread_barrier.3 minix-man
./usr/man/man3/pthread_barrier_destroy.3 minix-man
./usr/man/man3/pthread_barrier_init.3 minix-man
./usr/man/man3/pthread_barrier_wait.3 minix-man
./usr/man/man3/pthread_barrierattr.3 minix-man
./usr/man/man3/pthread_barrierattr_destroy.3 minix-man
./usr/man/man3/pthread_barrierattr_init.3 minix-man
./usr/man/man3/pthread_cancel.3 minix-man
./usr/man/man3/pthread_cleanup_pop.3 minix-man
./usr/man/man3/pthread_cleanup_push.3 minix-man
./usr/man/man3/pthread_cond.3 minix-man
./usr/man/man3/pthread_cond_broadcast.3 minix-man
./usr/man/man3/pthread_cond_destroy.3 minix-man
./usr/man/man3/pthread_cond_init.3 minix-man
./usr/man/man3/pthread_cond_signal.3 minix-man
./usr/man/man3/pthread_cond_timedwait.3 minix-man
./usr/man/man3/pthread_cond_wait.3 minix-man
./usr/man/man3/pthread_condattr.3 minix-man
./usr/man/man3/pthread_condattr_destroy.3 minix-man
./usr/man/man3/pthread_condattr_init.3 minix-man
./usr/man/man3/pthread_condattr_setclock.3 minix-man
./usr/man/man3/pthread_create.3 minix-man
./usr/man/man3/pthread_curcpu_np.3 minix-man
./usr/man/man3/pthread_detach.3 minix-man
./usr/man/man3/pthread_equal.3 minix-man
./usr/man/man3/pthread_exit.3 minix-man
./usr/man/man3/pthread_getaffinity_np.3 minix-man
./usr/man/man3/pthread_getattr_np.3 minix-man
./usr/man/man3/pthread_getname_np.3 minix-man
./usr/man/man3/pthread_getschedparam.3 minix-man
./usr/man/man3/pthread_getspecific.3 minix-man
./usr/man/man3/pthread_join.3 minix-man
./usr/man/man3/pthread_key_create.3 minix-man
./usr/man/man3/pthread_key_delete.3 minix-man
./usr/man/man3/pthread_kill.3 minix-man
./usr/man/man3/pthread_mutex.3 minix-man
./usr/man/man3/pthread_mutex_destroy.3 minix-man
./usr/man/man3/pthread_mutex_init.3 minix-man
./usr/man/man3/pthread_mutex_lock.3 minix-man
./usr/man/man3/pthread_mutex_trylock.3 minix-man
./usr/man/man3/pthread_mutex_unlock.3 minix-man
./usr/man/man3/pthread_mutexattr.3 minix-man
./usr/man/man3/pthread_mutexattr_destroy.3 minix-man
./usr/man/man3/pthread_mutexattr_gettype.3 minix-man
./usr/man/man3/pthread_mutexattr_init.3 minix-man
./usr/man/man3/pthread_mutexattr_settype.3 minix-man
./usr/man/man3/pthread_once.3 minix-man
./usr/man/man3/pthread_resume_np.3 minix-man
./usr/man/man3/pthread_rwlock.3 minix-man
./usr/man/man3/pthread_rwlock_destroy.3 minix-man
./usr/man/man3/pthread_rwlock_init.3 minix-man
./usr/man/man3/pthread_rwlock_rdlock.3 minix-man
./usr/man/man3/pthread_rwlock_timedrdlock.3 minix-man
./usr/man/man3/pthread_rwlock_timedwrlock.3 minix-man
./usr/man/man3/pthread_rwlock_tryrdlock.3 minix-man
./usr/man/man3/pthread_rwlock_trywrlock.3 minix-man
./usr/man/man3/pthread_rwlock_unlock.3 minix-man
./usr/man/man3/pthread_rwlock_wrlock.3 minix-man
./usr/man/man3/pthread_rwlockattr.3 minix-man
./usr/man/man3/pthread_rwlockattr_destroy.3 minix-man
./usr/man/man3/pthread_rwlockattr_init.3 minix-man
./usr/man/man3/pthread_schedparam.3 minix-man
./usr/man/man3/pthread_self.3 minix-man
./usr/man/man3/pthread_setaffinity_np.3 minix-man
./usr/man/man3/pthread_setcancelstate.3 minix-man
./usr/man/man3/pthread_setcanceltype.3 minix-man
./usr/man/man3/pthread_setname_np.3 minix-man
./usr/man/man3/pthread_setschedparam.3 minix-man
./usr/man/man3/pthread_setspecific.3 minix-man
./usr/man/man3/pthread_sigmask.3 minix-man
./usr/man/man3/pthread_spin.3 minix-man
./usr/man/man3/pthread_spin_destroy.3 minix-man
./usr/man/man3/pthread_spin_init.3 minix-man
./usr/man/man3/pthread_spin_lock.3 minix-man
./usr/man/man3/pthread_spin_trylock.3 minix-man
./usr/man/man3/pthread_spin_unlock.3 minix-man
./usr/man/man3/pthread_suspend_np.3 minix-man
./usr/man/man3/pthread_testcancel.3 minix-man
./usr/man/man3/ptsname.3 minix-man
./usr/man/man3/ptsname_r.3 minix-man
./usr/man/man3/puffs.3 minix-man

View File

@@ -1,9 +0,0 @@
#
# Sorted using sort_set.pl in releasetools.
# to add an entry simply add it at the end of the
# file and run
# ../../../../releasetools/sort_set.pl < mi > out
# mv out mi
#
./usr/tests/minix-posix/test_arm_segfault minix-tests
./usr/tests/minix-posix/test_arm_unaligned minix-tests

View File

@@ -2927,46 +2927,46 @@
./usr/tests/lib/libprop/Kyuafile tests-lib-tests compattestfile,atf,kyua
./usr/tests/lib/libprop/t_basic tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/Atffile tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/Kyuafile tests-lib-tests compattestfile,atf,kyua,minix-false
./usr/tests/lib/libpthread/d_mach tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/Atffile tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/Kyuafile tests-lib-tests compattestfile,atf,kyua
./usr/tests/lib/libpthread/d_mach tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/dlopen tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/dlopen/Atffile tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/dlopen/Kyuafile tests-lib-tests compattestfile,atf,kyua,minix-false
./usr/tests/lib/libpthread/dlopen/h_pthread_dlopen.so tests-lib-tests compattestfile,atf,pic,minix-false
./usr/tests/lib/libpthread/dlopen/h_pthread_dlopen.so.1 tests-lib-tests compattestfile,atf,pic,minix-false
./usr/tests/lib/libpthread/dlopen/t_dlopen tests-lib-tests compattestfile,atf,pic,minix-false
./usr/tests/lib/libpthread/dlopen/t_dso_pthread_create tests-lib-tests compattestfile,atf,pic,minix-false
./usr/tests/lib/libpthread/dlopen/t_main_pthread_create tests-lib-tests compattestfile,atf,pic,minix-false
./usr/tests/lib/libpthread/h_atexit tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/h_cancel tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/h_exit tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/h_resolv tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_atexit tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_barrier tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_cancel tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_cond tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_condwait tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_detach tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_equal tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_exit tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_fork tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_fpu tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_join tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_kill tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_mutex tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_name tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_once tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_preempt tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_resolv tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_rwlock tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/dlopen/Atffile tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/dlopen/Kyuafile tests-lib-tests compattestfile,atf,kyua
./usr/tests/lib/libpthread/dlopen/h_pthread_dlopen.so tests-lib-tests compattestfile,atf,pic
./usr/tests/lib/libpthread/dlopen/h_pthread_dlopen.so.1 tests-lib-tests compattestfile,atf,pic
./usr/tests/lib/libpthread/dlopen/t_dlopen tests-lib-tests compattestfile,atf,pic
./usr/tests/lib/libpthread/dlopen/t_dso_pthread_create tests-lib-tests compattestfile,atf,pic
./usr/tests/lib/libpthread/dlopen/t_main_pthread_create tests-lib-tests compattestfile,atf,pic
./usr/tests/lib/libpthread/h_atexit tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/h_cancel tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/h_exit tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/h_resolv tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_atexit tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_barrier tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_cancel tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_cond tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_condwait tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_detach tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_equal tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_exit tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_fork tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_fpu tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_join tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_kill tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_mutex tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_name tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_once tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_preempt tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_resolv tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_rwlock tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_sem tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_siglongjmp tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_sigmask tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_sigsuspend tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_sleep tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_status tests-obsolete obsolete,minix-false
./usr/tests/lib/libpthread/t_swapcontext tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/libpthread/t_siglongjmp tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_sigmask tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_sigsuspend tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_sleep tests-lib-tests compattestfile,atf
./usr/tests/lib/libpthread/t_status tests-obsolete obsolete
./usr/tests/lib/libpthread/t_swapcontext tests-lib-tests compattestfile,atf
./usr/tests/lib/librt tests-lib-tests compattestfile,atf
./usr/tests/lib/librt/Atffile tests-lib-tests compattestfile,atf,minix-false
./usr/tests/lib/librt/Kyuafile tests-lib-tests compattestfile,atf,kyua,minix-false

View File

@@ -1625,7 +1625,7 @@
./usr/X11R7/lib/X11/app-defaults/Beforelight -unknown- xorg
./usr/X11R7/lib/X11/app-defaults/Bitmap -unknown- xorg
./usr/X11R7/lib/X11/app-defaults/Bitmap-color -unknown- xorg
./usr/X11R7/lib/X11/app-defaults/Chooser -unknown- xorg,minix-false
./usr/X11R7/lib/X11/app-defaults/Chooser -unknown- xorg
./usr/X11R7/lib/X11/app-defaults/Clock-color -unknown- xorg
./usr/X11R7/lib/X11/app-defaults/Editres -unknown- xorg
./usr/X11R7/lib/X11/app-defaults/Editres-color -unknown- xorg
@@ -2578,7 +2578,7 @@
./usr/X11R7/lib/xorg base-x11-root xorg
./usr/X11R7/lib/xorg/protocol.txt -unknown- xorg
./usr/X11R7/libexec base-x11-root xorg
./usr/X11R7/libexec/chooser -unknown- xorg,minix-false
./usr/X11R7/libexec/chooser -unknown- xorg
./usr/X11R7/man base-x11-root xorg
./usr/X11R7/man/cat1 base-x11-root xorg
./usr/X11R7/man/cat1/appres.0 -unknown- .cat,xorg

View File

@@ -390,15 +390,15 @@
./usr/X11R7/lib/libxcb-record.so -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-record.so.0 -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-record.so.0.1 -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-render-util.so -unknown- xorg,compatx11file,minix-false
./usr/X11R7/lib/libxcb-render-util.so.0 -unknown- xorg,compatx11file,minix-false
./usr/X11R7/lib/libxcb-render-util.so.0.0 -unknown- xorg,compatx11file,minix-false
./usr/X11R7/lib/libxcb-render-util.so -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-render-util.so.0 -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-render-util.so.0.0 -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-render.so -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-render.so.0 -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-render.so.0.1 -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-reply.so -unknown- xorg,compatx11file,minix-false
./usr/X11R7/lib/libxcb-reply.so.1 -unknown- xorg,compatx11file,minix-false
./usr/X11R7/lib/libxcb-reply.so.1.0 -unknown- xorg,compatx11file,minix-false
./usr/X11R7/lib/libxcb-reply.so -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-reply.so.1 -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-reply.so.1.0 -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-res.so -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-res.so.0 -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-res.so.0.1 -unknown- xorg,compatx11file

View File

@@ -6319,11 +6319,11 @@
./usr/X11R7/lib/libxcb-randr_p.a -unknown- profile,xorg,compatx11file
./usr/X11R7/lib/libxcb-record.a -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-record_p.a -unknown- profile,xorg,compatx11file
./usr/X11R7/lib/libxcb-render-util.a -unknown- xorg,compatx11file,minix-false
./usr/X11R7/lib/libxcb-render-util.a -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-render-util_p.a -unknown- profile,xorg,compatx11file
./usr/X11R7/lib/libxcb-render.a -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-render_p.a -unknown- profile,xorg,compatx11file
./usr/X11R7/lib/libxcb-reply.a -unknown- xorg,compatx11file,minix-false
./usr/X11R7/lib/libxcb-reply.a -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-reply_p.a -unknown- profile,xorg,compatx11file
./usr/X11R7/lib/libxcb-res.a -unknown- xorg,compatx11file
./usr/X11R7/lib/libxcb-res_p.a -unknown- profile,xorg,compatx11file
@@ -6422,8 +6422,8 @@
./usr/X11R7/lib/pkgconfig/xcb-randr.pc -unknown- xorg
./usr/X11R7/lib/pkgconfig/xcb-record.pc -unknown- xorg
./usr/X11R7/lib/pkgconfig/xcb-render.pc -unknown- xorg
./usr/X11R7/lib/pkgconfig/xcb-renderutil.pc -unknown- xorg,minix-false
./usr/X11R7/lib/pkgconfig/xcb-reply.pc -unknown- xorg,minix-false
./usr/X11R7/lib/pkgconfig/xcb-renderutil.pc -unknown- xorg
./usr/X11R7/lib/pkgconfig/xcb-reply.pc -unknown- xorg
./usr/X11R7/lib/pkgconfig/xcb-res.pc -unknown- xorg
./usr/X11R7/lib/pkgconfig/xcb-screensaver.pc -unknown- xorg
./usr/X11R7/lib/pkgconfig/xcb-shape.pc -unknown- xorg

View File

@@ -125,9 +125,9 @@
./usr/X11R7/lib/libxcb-property_pic.a -unknown- xorg,picinstall,compatx11file
./usr/X11R7/lib/libxcb-randr_pic.a -unknown- xorg,picinstall,compatx11file
./usr/X11R7/lib/libxcb-record_pic.a -unknown- xorg,picinstall,compatx11file
./usr/X11R7/lib/libxcb-render-util_pic.a -unknown- xorg,picinstall,compatx11file,minix-false
./usr/X11R7/lib/libxcb-render-util_pic.a -unknown- xorg,picinstall,compatx11file
./usr/X11R7/lib/libxcb-render_pic.a -unknown- xorg,picinstall,compatx11file
./usr/X11R7/lib/libxcb-reply_pic.a -unknown- xorg,picinstall,compatx11file,minix-false
./usr/X11R7/lib/libxcb-reply_pic.a -unknown- xorg,picinstall,compatx11file
./usr/X11R7/lib/libxcb-res_pic.a -unknown- xorg,picinstall,compatx11file
./usr/X11R7/lib/libxcb-screensaver_pic.a -unknown- xorg,picinstall,compatx11file
./usr/X11R7/lib/libxcb-shape_pic.a -unknown- xorg,picinstall,compatx11file

View File

@@ -409,8 +409,8 @@
./usr/X11R7/lib/modules/dri/r200_dri.so.0 -unknown- xorg
./usr/X11R7/lib/modules/dri/r300_dri.so -unknown- xorg
./usr/X11R7/lib/modules/dri/r300_dri.so.0 -unknown- xorg
./usr/X11R7/lib/modules/dri/r600_dri.so -unknown- xorg,minix-false
./usr/X11R7/lib/modules/dri/r600_dri.so.0 -unknown- xorg,minix-false
./usr/X11R7/lib/modules/dri/r600_dri.so -unknown- xorg
./usr/X11R7/lib/modules/dri/r600_dri.so.0 -unknown- xorg
./usr/X11R7/lib/modules/dri/radeon_dri.so -unknown- xorg
./usr/X11R7/lib/modules/dri/radeon_dri.so.0 -unknown- xorg
./usr/X11R7/lib/modules/dri/s3v_dri.so -unknown- obsolete

View File

@@ -60,12 +60,12 @@
./usr/X11R7/lib/modules/dri/libmesa_dri.so.0 -unknown- xorg,machine=amd64
./usr/X11R7/lib/modules/dri/libmesa_dri.so -unknown- obsolete,xorg,!machine=amd64,!machine=i386
./usr/X11R7/lib/modules/dri/libmesa_dri.so.0 -unknown- obsolete,xorg,!machine=amd64,!machine=i386
./usr/X11R7/lib/modules/dri/swrast_dri.so -unknown- xorg,minix-false
./usr/X11R7/lib/modules/dri/swrast_dri.so.0 -unknown- xorg,minix-false
./usr/X11R7/lib/modules/dri/gallium_dri.so -unknown- xorg,minix-false
./usr/X11R7/lib/modules/dri/gallium_dri.so.0 -unknown- xorg,minix-false
./usr/X11R7/lib/modules/dri/kms_swrast_dri.so -unknown- xorg,minix-false
./usr/X11R7/lib/modules/dri/kms_swrast_dri.so.0 -unknown- xorg,minix-false
./usr/X11R7/lib/modules/dri/swrast_dri.so -unknown- xorg
./usr/X11R7/lib/modules/dri/swrast_dri.so.0 -unknown- xorg
./usr/X11R7/lib/modules/dri/gallium_dri.so -unknown- xorg
./usr/X11R7/lib/modules/dri/gallium_dri.so.0 -unknown- xorg
./usr/X11R7/lib/modules/dri/kms_swrast_dri.so -unknown- xorg
./usr/X11R7/lib/modules/dri/kms_swrast_dri.so.0 -unknown- xorg
./usr/X11R7/man/cat1/Xmark.0 -unknown- .cat,xorg
./usr/X11R7/man/cat1/Xnest.0 -unknown- .cat,xorg
./usr/X11R7/man/cat1/Xserver.0 -unknown- .cat,xorg

View File

@@ -20,21 +20,13 @@ DSTOBJDIR!=cd ${.PARSEDIR}/lib/dst && ${PRINTOBJDIR}
.if (${USE_INET6} != "no")
CPPFLAGS+= -DDHCPv6
.endif
.if !defined(__MINIX)
CPPFLAGS+= -DISC_PLATFORM_USETHREADS -DHAVE_CONFIG_H
.else # defined(__MINIX)
CPPFLAGS+= -DHAVE_CONFIG_H
.endif # defined(__MINIX)
CPPFLAGS+= -I${DIST} -I${DIST}/includes -I${DIST}/../include
CPPFLAGS+= -I${BIND} -I${BIND}/includes -I${BIND}/../include
.for dir in isc dns irs
CPPFLAGS+= -I${BIND}/lib/${dir}/include
CPPFLAGS+= -I${BIND}/lib/${dir}/unix/include
.if !defined(__MINIX)
CPPFLAGS+= -I${BIND}/lib/${dir}/pthreads/include
.else # defined(__MINIX)
CPPFLAGS+= -I${BIND}/lib/${dir}/nothreads/include
.endif # defined(__MINIX)
.endfor
CPPFLAGS+= -DLOCALSTATEDIR='"/var"'
LDADD+= ${COBJDIR}/libdhcp.a
@@ -43,9 +35,7 @@ LDADD+= ${OMOBJDIR}/libomapi.a ${DSTOBJDIR}/libdst.a
LDADD+=-Wl,-Bstatic
.endif
LDADD+= -lirs -lisccfg -ldns -lisc
.if !defined(__MINIX)
LDADD+=-lpthread
.endif # !defined(__MINIX)
.if (${MKCRYPTO} != "no")
.if (${MKKERBEROS} != "no")
LDADD+= -lgssapi -lkrb5 -lhx509 -lheimntlm -lheimbase \
@@ -71,6 +61,4 @@ LDADD+=-Wl,-Bdynamic
DPADD+= ${COBJDIR}/libdhcp.a
DPADD+= ${OMOBJDIR}/libomapi.a ${DSTOBJDIR}/libdst.a
DPADD+= ${LIBDNS} ${LIBISC}
.if !defined(__MINIX)
DPADD+= ${LIBPTHREAD}
.endif # !defined(__MINIX)

View File

@@ -4,9 +4,3 @@
LIBCXXRT_SRCDIR:= ${.PARSEDIR}/dist/libcxxrt
LIBCXX_SRCDIR:= ${.PARSEDIR}/dist/libcxx
.if defined(__MINIX)
# Should I try -D_LIBCPP_HAS_NO_THREADS ?
#LDADD+= -lmthread
#DPADD+= ${LIBMTHREAD}
.endif # defined(__MINIX)

View File

@@ -90,10 +90,6 @@
# define _LIBCPP_HAS_QUICK_EXIT
#endif // __NetBSD__
#if defined(__minix)
# define _LIBCPP_HAS_NO_THREADS 1
#endif // defined(__minix)
#ifdef _WIN32
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0

View File

@@ -173,9 +173,7 @@ template<class Callable, class ...Args>
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_THREADS) && defined(__minix)
#include <__mutex_base>
#endif // !defined(_LIBCPP_HAS_NO_THREADS) && defined(__minix)
#include <functional>
#include <memory>
#ifndef _LIBCPP_HAS_NO_VARIADICS

View File

@@ -29,15 +29,7 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#if !defined(__minix)
#include <pthread.h>
#else
#define _MTHREADIFY_PTHREADS 1
#include <minix/mthread.h>
#define LIBCXXRT_WEAK_LOCKS 1
#endif /* !defined(__minix) */
#include "typeinfo.h"
#include "dwarf_eh.h"
#include "atomic.h"

View File

@@ -43,18 +43,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#if !defined(__minix)
#include <pthread.h>
#else
#define _MTHREADIFY_PTHREADS 1
#include <minix/mthread.h>
#pragma weak sched_yield
#define sched_yield() do {\
if (sched_yield) sched_yield();\
} while(0)
#endif /* !defined(__minix) */
#include <assert.h>
#include "atomic.h"

View File

@@ -8,16 +8,14 @@ NOLINT= # defined
.PATH: ${LIBCXX_SRCDIR}/src
#__MINIX: Unsupported for now: shared_mutex.cpp
SRCS= algorithm.cpp bind.cpp chrono.cpp condition_variable.cpp debug.cpp \
exception.cpp future.cpp hash.cpp ios.cpp iostream.cpp locale.cpp \
memory.cpp mutex.cpp new.cpp optional.cpp random.cpp regex.cpp \
stdexcept.cpp \
shared_mutex.cpp stdexcept.cpp \
string.cpp strstream.cpp system_error.cpp thread.cpp \
utility.cpp valarray.cpp
# typeinfo.cc: prefer libcxxrt's version
#__MINIX: Unsupported for now:
LIBCXXRT_SRCS+= \
auxhelper.cc dynamic_cast.cc exception.cc guard.cc \
stdexcept.cc terminate.cc typeinfo.cc libelftc_dem_gnu3.c

View File

@@ -21,12 +21,8 @@
/* Define if libevent should not allow replacing the mm functions */
/* #undef _EVENT_DISABLE_MM_REPLACEMENT */
#if !defined(__minix)
/* Define if libevent should not be compiled with thread support */
/* #undef _EVENT_DISABLE_THREAD_SUPPORT */
#else
#define _EVENT_DISABLE_THREAD_SUPPORT 1
#endif /* !defined(__minix) */
/* Define to 1 if you have the `arc4random' function. */
#define _EVENT_HAVE_ARC4RANDOM 1
@@ -178,10 +174,8 @@
/* Define if you have POSIX threads libraries and header files. */
/* #undef _EVENT_HAVE_PTHREAD */
#if !defined(__minix)
/* Define if we have pthreads on this system */
#define _EVENT_HAVE_PTHREADS 1
#endif /* !defined(__minix) */
/* Define to 1 if you have the `putenv' function. */
#define _EVENT_HAVE_PUTENV 1
@@ -425,14 +419,13 @@
/* The size of `off_t', as computed by sizeof. */
#define _EVENT_SIZEOF_OFF_T 8
#if !defined(__minix)
/* The size of `pthread_t', as computed by sizeof. */
#ifdef _LP64
#define _EVENT_SIZEOF_PTHREAD_T 8
#else
#define _EVENT_SIZEOF_PTHREAD_T 4
#endif
#endif /* !defined(__minix) */
/* The size of `short', as computed by sizeof. */
#define _EVENT_SIZEOF_SHORT 2

View File

@@ -5,7 +5,6 @@ SUBDIR= libevent .WAIT
.if ${MKCRYPTO} != "no"
SUBDIR+= libevent_openssl
.endif
# MINIX3: insufficient pthreads support in the base system for now
#SUBDIR+= libevent_pthreads
SUBDIR+= libevent_pthreads
.include <bsd.subdir.mk>

View File

@@ -3816,7 +3816,6 @@ class ARMTargetInfo : public TargetInfo {
SizeType = UnsignedInt;
switch (T.getOS()) {
case llvm::Triple::Minix:
case llvm::Triple::NetBSD:
WCharType = SignedInt;
break;

View File

@@ -275,7 +275,7 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args,
// FIXME: Thumb should just be another -target-feaure, not in the triple.
#if defined(__minix) || 1
// Minix/ARM-specific force to ARMv7 and EABI.
StringRef Suffix = "v7a";
StringRef Suffix = "v7";
Triple.setEnvironment(llvm::Triple::EABI);
#else
StringRef Suffix = Triple.isOSBinFormatMachO()

View File

@@ -665,10 +665,6 @@ StringRef tools::arm::getARMFloatABI(const Driver &D, const ArgList &Args,
}
break;
case llvm::Triple::Minix:
FloatABI = "softfp";
break;
default:
switch(Triple.getEnvironment()) {
case llvm::Triple::GNUEABIHF:
@@ -800,9 +796,6 @@ void Clang::AddARMTargetArgs(const ArgList &Args,
ABIName = "aapcs";
break;
default:
if (Triple.getOS() == llvm::Triple::Minix)
ABIName = "apcs-gnu";
if (Triple.getOS() == llvm::Triple::NetBSD)
ABIName = "apcs-gnu";
else
@@ -7740,11 +7733,6 @@ void minix::Link::ConstructJob(Compilation &C, const JobAction &JA,
// Many NetBSD architectures support more than one ABI.
// Determine the correct emulation for ld.
switch (getToolChain().getArch()) {
case llvm::Triple::arm:
case llvm::Triple::thumb:
CmdArgs.push_back("-m");
CmdArgs.push_back("armelf_minix");
break;
case llvm::Triple::x86:
CmdArgs.push_back("-m");
CmdArgs.push_back("elf_i386_minix");
@@ -7891,9 +7879,7 @@ void minix::Link::ConstructJob(Compilation &C, const JobAction &JA,
if (D.CCCIsCXX()) {
getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
CmdArgs.push_back("-lm");
/* LSC: Hack as lc++ is linked against mthread. */
CmdArgs.push_back("-lmthread");
CmdArgs.push_back("-lpthread");
}
if (Args.hasArg(options::OPT_pthread))
CmdArgs.push_back("-lpthread");

View File

@@ -638,8 +638,6 @@ llvm::Optional<ProgramStateRef> MallocChecker::performKernelMalloc(
if (!KernelZeroFlagVal.hasValue()) {
if (OS == llvm::Triple::FreeBSD)
KernelZeroFlagVal = 0x0100;
else if (OS == llvm::Triple::Minix)
KernelZeroFlagVal = 0x0002;
else if (OS == llvm::Triple::NetBSD)
KernelZeroFlagVal = 0x0002;
else if (OS == llvm::Triple::OpenBSD)

View File

@@ -1074,8 +1074,6 @@ const char *Triple::getARMCPUForArch(StringRef MArch) const {
// supported by LLVM.
// FIXME: Should warn once that we're falling back.
switch (getOS()) {
case llvm::Triple::Minix:
return "cortex-a8";
case llvm::Triple::NetBSD:
switch (getEnvironment()) {
case llvm::Triple::GNUEABIHF:

View File

@@ -59,7 +59,6 @@ ARMELFMCAsmInfo::ARMELFMCAsmInfo(StringRef TT) {
// Exceptions handling
switch (TheTriple.getOS()) {
case Triple::Minix:
case Triple::NetBSD:
ExceptionsType = ExceptionHandling::DwarfCFI;
break;

View File

@@ -50,5 +50,5 @@ DPADD+= ${LIBTERMINFO}
.if defined(__MINIX) && defined(HOSTPROG) && ${HOST_OSTYPE:C/\-.*//} != "Minix"
LDADD+= -lpthread
.else
LDADD+= -lc++ -lmthread
LDADD+= -lc++ -lpthread
.endif # defined(__MINIX)

View File

@@ -8,9 +8,8 @@ PROG= glxgears
CPPFLAGS+=${X11FLAGS.THREADS}
#LSC: NO pthread on minix!
LDADD+= -lGL -lXext -lX11 -lm
DPADD+= ${LIBGL} ${LIBXEXT} ${LIBX11} ${LIBM}
LDADD+= -lGL -lXext -lX11 -lpthread -lm
DPADD+= ${LIBGL} ${LIBXEXT} ${LIBX11} ${LIBPTHREAD} ${LIBM}
.PATH: ${X11SRCDIR.mesa-demos}/src/xdemos

View File

@@ -14,9 +14,8 @@ SRCS+= glinfo_common.c glxinfo.c
CPPFLAGS+=${X11FLAGS.THREADS} -DDO_GLU
#__MINIX: No pthread
LDADD+= -lGL -lXext -lX11 -lm
DPADD+= ${LIBGL} ${LIBXEXT} ${LIBX11} ${LIBM}
LDADD+= -lGL -lXext -lX11 -lpthread -lm
DPADD+= ${LIBGL} ${LIBXEXT} ${LIBX11} ${LIBPTHREAD} ${LIBM}
.PATH: ${X11SRCDIR.mesa-demos}/src/xdemos

View File

@@ -4,12 +4,10 @@
PROG= ico
#__MINIX: No Pthreads: -DMULTITHREAD
CPPFLAGS+= ${X11FLAGS.THREADS} ${X11FLAGS.EXTENSION}
CPPFLAGS+=-DMULTITHREAD ${X11FLAGS.THREADS} ${X11FLAGS.EXTENSION}
#__MINIX: No pthreads
LDADD+= -lXext -lX11 -lm
DPADD+= ${LIBXEXT} ${LIBX11} ${LIBM}
LDADD+= -lXext -lX11 -lpthread -lm
DPADD+= ${LIBXEXT} ${LIBX11} ${LIBPTHREAD} ${LIBM}
.PATH: ${X11SRCDIR.${PROG}}
.PATH: ${X11SRCDIR.${PROG}}/man

View File

@@ -42,7 +42,7 @@ LDADD+= -lpam ${PAM_STATIC_LDADD}
DPADD+= ${LIBPAM} ${PAM_STATIC_DPADD}
.endif
SUBDIR+= config
SUBDIR+= chooser config
TARGETS+= configinstall
.include "Makefile.xdm"

View File

@@ -0,0 +1,3 @@
#__MINIX
.include "../Makefile.inc"

View File

@@ -6,9 +6,8 @@ PROG= xdriinfo
SRCS= xdriinfo.c
#LSC: No pthreads on MINIX!
LDADD+= -lGL -lXext -lX11
DPADD+= ${LIBGL} ${LIBXEXT} ${LIBX11}
LDADD+= -lGL -lXext -lX11 -lpthread
DPADD+= ${LIBGL} ${LIBXEXT} ${LIBX11} ${LIBPTHREAD}
.PATH: ${X11SRCDIR.${PROG}} ${X11SRCDIR.${PROG}}/man

View File

@@ -7,11 +7,6 @@ PROG= xlsatoms
LDADD+= -lxcb
DPADD+= ${LIBXCB}
.if defined(__MINIX)
LDADD+= -lmthread
DPADD+= ${LIBMTHREAD}
.endif # defined(__MINIX)
.PATH: ${X11SRCDIR.${PROG}}
.PATH: ${X11SRCDIR.${PROG}}/man

View File

@@ -12,11 +12,6 @@ CPPFLAGS+= -I${DESTDIR}${X11INCDIR} -DHAVE_STRNLEN \
LDADD+= -lxcb -lxcb-atom
DPADD+= ${LIBXCB} ${LIBXCB_ATOM}
.if defined(__MINIX)
LDADD+= -lmthread
DPADD+= ${LIBMTHREAD}
.endif # defined(__MINIX)
.PATH: ${X11SRCDIR.${PROG}} ${X11SRCDIR.${PROG}}/man
.include <bsd.x11.mk>

View File

@@ -36,11 +36,6 @@ DPADD+= ${LIBXAW} ${LIBXMU} ${LIBXT} ${LIBSM} ${LIBICE} ${LIBXINERAMA}
LDADD+= -lXpm -lXext -lX11 -lcurses -lterminfo -lutil
DPADD+= ${LIBXPM} ${LIBXEXT} ${LIBX11} ${LIBCURSES} ${LIBTERMINFO} ${LIBUTIL}
.if defined(__MINIX)
LDADD+= -lmthread
DPADD+= ${LIBMTHREAD}
.endif # defined(__MINIX)
SUBDIR= resize uxterm
.PATH: ${X11SRCDIR.${PROG}}

View File

@@ -16,8 +16,7 @@ SUBDIR+=xkeyboard-config
SUBDIR+=libxcb \
.WAIT
.if !defined(MLIBDIR)
#__MINIX: gallium
SUBDIR+=dri7 dri
SUBDIR+=dri7 dri gallium
.endif
SUBDIR+=fontconfig libSM libX11 \
.WAIT \

View File

@@ -25,9 +25,6 @@ CPPFLAGS+= \
#CPPFLAGS+= -D_NETBSD_SOURCE -DPTHREADS
.if defined(__MINIX)
CPPFLAGS+= -DHAVE_PTHREAD=1
LDADD+= -lmthread
DPADD+= ${LIBMTHREAD}
CWARNFLAGS.clang+= -Wno-\#warnings
#LSC: For clang 3.4
CWARNFLAGS.clang+= -Wno-attributes

View File

@@ -16,15 +16,9 @@ CPPFLAGS+= \
-I${X11SRCDIR.MesaLib7}/src/mesa \
-I${DESTDIR}${X11INCDIR}/libdrm
.if !defined(__MINIX)
CPPFLAGS+= -D_NETBSD_SOURCE -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 \
-DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING \
-DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN
.else
CPPFLAGS+= -D_NETBSD_SOURCE -DUSE_EXTERNAL_DXTN_LIB=1 \
-DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING \
-DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN
.endif # !defined(__MINIX)
CPPFLAGS+= -Wno-stack-protector

View File

@@ -17,17 +17,11 @@ CPPFLAGS+= \
-I${X11SRCDIR.MesaLib7}/src/mesa \
-I${X11SRCDIR.MesaLib7}/src/mapi
.if !defined(__MINIX)
CPPFLAGS+= ${X11FLAGS.THREADLIB} \
-DPTHREADS -D_NETBSD_SOURCE -DUSE_EXTERNAL_DXTN_LIB=1 \
-DHAVE_ALIAS -DIN_DRI_DRIVER
#CPPFLAGS+= -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_POSIX_MEMALIGN
CFLAGS+= -pthread
.else
CPPFLAGS+= ${X11FLAGS.THREADLIB} \
-D_NETBSD_SOURCE -DUSE_EXTERNAL_DXTN_LIB=1 \
-DHAVE_ALIAS -DIN_DRI_DRIVER
.endif # !defined(__MINIX)
.include "../libmesa7.mk"
.include "../libglsl7.mk"

View File

@@ -145,13 +145,10 @@ CPPFLAGS+= \
-DYYTEXT_POINTER=1
CFLAGS+= -fvisibility=hidden -fno-strict-aliasing -fno-builtin-memcmp
.if !defined(__MINIX)
CFLAGS+= -pthread
.else
LDADD+= -lmthread
DPADD+= ${LIBMTHREAD}
.if defined(__MINIX)
CWARNFLAGS.clang+= -Wno-\#warnings
.endif # !defined(__MINIX)
.endif # defined(__MINIX)
LIBDPLIBS= Xext ${.CURDIR}/../libXext \
X11 ${.CURDIR}/../libX11/dynamic \

View File

@@ -114,11 +114,7 @@ SRCS.nurbtess= \
searchTree.cc
.PATH: ${GLUDIR}/libnurbs/nurbtess
.if !defined(__MINIX)
CPPFLAGS+= -DPTHREADS -DUSE_XSHM -DHZ=100 -DNDEBUG -DLIBRARYBUILD
.else
CPPFLAGS+= -DUSE_XSHM -DHZ=100 -DNDEBUG -DLIBRARYBUILD
.endif # !defined(__MINIX)
CPPFLAGS+= -I${GLUDIR}/include \
-I${GLUDIR}/libnurbs/internals \
-I${GLUDIR}/libnurbs/interface \
@@ -127,11 +123,7 @@ CPPFLAGS+= -I${GLUDIR}/include \
SRCS= ${SRCS.libutil} ${SRCS.libtess} \
${SRCS.interface} ${SRCS.internals} ${SRCS.nurbtess}
.if !defined(__MINIX)
CFLAGS+= -fno-strict-aliasing -fvisibility=hidden -pthread
.else
CFLAGS+= -fno-strict-aliasing -fvisibility=hidden
.endif # !defined(__MINIX)
.PATH: ${X11SRCDIR.glu}/include/GL
INCS= glu.h glu_mangle.h

View File

@@ -96,13 +96,9 @@ FILESDIR= ${X11LIBDIR}
XlibConf.h: XlibConf.h.in
${_MKTARGET_CREATE}
.if !defined(__MINIX)
${TOOL_SED} -e 's/#undef XTHREADS/#define XTHREADS 1/' \
-e 's/#undef XUSE_MTSAFE_API/#define XUSE_MTSAFE_API 1/' \
< ${.ALLSRC} > ${.TARGET}
.else
${TOOL_CAT} ${.ALLSRC} > ${.TARGET}
.endif # !defined(__MINIX)
CLEANFILES+= XlibConf.h

View File

@@ -51,13 +51,7 @@ CPPFLAGS+= ${X11FLAGS.THREADLIB}
.include "${.CURDIR}/../libGL/mesa-ver.mk"
.if !defined(__MINIX)
CFLAGS+= -fno-strict-aliasing -fvisibility=hidden -pthread -fno-builtin-memcmp
.else
CFLAGS+= -fno-strict-aliasing -fvisibility=hidden -fno-builtin-memcmp
LDADD+= -lmthread
DPADD+= ${LIBMTHREAD}
.endif # !defined(__MINIX)
CPPFLAGS+= \
-DPACKAGE_NAME=\"Mesa\" \

View File

@@ -423,14 +423,13 @@ CPPFLAGS+= \
-DPACKAGE=\"mesa\" \
-DVERSION=\"10.3.5\"
#__MINIX: No Pthreads: -DHAVE_PTHREAD=1
CPPFLAGS+= \
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 \
-DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 \
-DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 \
-DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE___BUILTIN_BSWAP32=1 \
-DHAVE___BUILTIN_BSWAP64=1 -DHAVE_DLADDR=1 -DHAVE_CLOCK_GETTIME=1 \
-DHAVE_POSIX_MEMALIGN -DHAVE_DLOPEN
-DHAVE_POSIX_MEMALIGN -DHAVE_PTHREAD=1 -DHAVE_DLOPEN
.include "../asm.mk"

View File

@@ -109,8 +109,8 @@ CPPFLAGS+= -DHAVE_CONFIG_H \
-I${X11SRCDIR.pixman}/pixman
# With pixman 0.28.3, HAVE_PTHREAD_SETSPECIFIC is much faster than TLS
.if !defined(__MINIX)
CPPFLAGS+= -DHAVE_PTHREAD_SETSPECIFIC
.if defined(__MINIX)
#CPPFLAGS+= -DHAVE_PTHREAD_SETSPECIFIC
#CPPFLAGS+= -DTLS=__thread
.else
# LSC: No thread support on minix

View File

@@ -1,7 +1,6 @@
# $NetBSD: Makefile,v 1.3 2012/01/07 02:07:58 mrg Exp $
#__MINIX: reply, render-util requires pthreads
SUBDIR= keysyms \
SUBDIR= reply keysyms render-util \
atom event aux .WAIT property .WAIT \
image icccm

View File

@@ -25,7 +25,6 @@ SRCS+= i810_video.c
SRCS+= i810_wmark.c
SRCS+= i810_xaa.c
.if !defined(__MINIX)
# sna
.PATH: ${X11SRCDIR.${DRIVER}}/src/sna
SRCS+= blt.c
@@ -105,7 +104,6 @@ SRCS+= fbspan.c
SRCS+= fbstipple.c
SRCS+= fbtile.c
SRCS+= fbutil.c
.endif # !defined(__MINIX)
# uxa
.PATH: ${X11SRCDIR.${DRIVER}}/src/uxa
@@ -192,8 +190,7 @@ CPPFLAGS+= -DDRI_DRIVER_PATH=\"${DRI_DRIVER_PATH:Q}\"
CFLAGS+= -fvisibility=hidden
LIBDPLIBS+= drm_intel ${.CURDIR}/../../../lib/libdrm_intel
# MINIX: No pthread
#LIBDPLIBS+= pthread ${NETBSDSRCDIR}/lib/libpthread
LIBDPLIBS+= pthread ${NETBSDSRCDIR}/lib/libpthread
.include "../Makefile.xf86-driver"

View File

@@ -157,7 +157,7 @@ _XGetRequest(Display *dpy, CARD8 type, size_t len)
return NULL;
}
#if defined(__minix) && defined(XTHREADS)
#if defined(XTHREADS) /* defined(__minix) */
void (*_XCreateMutex_fn)(LockInfoPtr) = NULL;
void (**_XFreeMutex_fn_p)(LockInfoPtr) = &_XFreeMutex_fn;
@@ -181,4 +181,4 @@ void (*_XUnlockMutex_fn)(
, int /* line */
#endif
) = NULL;
#endif /* defined(__minix) && defined(XTHREADS) */
#endif /* defined(XTHREADS) && defined(__minix)*/

View File

@@ -23,7 +23,6 @@ CPPFLAGS+= \
.if defined(__MINIX)
CPPFLAGS+= \
-DSQLITE_THREADSAFE=0 \
-DSQLITE_OMIT_WAL
.endif # defined(__MINIX)

View File

@@ -45,9 +45,7 @@ FILESNAME_${XZSRCDIR}/po/${lang}.gmo= xz.mo
.endfor
.endif
.if !defined(__MINIX)
LDADD+= -lpthread
DPADD+= ${LIBPTHREAD}
.endif # !defined(__MINIX)
.include <bsd.prog.mk>

View File

@@ -46,10 +46,8 @@
/* Define to 1 if sha256 integrity check is enabled. */
#define HAVE_CHECK_SHA256 1
#if !defined(__minix)
/* Define to 1 if you have the `clock_gettime' function. */
#define HAVE_CLOCK_GETTIME 1
#endif /* !defined(__minix) */
/* Define to 1 if you have the <CommonCrypto/CommonDigest.h> header file. */
/* #undef HAVE_COMMONCRYPTO_COMMONDIGEST_H */
@@ -58,11 +56,9 @@
*/
/* #undef HAVE_DCGETTEXT */
#if !defined(__minix)
/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC', and to 0 if
you don't. */
#define HAVE_DECL_CLOCK_MONOTONIC 1
#endif /* !defined(__minix) */
/* Define to 1 if you have the declaration of `program_invocation_name', and
to 0 if you don't. */
@@ -195,10 +191,10 @@
#if !defined(__minix)
/* Define to 1 if you have the `posix_fadvise' function. */
#define HAVE_POSIX_FADVISE 1
#endif /* !defined(__minix) */
/* Define to 1 if you have the `pthread_condattr_setclock' function. */
#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
#endif /* !defined(__minix) */
/* Have PTHREAD_PRIO_INHERIT. */
/* #undef HAVE_PTHREAD_PRIO_INHERIT */
@@ -302,10 +298,8 @@
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
#if !defined(__minix)
/* Define to 1 when using POSIX threads (pthreads). */
#define MYTHREAD_POSIX 1
#endif /* !defined(__minix) */
/* Define to 1 when using Windows Vista compatible threads. This uses features
that are not available on Windows XP. */

View File

@@ -33,18 +33,16 @@ SRCS+= tuklib_physmem.c tuklib_cpucores.c
SRCS+= check.c crc32_table.c crc64_table.c
SRCS+= crc32_fast.c crc64_fast.c
#__MINIX: No pthreads:
# hardware_cputhreads.c outqueue.c stream_encoder_mt.c
.PATH: ${XZSRCDIR}/src/liblzma/common
SRCS+= common.c block_util.c easy_preset.c filter_common.c \
hardware_physmem.c index.c \
hardware_physmem.c hardware_cputhreads.c index.c \
stream_flags_common.c vli_size.c \
alone_encoder.c block_buffer_encoder.c block_encoder.c \
block_header_encoder.c easy_buffer_encoder.c easy_encoder.c \
easy_encoder_memusage.c filter_buffer_encoder.c \
filter_encoder.c filter_flags_encoder.c index_encoder.c \
stream_buffer_encoder.c stream_encoder.c \
stream_flags_encoder.c vli_encoder.c \
stream_buffer_encoder.c stream_encoder.c stream_encoder_mt.c \
stream_flags_encoder.c vli_encoder.c outqueue.c \
alone_decoder.c auto_decoder.c block_buffer_decoder.c \
block_decoder.c block_header_decoder.c easy_decoder_memusage.c \
filter_buffer_decoder.c filter_decoder.c filter_flags_decoder.c \
@@ -87,9 +85,7 @@ liblzma.pc: ${XZSRCDIR}/src/liblzma/liblzma.pc.in
CLEANFILES+= liblzma.pc
.if !defined(__MINIX)
LDADD+= -lpthread
DPADD+= ${LIBPTHREAD}
.endif # defined(__MINIX)
.include <bsd.lib.mk>

View File

@@ -66,9 +66,7 @@ int __libc_sigaction14(int, const struct sigaction * __restrict,
defined(_NETBSD_SOURCE)
int pthread_sigmask(int, const sigset_t * __restrict,
sigset_t * __restrict);
#if !defined(__minix)
int pthread_kill(pthread_t, int);
#endif /* !defined(__minix) */
int __libc_thr_sigsetmask(int, const sigset_t * __restrict,
sigset_t * __restrict);
#ifndef __LIBPTHREAD_SOURCE__

View File

@@ -10,12 +10,7 @@ SUBDIR+= ../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/libgcc .WAIT
.endif
.if defined(__MINIX)
#LSC MINIX libc depends on
# - libmthread because of sys/lib/libunwind
SUBDIR+= .WAIT
SUBDIR+= ../minix/lib/libsys
SUBDIR+= ../minix/lib/libmthread
SUBDIR+= .WAIT
.endif # defined(__MINIX)
SUBDIR+= libc
@@ -35,6 +30,7 @@ SUBDIR+= ../minix/lib/libasyn \
../minix/lib/liblwip \
../minix/lib/libminc \
../minix/lib/libminixfs \
../minix/lib/libmthread \
../minix/lib/libnetdriver \
../minix/lib/libsffs \
../minix/lib/libsockdriver \
@@ -78,7 +74,7 @@ SUBDIR+= \
libbz2 \
libcrypt \
libintl libkvm libm \
libpci libprop \
libpci libprop libpthread \
libpuffs librmt \
libtelnet libterminfo \
libutil libwrap libz

View File

@@ -55,11 +55,6 @@ COMPATDIR=${.CURDIR}/compat
CPPFLAGS+= -D__BUILD_LEGACY
.endif
.if defined(__MINIX) && 0
SUBDIR+= pkgconfig
.include <bsd.subdir.mk>
.endif # defined(__MINIX)
.include "${.CURDIR}/../../common/lib/libc/Makefile.inc"
.include "${.CURDIR}/atomic/Makefile.inc"
.include "${.CURDIR}/cdb/Makefile.inc"
@@ -105,11 +100,10 @@ SUBDIR+= pkgconfig
.include "${.CURDIR}/time/Makefile.inc"
.if defined(__MINIX)
.include "${NETBSDSRCDIR}/minix/lib/libc/sys/Makefile.inc"
.else
.endif # defined(__MINIX)
.if ${RUMPRUN} != "yes"
.include "${.CURDIR}/tls/Makefile.inc"
.endif
.endif # defined(__MINIX)
.include "${.CURDIR}/sys/Makefile.inc"
.if ${HAVE_LIBGCC_EH} == "no"
.include "${NETBSDSRCDIR}/sys/lib/libunwind/Makefile.inc"

View File

@@ -42,11 +42,11 @@ WARNS=5
CPPFLAGS+= -D_LIBC -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT
CPPFLAGS+= -D_DIAGNOSTIC
.else
CPPFLAGS+= -D_LIBC
CPPFLAGS+= -D_LIBC -D_REENTRANT
.if defined(MLIBDIR)
CPPFLAGS+= -DMLIBDIR=\"${MLIBDIR}\"
.endif
.endif # !defined(__minix)
.endif # !defined(__MINIX)
.if (${USE_HESIOD} != "no")
CPPFLAGS+= -DHESIOD

View File

@@ -3,11 +3,7 @@
# sources
.PATH: ${ARCHDIR}/citrus ${.CURDIR}/citrus
.if !defined(__MINIX)
MODULE_SHLIB_MAJOR!= . ${NETBSDSRCDIR}/lib/i18n_module/shlib_version ; echo $$major
.else
MODULE_SHLIB_MAJOR=1
.endif # !defined(__MINIX)
CPPFLAGS.citrus_module.c+=-DI18NMODULE_MAJOR=${MODULE_SHLIB_MAJOR}
SRCS+= citrus_bcs.c citrus_bcs_strtol.c citrus_bcs_strtoul.c \
citrus_csmapper.c citrus_ctype.c citrus_ctype_fallback.c \

View File

@@ -191,9 +191,7 @@ dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *),
* and smaller and such stores are atomic.
*/
dl_iterate_phdr_setup();
#if !defined(__minix)
membar_producer();
#endif /* !defined(__minix) */
setup_done = true;
}

View File

@@ -25,10 +25,8 @@ SRCS+= strtod.c
# private interfaces interfacing to libc
SRCS+= dtoa.c ldtoa.c hdtoa.c gdtoa.c
.if !defined(__MINIX)
# local locking implementation
SRCS+= gdtoa_locks.c
.endif # !defined(__MINIX)
# private interfaces
SRCS+= dmisc.c \

View File

@@ -20,7 +20,6 @@ SRCS+= _errno.c
.if defined(__MINIX)
# Unsupported by Minix.
# closefrom.c confstr.c extattr.c \
# pthread_atfork.c
#
# Not useful but portable
# disklabel.c
@@ -41,7 +40,7 @@ SRCS+= alarm.c alphasort.c arc4random.c assert.c asysctl.c \
isascii.c isatty.c isctype.c lockf.c nftw.c \
nice.c nlist.c nlist_aout.c nlist_coff.c nlist_ecoff.c nlist_elf32.c \
nlist_elf64.c opendir.c pause.c popen.c posix_spawn_sched.c \
posix_spawn_fileactions.c posix_spawnp.c psignal.c \
posix_spawn_fileactions.c posix_spawnp.c psignal.c pthread_atfork.c \
ptree.c pwcache.c pw_scan.c raise.c randomid.c rb.c readdir.c \
rewinddir.c scandir.c seekdir.c setdomainname.c \
sethostname.c setjmperr.c setmode.c setproctitle.c setprogname.c \

View File

@@ -467,8 +467,10 @@ arc4random_prng_create(void)
prng = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);
if (prng == MAP_FAILED)
goto fail0;
#if !defined(__minix)
if (minherit(prng, size, MAP_INHERIT_ZERO) == -1)
goto fail1;
#endif /* !defined(__minix) */
return prng;
@@ -545,12 +547,10 @@ arc4random_initialize(void)
if (!arc4random_global.initialized) {
if (crypto_core_selftest() != 0)
abort();
#if !defined(__minix)
if (pthread_atfork(&arc4random_atfork_prepare,
&arc4random_atfork_parent, &arc4random_atfork_child)
!= 0)
abort();
#endif /* !defined(__minix) */
#ifdef _REENTRANT
if (thr_keycreate(&arc4random_global.thread_key,
&arc4random_tsd_destructor) != 0)

View File

@@ -46,7 +46,7 @@
* back-end implementations, which may not be reentrant.
*/
extern mutex_t __grmutex;
#endif /* defined(__minix) */
#endif /* defined(__minix) && defined(_REENTRANT) */
/*
* files methods

View File

@@ -294,10 +294,10 @@ vsyslogp_r(int pri, struct syslog_data *data, const char *msgid,
#endif
}
#if !defined(__minix)
#if defined(__minix) && defined(_REENTRANT)
if (data == &sdata)
mutex_lock(&syslog_mutex);
#endif /* !defined(__minix) */
#endif /* defined(__minix) && defined(_REENTRANT) */
if (data->log_hostname[0] == '\0' && gethostname(data->log_hostname,
sizeof(data->log_hostname)) == -1) {
@@ -316,10 +316,10 @@ vsyslogp_r(int pri, struct syslog_data *data, const char *msgid,
prlen = snprintf_ss(p, tbuf_left, "%s ",
data->log_tag ? data->log_tag : "-");
#if !defined(__minix)
#if defined(__minix) && defined(_REENTRANT)
if (data == &sdata)
mutex_unlock(&syslog_mutex);
#endif /* !defined(__minix) */
#endif /* defined(__minix) && defined(_REENTRANT) */
if (data->log_stat & (LOG_PERROR|LOG_CONS)) {
iovcnt = 0;
@@ -430,10 +430,10 @@ vsyslogp_r(int pri, struct syslog_data *data, const char *msgid,
}
/* Get connected, output the message to the local logger. */
#if !defined(__minix)
#if defined(__minix) && defined(_REENTRANT)
if (data == &sdata)
mutex_lock(&syslog_mutex);
#endif /* !defined(__minix) */
#endif /* defined(__minix) && defined(_REENTRANT) */
opened = !data->log_opened;
if (opened)
openlog_unlocked_r(data->log_tag, data->log_stat, 0, data);
@@ -471,10 +471,10 @@ vsyslogp_r(int pri, struct syslog_data *data, const char *msgid,
(void)close(fd);
}
#if !defined(__minix)
#if defined(__minix) && defined(_REENTRANT)
if (data == &sdata)
mutex_unlock(&syslog_mutex);
#endif /* !defined(__minix) */
#endif /* defined(__minix) && defined(_REENTRANT) */
if (data != &sdata && opened) {
/* preserve log tag */
@@ -518,8 +518,7 @@ connectlog_r(struct syslog_data *data)
if (!data->log_connected) {
if (connect(data->log_file,
(const struct sockaddr *)(const void *)&sun,
(socklen_t)sizeof(sun)) == -1)
{
(socklen_t)sizeof(sun)) == -1) {
(void)close(data->log_file);
data->log_file = -1;
} else
@@ -546,32 +545,32 @@ openlog_unlocked_r(const char *ident, int logstat, int logfac,
void
openlog_r(const char *ident, int logstat, int logfac, struct syslog_data *data)
{
#if !defined(__minix)
#if defined(__minix) && defined(_REENTRANT)
if (data == &sdata)
mutex_lock(&syslog_mutex);
#endif /* !defined(__minix) */
#endif /* defined(__minix) && defined(_REENTRANT) */
openlog_unlocked_r(ident, logstat, logfac, data);
#if !defined(__minix)
#if defined(__minix) && defined(_REENTRANT)
if (data == &sdata)
mutex_unlock(&syslog_mutex);
#endif /* !defined(__minix) */
#endif /* defined(__minix) && defined(_REENTRANT) */
}
void
closelog_r(struct syslog_data *data)
{
#if !defined(__minix)
#if defined(__minix) && defined(_REENTRANT)
if (data == &sdata)
mutex_lock(&syslog_mutex);
#endif /* !defined(__minix) */
#endif /* defined(__minix) && defined(_REENTRANT) */
(void)close(data->log_file);
data->log_file = -1;
data->log_connected = 0;
data->log_tag = NULL;
#if !defined(__minix)
#if defined(__minix) && defined(_REENTRANT)
if (data == &sdata)
mutex_unlock(&syslog_mutex);
#endif /* !defined(__minix) */
#endif /* defined(__minix) && defined(_REENTRANT) */
}
int

View File

@@ -927,11 +927,8 @@
#define __learn_tree ___learn_tree
#if defined(__minix)
#define sprofile _sprofile /* LSC: Is this really needed? */
/* Needed to allow RS and VM to provide their own implementations. */
#define munmap _munmap
#endif /* defined(__minix) */
#endif /* __weak_alias */
#endif /* !__lint__ */

View File

@@ -84,15 +84,6 @@
*
*/
#if !defined(__minix) || !defined(_LIBC_REENTRANT_H)
#ifdef __minix
/*
* If _REENTRANT is not defined, the header may not be included more than once.
* This is probably a NetBSD libc bug, but for now we solve it for MINIX3 only.
*/
#define _LIBC_REENTRANT_H
#endif /* __minix */
/*
* Abstract thread interface for thread-safe libraries. These routines
* will use stubs in libc if the application is not linked against the
@@ -100,8 +91,6 @@
* is.
*/
#ifndef __minix
#include <pthread.h>
#include <signal.h>
@@ -133,15 +122,6 @@
#define once_t pthread_once_t
#define ONCE_INITIALIZER PTHREAD_ONCE_INIT
#else /* __minix */
typedef struct {
int pto_done;
} once_t;
#define ONCE_INITIALIZER { .pto_done = 0 }
#endif /* __minix */
#ifdef _REENTRANT
#ifndef __LIBC_THREAD_STUBS
@@ -349,5 +329,3 @@ thr_once(once_t *once_control, void (*routine)(void))
#define FUNLOCKFILE(fp) __empty
#endif /* _REENTRANT */
#endif /* !defined(__minix) || !defined(_LIBC_REENTRANT_H) */

View File

@@ -99,14 +99,12 @@ _libc_init(void)
#if defined(__minix) && defined(_REENTRANT)
/* Atomic operations */
__libc_atomic_init();
#endif /* defined(__minix) && defined(_REENTRANT) */
#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
/* Initialize TLS for statically linked programs. */
__libc_static_tls_setup();
#endif
#if defined(__minix) && defined(_REENTRANT)
/* Threads */
__libc_thr_init();
#endif /* defined(__minix) && defined(_REENTRANT) */

View File

@@ -215,10 +215,11 @@ static size_t malloc_pagemask;
#define ptr2idx(foo) \
(((size_t)(uintptr_t)(foo) >> malloc_pageshift)-malloc_origo)
#undef _MALLOC_LOCK /*LSC*/
#ifndef _MALLOC_LOCK
#define _MALLOC_LOCK()
#endif
#undef _MALLOC_UNLOCK /*LSC*/
#ifndef _MALLOC_UNLOCK
#define _MALLOC_UNLOCK()
#endif

256
lib/libpthread/Makefile Normal file
View File

@@ -0,0 +1,256 @@
# $NetBSD: Makefile,v 1.85 2014/12/16 20:05:54 pooka Exp $
#
WARNS?= 5
LIB= pthread
.include <bsd.own.mk>
.if defined(PTHREAD_MACHINE_ARCH) && !empty(PTHREAD_MACHINE_ARCH) && \
exists(${.CURDIR}/arch/${PTHREAD_MACHINE_ARCH})
ARCHSUBDIR= ${PTHREAD_MACHINE_ARCH}
.elif defined(PTHREAD_MACHINE_CPU) && !empty(PTHREAD_MACHINE_CPU) && \
exists(${.CURDIR}/arch/${PTHREAD_MACHINE_CPU})
ARCHSUBDIR= ${PTHREAD_MACHINE_CPU}
.elif exists(${.CURDIR}/arch/${MACHINE_ARCH})
ARCHSUBDIR= ${MACHINE_ARCH}
.elif exists(${.CURDIR}/arch/${MACHINE_CPU})
ARCHSUBDIR= ${MACHINE_CPU}
.else
.BEGIN:
@echo "WARNING: no ARCHSUBDIR for ${MACHINE_ARCH}/${MACHINE_CPU}; skipping..."
.endif
INCS= pthread.h pthread_types.h pthread_queue.h
INCSDIR=/usr/include
.if defined(ARCHSUBDIR)
ARCHDIR= ${.CURDIR}/arch/${ARCHSUBDIR}
.PATH: ${ARCHDIR}
CPPFLAGS+= -I${ARCHDIR} -I${.CURDIR} -I${.OBJDIR} -D_LIBC -D_REENTRANT
CPPFLAGS+= -I${.CURDIR}/../libc/include
CPPFLAGS+= -D__LIBPTHREAD_SOURCE__ -D__LIBC_THREAD_STUBS
# XXX: This crappy poke at libc's internals needs to be fixed.
CPPFLAGS+=-I${NETBSDSRCDIR}/sys -I${.CURDIR}/../libc
# providing alternative MI implementations for creating an lwp is
# possible by setting PTHREAD_MAKELWP. Currently, alternatives are
# set by the rumprun software stacks (see repo.rumpkernel.org)
PTHREAD_MAKELWP?= pthread_makelwp_netbsd.c
#
# NOTE: When you create a new file for libpthread, make sure that pthread.c
# gets a reference to a symbol in that file. Otherwise, Unix's stupid static
# library semantics will end up discarding potentially important objects.
#
SRCS= pthread.c
SRCS+= pthread_attr.c
SRCS+= pthread_barrier.c
# used by rumprun-posix to work around symbol collisions
.if ${PTHREAD_CANCELSTUB:Uyes} != "no"
SRCS+= pthread_cancelstub.c
.endif
SRCS+= pthread_cond.c
SRCS+= pthread_lock.c
SRCS+= ${PTHREAD_MAKELWP}
SRCS+= pthread_misc.c
SRCS+= pthread_mutex.c
SRCS+= pthread_once.c
SRCS+= pthread_rwlock.c
SRCS+= pthread_specific.c
SRCS+= pthread_spin.c
SRCS+= pthread_tsd.c
SRCS+= res_state.c
.if !defined(__MINIX)
SRCS+= sem.c
.endif # !defined(__MINIX)
# Architecture-dependent files
.if exists(${ARCHDIR}/pthread_md.S)
SRCS+= pthread_md.S
.endif
.if exists(${ARCHDIR}/Makefile.inc)
.include "${ARCHDIR}/Makefile.inc"
.endif
.if defined(__MINIX)
SRCS+= pthread_userspace.c
.PATH.c: ${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic
.PATH.S: ${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic
.PATH.c: ${.CURDIR}/../../common/lib/libc/atomic
.PATH.c: ${.CURDIR}/../libc/misc
.include "../../common/lib/libc/arch/${ARCHSUBDIR}/atomic/Makefile.inc"
.endif # defined(__MINIX)
# The PTHREAD__COMPAT flag builds a libpthread that can be dropped
# into a NetBSD 2/3/4 chroot with a NetBSD 5 or later kernel.
# This makes threading work in the chroot, no other modifications
# required.
#
.if defined(PTHREAD__COMPAT)
SRCS+= pthread_compat.c
.PATH.c: ${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic
.PATH.S: ${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic
.PATH.c: ${.CURDIR}/../../common/lib/libc/atomic
.PATH.c: ${.CURDIR}/../libc/misc
.include "../../common/lib/libc/arch/${ARCHSUBDIR}/atomic/Makefile.inc"
.endif
ALIGN_FUNCTIONS= ${${ACTIVE_CC} == "gcc":? -falign-functions=32 :}
.if ${MACHINE_CPU} != "m68k" && ${MACHINE_CPU} != "sh3" && ${MACHINE_ARCH} != "vax"
OMIT_FRAME_POINTER= -fomit-frame-pointer
.else
OMIT_FRAME_POINTER=
.endif
# The TSD routines are used in the implementation of profiling, and so
# can't be profiled themselves.
COPTS.pthread_specific.c+= ${OMIT_FRAME_POINTER} ${ALIGN_FUNCTIONS}
pthread_specific.po: pthread_specific.o
${_MKTARGET_CREATE}
cp pthread_specific.o pthread_specific.po
# Internal spinlock routines are performance critical. Don't profile them,
# it's incompatibile with -fomit-frame-pointer.
COPTS.pthread_lock.c+= ${OMIT_FRAME_POINTER} ${ALIGN_FUNCTIONS}
pthread_lock.po: pthread_lock.o
${_MKTARGET_CREATE}
cp pthread_lock.o pthread_lock.po
COPTS.pthread_mutex.c+= ${OMIT_FRAME_POINTER} ${ALIGN_FUNCTIONS}
pthread_mutex.po: pthread_mutex.o
${_MKTARGET_CREATE}
cp pthread_mutex.o pthread_mutex.po
COPTS.pthread.c += -Wno-stack-protector -Wno-format-nonliteral
COPTS.pthread_attr.c += -Wno-format-nonliteral
MAN+= affinity.3 pthread.3 \
pthread_attr.3 \
pthread_attr_get_np.3 \
pthread_attr_getdetachstate.3 \
pthread_attr_getguardsize.3 \
pthread_attr_getinheritsched.3 \
pthread_attr_getname_np.3 \
pthread_attr_getschedparam.3 \
pthread_attr_getscope.3 \
pthread_attr_getstack.3 \
pthread_attr_setcreatesuspend_np.3 \
pthread_barrier.3 pthread_barrierattr.3 \
pthread_cancel.3 pthread_cleanup_push.3 \
pthread_cond.3 pthread_condattr.3 \
pthread_create.3 pthread_detach.3 pthread_equal.3 \
pthread_curcpu_np.3 \
pthread_exit.3 \
pthread_getname_np.3 \
pthread_getspecific.3 pthread_join.3 \
pthread_key_create.3 pthread_kill.3 \
pthread_mutex.3 pthread_mutexattr.3 \
pthread_once.3 pthread_rwlock.3 pthread_rwlockattr.3 \
pthread_schedparam.3 pthread_self.3 \
pthread_sigmask.3 pthread_spin.3 \
pthread_suspend_np.3 pthread_testcancel.3
MLINKS+= pthread_attr_get_np.3 pthread_getattr_np.3
MLINKS+= affinity.3 pthread_setaffinity_np.3
MLINKS+= affinity.3 pthread_getaffinity_np.3
MLINKS+= pthread_attr.3 pthread_attr_init.3
MLINKS+= pthread_attr.3 pthread_attr_destroy.3
MLINKS+= pthread_attr_getdetachstate.3 pthread_attr_setdetachstate.3
MLINKS+= pthread_attr_getguardsize.3 pthread_attr_setguardsize.3
MLINKS+= pthread_attr_getinheritsched.3 pthread_attr_setinheritsched.3
MLINKS+= pthread_attr_getname_np.3 pthread_attr_setname_np.3
MLINKS+= pthread_attr_getschedparam.3 pthread_attr_setschedparam.3 \
pthread_attr_getschedparam.3 pthread_attr_getschedpolicy.3 \
pthread_attr_getschedparam.3 pthread_attr_setschedpolicy.3
MLINKS+= pthread_attr_getscope.3 pthread_attr_setscope.3
MLINKS+= pthread_attr_getstack.3 pthread_attr_setstack.3 \
pthread_attr_getstack.3 pthread_attr_getstacksize.3 \
pthread_attr_getstack.3 pthread_attr_setstacksize.3 \
pthread_attr_getstack.3 pthread_attr_getstackaddr.3 \
pthread_attr_getstack.3 pthread_attr_setstackaddr.3
MLINKS+= pthread_cleanup_push.3 pthread_cleanup_pop.3
MLINKS+= pthread_barrier.3 pthread_barrier_init.3
MLINKS+= pthread_barrier.3 pthread_barrier_destroy.3
MLINKS+= pthread_barrier.3 pthread_barrier_wait.3
MLINKS+= pthread_barrierattr.3 pthread_barrierattr_init.3
MLINKS+= pthread_barrierattr.3 pthread_barrierattr_destroy.3
MLINKS+= pthread_cond.3 pthread_cond_init.3
MLINKS+= pthread_cond.3 pthread_cond_destroy.3
MLINKS+= pthread_cond.3 pthread_cond_broadcast.3
MLINKS+= pthread_cond.3 pthread_cond_wait.3
MLINKS+= pthread_cond.3 pthread_cond_signal.3
MLINKS+= pthread_cond.3 pthread_cond_timedwait.3
MLINKS+= pthread_condattr.3 pthread_condattr_init.3
MLINKS+= pthread_condattr.3 pthread_condattr_destroy.3
MLINKS+= pthread_condattr.3 pthread_condattr_setclock.3
MLINKS+= pthread_getname_np.3 pthread_setname_np.3
MLINKS+= pthread_getspecific.3 pthread_setspecific.3
MLINKS+= pthread_key_create.3 pthread_key_delete.3
MLINKS+= pthread_mutex.3 pthread_mutex_init.3
MLINKS+= pthread_mutex.3 pthread_mutex_destroy.3
MLINKS+= pthread_mutex.3 pthread_mutex_lock.3
MLINKS+= pthread_mutex.3 pthread_mutex_trylock.3
MLINKS+= pthread_mutex.3 pthread_mutex_unlock.3
MLINKS+= pthread_mutexattr.3 pthread_mutexattr_init.3
MLINKS+= pthread_mutexattr.3 pthread_mutexattr_destroy.3
MLINKS+= pthread_mutexattr.3 pthread_mutexattr_settype.3
MLINKS+= pthread_mutexattr.3 pthread_mutexattr_gettype.3
MLINKS+= pthread_rwlock.3 pthread_rwlock_init.3
MLINKS+= pthread_rwlock.3 pthread_rwlock_destroy.3
MLINKS+= pthread_rwlock.3 pthread_rwlock_rdlock.3
MLINKS+= pthread_rwlock.3 pthread_rwlock_wrlock.3
MLINKS+= pthread_rwlock.3 pthread_rwlock_unlock.3
MLINKS+= pthread_rwlock.3 pthread_rwlock_timedrdlock.3
MLINKS+= pthread_rwlock.3 pthread_rwlock_timedwrlock.3
MLINKS+= pthread_rwlock.3 pthread_rwlock_tryrdlock.3
MLINKS+= pthread_rwlock.3 pthread_rwlock_trywrlock.3
MLINKS+= pthread_rwlockattr.3 pthread_rwlockattr_init.3
MLINKS+= pthread_rwlockattr.3 pthread_rwlockattr_destroy.3
MLINKS+= pthread_spin.3 pthread_spin_init.3
MLINKS+= pthread_spin.3 pthread_spin_destroy.3
MLINKS+= pthread_spin.3 pthread_spin_lock.3
MLINKS+= pthread_spin.3 pthread_spin_trylock.3
MLINKS+= pthread_spin.3 pthread_spin_unlock.3
MLINKS+= pthread_schedparam.3 pthread_setschedparam.3
MLINKS+= pthread_schedparam.3 pthread_getschedparam.3
MLINKS+= pthread_suspend_np.3 pthread_resume_np.3
MLINKS+= pthread_testcancel.3 pthread_setcancelstate.3
MLINKS+= pthread_testcancel.3 pthread_setcanceltype.3
.include <bsd.lib.mk>
.else
.include <bsd.man.mk>
.include <bsd.files.mk>
.include <bsd.inc.mk>
.endif
# WARNS=2 sets -Wcast-qual. This causes problems for one of
# pthread_setspecific() and pthread_getspecific(), since the constness
# of the argument to setspecific() has to be discarded *somewhere*
# before returning it from getspecific().
CWARNFLAGS+= -Wno-cast-qual
NOCLANGERROR=

9
lib/libpthread/README Normal file
View File

@@ -0,0 +1,9 @@
$NetBSD: README,v 1.6 2009/04/16 18:37:30 wiz Exp $
When making changes to libpthread, please ensure that libpthread_dbg
still compiles.
Due to limitations in the current pthread implementation, makecontext(3)
and sigaltstack(2) should not be used in programs which link against
libpthread (whether threads are used or not). This has been noted in the
makecontext(3), sigaltstack(2), and pthread(3) man pages.

12
lib/libpthread/TODO Normal file
View File

@@ -0,0 +1,12 @@
$NetBSD: TODO,v 1.17 2012/02/03 21:11:17 joerg Exp $
Interfaces/features to implement:
- Realtime extensions: priority inheritance.
- Allow threads to change their stack size.
- Allow threads to modify the red zone size; cf. pthread_attr_setguardsize(3).
- Keep a pool of dead LWPs so that we do not have take the full hit of
_lwp_create() every time pthread_create() is called.

140
lib/libpthread/affinity.3 Normal file
View File

@@ -0,0 +1,140 @@
.\" $NetBSD: affinity.3,v 1.8 2011/12/05 10:27:40 wiz Exp $
.\"
.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Mindaugas Rasiukevicius <rmind at NetBSD org>.
.\"
.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
.\"
.Dd December 4, 2011
.Dt AFFINITY 3
.Os
.Sh NAME
.Nm pthread_setaffinity_np ,
.Nm pthread_getaffinity_np
.Nd affinity of threads
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.In sched.h
.Ft int
.Fn pthread_setaffinity_np "pthread_t thread" "size_t size" "cpuset_t *set"
.Ft int
.Fn pthread_getaffinity_np "pthread_t thread" "size_t size" "cpuset_t *set"
.Sh DESCRIPTION
Thread affinity allows to run the thread on specified CPU or CPUs only.
.Pp
The
.Fn pthread_setaffinity_np
function sets the affinity mask
.Fa set
for
.Fa thread .
At least one valid CPU must be set in the mask.
.Pp
The
.Fn pthread_getaffinity_np
function gets the affinity mask of
.Fa thread
into
.Fa set .
Note that
.Fa set
must be created and initialized using the
.Xr cpuset 3
functions.
.Sh IMPLEMENTATION NOTES
Setting CPU
.Nm
requires super-user privileges.
Ordinary users can be allowed to control CPU affinity
of their threads via the
.Pa security.models.extensions.user_set_cpu_affinity
.Xr sysctl 7 .
See
.Xr secmodel_extensions 9 .
.Pp
Portable applications should not use the
.Fn pthread_setaffinity_np
and
.Fn pthread_getaffinity_np
functions.
.Sh RETURN VALUES
The
.Fn pthread_setaffinity_np
and
.Fn pthread_getaffinity_np
functions return 0 on success.
Otherwise, an error number is returned to indicate the error.
.Sh EXAMPLES
An example of code fragment, which sets the affinity for the current
thread to the CPU whose ID is 0:
.Bd -literal
cpuset_t *cset;
pthread_t pth;
cpuid_t ci;
cset = cpuset_create();
if (cset == NULL) {
err(EXIT_FAILURE, "cpuset_create");
}
ci = 0;
cpuset_set(ci, cset);
pth = pthread_self();
error = pthread_setaffinity_np(pth, cpuset_size(cset), cset);
if (error) {
...
}
cpuset_destroy(cset);
.Ed
.Sh COMPATIBILITY
Both functions are non-standard extensions.
.Sh ERRORS
Both functions may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The specified
.Fa set
was invalid.
.It Bq Er EPERM
The calling process lacks the appropriate privileges to perform
the operation.
.It Bq Er ESRCH
No thread could be found corresponding to the one specified by
.Fa thread .
.El
.Sh NOTES
There is an alternative processor sets interface, see
.Xr pset 3 .
However, thread affinity and processor sets are mutually exclusive,
hence mixing of these interfaces is prohibited.
.Sh SEE ALSO
.Xr cpuset 3 ,
.Xr pset 3 ,
.Xr pthread_getschedparam 3 ,
.Xr pthread_setschedparam 3 ,
.Xr sched 3 ,
.Xr schedctl 8

View File

@@ -0,0 +1,57 @@
/* $NetBSD: pthread_md.h,v 1.1 2014/08/10 05:47:37 matt Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _LIB_PTHREAD_AARCH64_MD_H
#define _LIB_PTHREAD_AARCH64_MD_H
static inline uintptr_t
pthread__sp(void)
{
uintptr_t ret;
__asm __volatile("mov %0, sp" : "=r" (ret));
return ret;
}
#define pthread__smt_pause() __asm __volatile("wfe") /* wfe */
#define pthread__smt_wake() __asm __volatile("sev") /* sev */
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_SP])
/*
* Set initial, sane values for registers whose values aren't just
* "don't care".
*/
#define _INITCONTEXT_U_MD(ucp) \
(ucp)->uc_mcontext.__gregs[_REG_SPSR] = 0;
#endif /* _LIB_PTHREAD_AARCH64_MD_H */

View File

@@ -0,0 +1,57 @@
/* $NetBSD: pthread_md.S,v 1.1 2009/05/18 13:03:35 njoly Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nick Hudson.
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#include <machine/asm.h>
.align 2
LEAF(pthread__ras_simple_lock_init, 1)
stl zero, 0(a0)
nop
RET
END(pthread__ras_simple_lock_init)
.align 2
LEAF(pthread__ras_simple_lock_try, 1)
ldiq t0, 1
pthread__lock_ras_start: .globl pthread__lock_ras_start
ldl v0, 0(a0)
stl t0, 0(a0)
pthread__lock_ras_end: .globl pthread__lock_ras_end
cmpeq v0, 0, v0
RET
END(pthread__ras_simple_lock_try)
.align 2
LEAF(pthread__ras_simple_unlock, 1)
stl zero, 0(a0)
nop
RET
END(pthread__ras_simple_unlock)

View File

@@ -0,0 +1,57 @@
/* $NetBSD: pthread_md.h,v 1.7 2011/01/25 19:12:04 christos Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nathan J. Williams.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _LIB_PTHREAD_ALPHA_MD_H
#define _LIB_PTHREAD_ALPHA_MD_H
#define PTHREAD__ASM_RASOPS
static inline unsigned long
pthread__sp(void)
{
unsigned long ret;
__asm("mov $30, %0" : "=r" (ret));
return ret;
}
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_SP])
/*
* Set initial, sane values for registers whose values aren't just
* "don't care".
* 0x0008 is ALPHA_PSL_USERSET from arch/alpha/include/alpha_cpu.h
*/
#define _INITCONTEXT_U_MD(ucp) \
(ucp)->uc_mcontext.__gregs[_REG_PS] = 0x0008;
#endif /* _LIB_PTHREAD_ALPHA_MD_H */

View File

@@ -0,0 +1,80 @@
/* $NetBSD: pthread_md.h,v 1.9 2013/08/15 22:37:29 matt Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
*
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
* 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 _LIB_PTHREAD_ARM_MD_H
#define _LIB_PTHREAD_ARM_MD_H
static inline unsigned long
pthread__sp(void)
{
unsigned long ret;
__asm volatile("mov %0, sp"
: "=r" (ret));
return (ret);
}
#if defined(__thumb__) && defined(_ARM_ARCH_6)
#define pthread__smt_pause() __asm __volatile(".inst.n 0xbf20") /* wfe */
#define pthread__smt_wake() __asm __volatile(".inst.n 0xbf40") /* sev */
#elif !defined(__thumb__)
#define pthread__smt_pause() __asm __volatile(".inst 0xe320f002") /* wfe */
#define pthread__smt_wake() __asm __volatile(".inst 0xe320f004") /* sev */
#else
#define pthread__smt_pause()
#define pthread__smt_wake()
#endif
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_SP])
/*
* Set initial, sane values for registers whose values aren't just
* "don't care".
*/
#ifdef __APCS_26__
#define _INITCONTEXT_U_MD(ucp) \
/* Set R15_MODE_USR in the PC */ \
(ucp)->uc_mcontext.__gregs[_REG_PC] = \
((ucp)->uc_mcontext.__gregs[_REG_PC] & 0x3fffffc) | 0x0;
#else
/* Set CPSR to PSR_USE32_MODE (0x10) from arm/armreg.h */
#define _INITCONTEXT_U_MD(ucp) \
(ucp)->uc_mcontext.__gregs[_REG_CPSR] = 0x10;
#endif
#endif /* _LIB_PTHREAD_ARM_MD_H */

View File

@@ -0,0 +1,67 @@
/* $NetBSD: pthread_md.S,v 1.1 2009/05/16 22:20:40 ad Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Wayne Knowles
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#include <machine/asm.h>
LEAF_ENTRY(pthread__ras_simple_lock_init)
ldi 1,%ret0 /* 1 == unlocked */
stw %ret0,0(%arg0)
stw %ret0,4(%arg0)
stw %ret0,8(%arg0)
stw %ret0,12(%arg0)
bv,n %r0(%rp)
EXIT(pthread__ras_simple_lock_init)
.global pthread__lock_ras_start
.global pthread__lock_ras_end
LEAF_ENTRY(pthread__ras_simple_lock_try)
ldo 15(%arg0),%arg0
depi 0,31,4,%arg0
pthread__lock_ras_start:
ldw 0(%arg0),%ret0
stw %r0,0(%arg0) /* 0 == locked */
pthread__lock_ras_end:
comiclr,= 0,%ret0,%ret0 /* if locked return 0 */
ldi 1,%ret0 /* else return 1 */
bv,n %r0(%rp)
EXIT(pthread__ras_simple_lock_try)
LEAF_ENTRY(pthread__ras_simple_unlock)
ldo 15(%arg0),%arg0
depi 0,31,4,%arg0
ldi 1,%ret0 /* 1 == unlocked */
bv %r0(%rp)
stw %ret0,0(%arg0)
EXIT(pthread__ras_simple_unlock)

View File

@@ -0,0 +1,64 @@
/* $NetBSD: pthread_md.h,v 1.8 2011/01/25 19:12:05 christos Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nathan J. Williams.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _LIB_PTHREAD_HPPA_MD_H
#define _LIB_PTHREAD_HPPA_MD_H
#include <machine/frame.h>
#define PTHREAD__ASM_RASOPS
static inline unsigned long
pthread__sp(void)
{
register unsigned long sp __asm("r30");
return sp;
}
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_SP])
/*
* Set initial, sane values for registers whose values aren't just
* "don't care".
*/
#define _INITCONTEXT_U_MD(ucp) \
(ucp)->uc_mcontext.__gregs[_REG_PSW] = 0x4000f;
/*
* Usable stack space below the ucontext_t.
*/
#define STACKSPACE (HPPA_FRAME_SIZE)
/* Don't need additional memory barriers. */
#define PTHREAD__ATOMIC_IS_MEMBAR
#endif /* !_LIB_PTHREAD_HPPA_MD_H */

View File

@@ -0,0 +1,94 @@
/* $NetBSD: pthread_md.h,v 1.20 2012/03/02 23:19:47 joerg Exp $ */
/*-
* Copyright (c) 2001, 2007, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nathan J. Williams, and by Andrew Doran.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _LIB_PTHREAD_I386_MD_H
#define _LIB_PTHREAD_I386_MD_H
#include <sys/ucontext.h>
#include <ucontext.h>
static inline unsigned long
pthread__sp(void)
{
unsigned long ret;
__asm("movl %%esp, %0" : "=g" (ret));
return ret;
}
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_UESP])
static inline void
_initcontext_u_md(ucontext_t *ucp)
{
__asm ("pushfl; popl %0" : "=a" (ucp->uc_mcontext.__gregs[_REG_EFL]));
__asm ("pushl %%cs; popl %0" : "=a" (ucp->uc_mcontext.__gregs[_REG_CS]));
__asm ("movl %%ds, %0" : "=a" (ucp->uc_mcontext.__gregs[_REG_DS]));
__asm ("movl %%es, %0" : "=a" (ucp->uc_mcontext.__gregs[_REG_ES]));
__asm ("movl %%fs, %0" : "=a" (ucp->uc_mcontext.__gregs[_REG_FS]));
__asm ("movl %%gs, %0" : "=a" (ucp->uc_mcontext.__gregs[_REG_GS]));
__asm ("movl %%ss, %0" : "=a" (ucp->uc_mcontext.__gregs[_REG_SS]));
}
#define _INITCONTEXT_U_MD(ucp) _initcontext_u_md(ucp);
#define pthread__smt_pause() __asm __volatile("rep; nop" ::: "memory")
/* Don't need additional memory barriers. */
#define PTHREAD__ATOMIC_IS_MEMBAR
static inline void *
_atomic_cas_ptr(volatile void *ptr, void *old, void *new)
{
volatile uintptr_t *cast = ptr;
void *ret;
__asm __volatile ("lock; cmpxchgl %2, %1"
: "=a" (ret), "=m" (*cast)
: "r" (new), "m" (*cast), "0" (old));
return ret;
}
static inline void *
_atomic_cas_ptr_ni(volatile void *ptr, void *old, void *new)
{
volatile uintptr_t *cast = ptr;
void *ret;
__asm __volatile ("cmpxchgl %2, %1"
: "=a" (ret), "=m" (*cast)
: "r" (new), "m" (*cast), "0" (old));
return ret;
}
#endif /* _LIB_PTHREAD_I386_MD_H */

View File

@@ -0,0 +1,45 @@
/* $NetBSD: pthread_md.h,v 1.1 2015/04/17 13:14:19 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nathan J. Williams.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _LIB_PTHREAD_IA64_MD_H
#define _LIB_PTHREAD_IA64_MD_H
// #define PTHREAD__ASM_RASOPS
static inline unsigned long
pthread__sp(void)
{
return 0;
}
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_SP])
#endif /* _LIB_PTHREAD_IA64_MD_H */

View File

@@ -0,0 +1,49 @@
/* $NetBSD: pthread_md.h,v 1.8 2011/01/25 19:12:05 christos Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nathan J. Williams.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _LIB_PTHREAD_M68K_MD_H
#define _LIB_PTHREAD_M68K_MD_H
static inline unsigned long
pthread__sp(void)
{
unsigned long ret;
__asm("movl %%sp, %0" : "=g" (ret));
return ret;
}
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_A7])
/* m68k will not go SMP */
#define PTHREAD__ATOMIC_IS_MEMBAR
#endif /* _LIB_PTHREAD_M68K_MD_H */

View File

@@ -0,0 +1,47 @@
/* $NetBSD: pthread_md.h,v 1.9 2011/01/25 19:12:05 christos Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nathan J. Williams.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _LIB_PTHREAD_MIPS_MD_H
#define _LIB_PTHREAD_MIPS_MD_H
static inline unsigned long
pthread__sp(void)
{
unsigned long ret;
__asm("move %0, $sp" : "=r" (ret));
return ret;
}
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_SP])
#endif /* !_LIB_PTHREAD_MIPS_MD_H */

View File

@@ -1,5 +1,7 @@
/* $NetBSD: pthread_md.h,v 1.1 2014/09/03 19:34:26 matt Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* Copyright (c) 2014 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -27,22 +29,19 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: unwind_stub.c,v 1.2 2013/08/12 23:42:14 matt Exp $");
#ifndef _LIB_PTHREAD_OR1K_MD_H
#define _LIB_PTHREAD_OR1K_MD_H
#if defined(__minix)
#include <ehabi.h>
#else
#include <arm/ehabi.h>
#endif /* defined(__minix) */
static _Unwind_Reason_Code __used
__aeabi_unwind_cpp_stub(_Unwind_State state, _Unwind_Control_Block *ucbp,
_Unwind_Context *context)
static inline unsigned long
pthread__sp(void)
{
return _URC_FAILURE;
unsigned long ret;
__asm("l.ori %0, r0, 0" : "=r" (ret));
return ret;
}
__weak_alias(__aeabi_unwind_cpp_pr0, __aeabi_unwind_cpp_stub)
__weak_alias(__aeabi_unwind_cpp_pr1, __aeabi_unwind_cpp_stub)
__weak_alias(__aeabi_unwind_cpp_pr2, __aeabi_unwind_cpp_stub)
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[1])
#endif /* _LIB_PTHREAD_OR1K_MD_H */

View File

@@ -0,0 +1,61 @@
/* $NetBSD: pthread_md.h,v 1.7 2011/01/25 19:12:05 christos Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Allen Briggs for Wasabi Systems, Inc.
*
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
* 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 _LIB_PTHREAD_POWERPC_MD_H
#define _LIB_PTHREAD_POWERPC_MD_H
static inline unsigned long
pthread__sp(void)
{
unsigned long ret;
__asm("mr %0,1" : "=r" (ret));
return ret;
}
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[1])
/*
* Set initial, sane values for registers whose values aren't just
* "don't care".
* 0xd032 is PSL_USERSET from arch/powerpc/include/psl.h
*/
#define _INITCONTEXT_U_MD(ucp) \
(ucp)->uc_mcontext.__gregs[_REG_MSR] = 0xd032;
#endif /* _LIB_PTHREAD_POWERPC_MD_H */

View File

@@ -0,0 +1,47 @@
/* $NetBSD: pthread_md.h,v 1.2 2015/03/31 01:36:27 matt Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _LIB_PTHREAD_RISCV_MD_H
#define _LIB_PTHREAD_RISCV_MD_H
static inline unsigned long
pthread__sp(void)
{
unsigned long ret;
__asm("move\t%0, sp" : "=r" (ret));
return ret;
}
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_SP])
#endif /* _LIB_PTHREAD_RISCV_MD_H */

View File

@@ -0,0 +1,62 @@
/* $NetBSD: pthread_md.h,v 1.8 2011/01/25 19:12:06 christos Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford for Wasabi Systems, Inc.
*
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
* 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 _LIB_PTHREAD_SH3_MD_H
#define _LIB_PTHREAD_SH3_MD_H
static inline unsigned long
pthread__sp(void)
{
unsigned long ret;
__asm("mov r15, %0" : "=r" (ret));
return ret;
}
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_R15])
/*
* Set initial, sane values for registers whose values aren't just
* "don't care".
*/
#define _INITCONTEXT_U_MD(ucp) \
(ucp)->uc_mcontext.__gregs[_REG_SR] = 0;
/* sh3 will not go SMP */
#define PTHREAD__ATOMIC_IS_MEMBAR
#endif /* _LIB_PTHREAD_SH3_MD_H */

View File

@@ -0,0 +1,50 @@
/* $NetBSD: pthread_md.h,v 1.8 2011/01/25 19:12:06 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _LIB_PTHREAD_SPARC_MD_H
#define _LIB_PTHREAD_SPARC_MD_H
/*
* pthread__sp used for identifying thread
*/
static inline unsigned long
pthread__sp(void)
{
unsigned long ret;
__asm("mov %%sp, %0" : "=r" (ret));
return ret;
}
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_O6])
/* Don't need additional memory barriers. */
#define PTHREAD__ATOMIC_IS_MEMBAR
#endif /* _LIB_PTHREAD_SPARC_MD_H */

View File

@@ -0,0 +1,47 @@
/* $NetBSD: pthread_md.h,v 1.7 2011/01/25 19:12:06 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _LIB_PTHREAD_SPARC64_MD_H
#define _LIB_PTHREAD_SPARC64_MD_H
/*
* pthread__sp used for identifying thread
*/
static inline unsigned long
pthread__sp(void)
{
unsigned long ret;
__asm("mov %%sp, %0" : "=r" (ret));
return ret;
}
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_O6])
#endif /* _LIB_PTHREAD_SPARC64_MD_H */

View File

@@ -0,0 +1,58 @@
/* $NetBSD: pthread_md.h,v 1.8 2011/01/25 19:12:06 christos Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nathan J. Williams.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _LIB_PTHREAD_VAX_MD_H
#define _LIB_PTHREAD_VAX_MD_H
static inline unsigned long
pthread__sp(void)
{
unsigned long ret;
__asm("movl %%sp,%0" : "=r" (ret));
return ret;
}
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_SP])
/*
* Set initial, sane values for registers whose values aren't just
* "don't care".
* 0x03c00000 is PSL_U|PSL_PREVU from arch/vax/include/psl.h
*/
#define _INITCONTEXT_U_MD(ucp) \
(ucp)->uc_mcontext.__gregs[_REG_PSL] = 0x03c00000;
/* Don't need additional memory barriers. */
#define PTHREAD__ATOMIC_IS_MEMBAR
#endif /* _LIB_PTHREAD_VAX_MD_H */

View File

@@ -0,0 +1,97 @@
/* $NetBSD: pthread_md.h,v 1.12 2011/01/25 19:12:06 christos Exp $ */
/*-
* Copyright (c) 2001, 2007, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nathan J. Williams.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*
* Adapted for x86_64 by fvdl@NetBSD.org
*/
#ifndef _LIB_PTHREAD_X86_64_MD_H
#define _LIB_PTHREAD_X86_64_MD_H
#include <sys/ucontext.h>
static inline unsigned long
pthread__sp(void)
{
unsigned long ret;
__asm("movq %%rsp, %0" : "=g" (ret));
return ret;
}
#define pthread__uc_sp(ucp) ((ucp)->uc_mcontext.__gregs[_REG_URSP])
/*
* Set initial, sane values for registers whose values aren't just
* "don't care".
* 0x23 is GSEL(GUDATA_SEL, SEL_UPL), and
* 0x1b is GSEL(GUCODE_SEL, SEL_UPL).
* 0x202 is PSL_USERSET.
*/
#define _INITCONTEXT_U_MD(ucp) \
(ucp)->uc_mcontext.__gregs[_REG_GS] = 0x23, \
(ucp)->uc_mcontext.__gregs[_REG_FS] = 0x23, \
(ucp)->uc_mcontext.__gregs[_REG_ES] = 0x23, \
(ucp)->uc_mcontext.__gregs[_REG_DS] = 0x23, \
(ucp)->uc_mcontext.__gregs[_REG_CS] = 0x1b, \
(ucp)->uc_mcontext.__gregs[_REG_SS] = 0x23, \
(ucp)->uc_mcontext.__gregs[_REG_RFL] = 0x202;
#define pthread__smt_pause() __asm __volatile("rep; nop" ::: "memory")
/* Don't need additional memory barriers. */
#define PTHREAD__ATOMIC_IS_MEMBAR
static inline void *
_atomic_cas_ptr(volatile void *ptr, void *old, void *new)
{
volatile uintptr_t *cast = ptr;
void *ret;
__asm __volatile ("lock; cmpxchgq %2, %1"
: "=a" (ret), "=m" (*cast)
: "r" (new), "m" (*cast), "0" (old));
return ret;
}
static inline void *
_atomic_cas_ptr_ni(volatile void *ptr, void *old, void *new)
{
volatile uintptr_t *cast = ptr;
void *ret;
__asm __volatile ("cmpxchgq %2, %1"
: "=a" (ret), "=m" (*cast)
: "r" (new), "m" (*cast), "0" (old));
return ret;
}
#endif /* _LIB_PTHREAD_X86_64_MD_H */

178
lib/libpthread/pthread.3 Normal file
View File

@@ -0,0 +1,178 @@
.\" $NetBSD: pthread.3,v 1.14 2010/05/16 12:23:32 jruoho Exp $
.\"
.\" Copyright (c) 2003, 2007, 2009 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Hubert Feyrer <hubertf@NetBSD.org> and Thomas Klausner <wiz@NetBSD.org>.
.\"
.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
.\"
.Dd May 16, 2010
.Dt PTHREAD 3
.Os
.Sh NAME
.Nm pthread
.Nd POSIX Threads Library
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Pp
.Nm cc
.Op Ar flags
.Ar files
.Fl lpthread
.Op Ar libraries
.Sh DESCRIPTION
The
.Nm
library provides an implementation of the standard
.Tn POSIX
threads library.
.Pp
The
.Nx
implementation is based on 1:1 thread model, therefore each
.Nm
has a kernel thread, called a light-weight process (LWP).
.Pp
Note that the system private thread interfaces upon which the
.Nm
library is built are subject to change without notice.
In order to remain compatible with future
.Nx
releases, programs must be linked against the dynamic version of the
thread library.
Statically linked programs using the
.Tn POSIX
threads framework may not work when run on a future version of the system.
.Sh FUNCTIONS
The following functions comprise the core of the
.Nm
library:
.Bl -column -offset indent "pthread_barrier_destroy(3)" "XXX"
.It Sy Function Ta Sy Description
.It Xr pthread_attr 3 Ta thread attribute operations
.It Xr pthread_barrier_destroy 3 Ta destroy a barrier
.It Xr pthread_barrier_init 3 Ta create a barrier
.It Xr pthread_barrier_wait 3 Ta wait for a barrier
.It Xr pthread_barrierattr 3 Ta barrier attribute operations
.It Xr pthread_cancel 3 Ta cancel the execution of a thread
.It Xr pthread_cleanup_push 3 Ta add or remove cleanup functions
.It Xr pthread_cond_broadcast 3 Ta unblock one or more threads
.It Xr pthread_cond_destroy 3 Ta destroy a condition variable
.It Xr pthread_cond_init 3 Ta create a condition variable
.It Xr pthread_cond_wait 3 Ta wait for a condition variable
.It Xr pthread_condattr 3 Ta condition attribute operations
.It Xr pthread_create 3 Ta create a new thread
.It Xr pthread_detach 3 Ta detach a thread
.It Xr pthread_equal 3 Ta compare thread identifiers
.It Xr pthread_exit 3 Ta terminate the calling thread
.It Xr pthread_getspecific 3 Ta get a thread-specific data value
.It Xr pthread_join 3 Ta wait for thread termination
.It Xr pthread_key_create 3 Ta thread-specific data key creation
.It Xr pthread_key_delete 3 Ta delete a thread-specific data key
.It Xr pthread_kill 3 Ta send a signal to a specific thread
.It Xr pthread_mutex_destroy 3 Ta free a mutex
.It Xr pthread_mutex_init 3 Ta create a mutex
.It Xr pthread_mutex_lock 3 Ta acquire a lock on a mutex
.It Xr pthread_mutex_unlock 3 Ta unlock a mutex
.It Xr pthread_mutexattr 3 Ta mutex attribute operations
.It Xr pthread_once 3 Ta dynamic package initialization
.It Xr pthread_rwlock_destroy 3 Ta destroy a read/write lock
.It Xr pthread_rwlock_init 3 Ta initialize a read/write lock
.It Xr pthread_rwlock_rdlock 3 Ta acquire a read/write lock for reading
.It Xr pthread_rwlock_unlock 3 Ta release a read/write lock
.It Xr pthread_rwlock_wrlock 3 Ta acquire a read/write lock for writing
.It Xr pthread_rwlockattr 3 Ta read/write lock attribute operations
.It Xr pthread_schedparam 3 Ta thread scheduling manipulation
.It Xr pthread_self 3 Ta get the ID of the calling thread
.It Xr pthread_setspecific 3 Ta get a thread-specific data value
.It Xr pthread_sigmask 3 Ta manipulate a thread's signal mask
.It Xr pthread_spin_destroy 3 Ta destroy a spin lock
.It Xr pthread_spin_init 3 Ta initialize a spin lock
.It Xr pthread_spin_lock 3 Ta acquire a spin lock
.It Xr pthread_spin_unlock 3 Ta release a spin lock
.It Xr pthread_testcancel 3 Ta set cancelability state
.El
.Sh ENVIRONMENT
The following environment variables affect the behavior of the library:
.Bl -tag -width "XXX"
.It Ev PTHREAD_DIAGASSERT
Possible values are any combinations of:
.Pp
.Bl -tag -width "X " -offset 1n -compact
.It Em A
Report errors to application by error return, but do not abort.
.It Em a
Abort on errors, creating a core dump for further debugging.
.It Em E
Do not log errors to stdout.
.It Em e
Log errors to stdout.
.It Em L
Do not log errors via
.Xr syslogd 8 .
.It Em l
Log errors via
.Xr syslogd 8 .
.El
.Pp
If not set in the environment, the
.Nm
library behaves as if
.Em AEL
has been specified.
.It Ev PTHREAD_STACKSIZE
Integer value giving the stack size in kilobytes.
This allows to set a smaller stack size than the default stack size.
The default stack size is the current limit on the stack size as
set with the shell's command to change limits
.Ic ( limit
for
.Xr csh 1 ,
or
.Ic ulimit
for
.Xr sh 1 ) .
.El
.Sh SEE ALSO
.Rs
.%A David R. Butenhof
.%T Programming with POSIX(R) Threads
.%D 1997
.%I Addison-Wesley
.Re
.Sh STANDARDS
The
.Nm
library conforms to
.St -p1003.1-2001 .
.Sh CAVEATS
Due to limitations in the current pthread implementation,
.Xr makecontext 3
and
.Xr sigaltstack 2
should not be used in programs which link against the
.Nm
library (whether threads are used or not).

1416
lib/libpthread/pthread.c Normal file

File diff suppressed because it is too large Load Diff

384
lib/libpthread/pthread.h Normal file
View File

@@ -0,0 +1,384 @@
/* $NetBSD: pthread.h,v 1.35 2012/11/03 03:10:50 christos Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nathan J. Williams.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _LIB_PTHREAD_H
#define _LIB_PTHREAD_H
#include <sys/cdefs.h>
#include <time.h> /* For timespec */
#include <sched.h>
#include <sys/featuretest.h>
#include <pthread_types.h>
__BEGIN_DECLS
int pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
int pthread_create(pthread_t * __restrict,
const pthread_attr_t * __restrict, void *(*)(void *),
void * __restrict);
void pthread_exit(void *) __attribute__((__noreturn__));
int pthread_join(pthread_t, void **);
int pthread_equal(pthread_t, pthread_t);
pthread_t pthread_self(void);
int pthread_detach(pthread_t);
int pthread_getrrtimer_np(void);
int pthread_setrrtimer_np(int);
int pthread_attr_init(pthread_attr_t *);
int pthread_attr_destroy(pthread_attr_t *);
int pthread_attr_get_np(pthread_t, pthread_attr_t *);
int pthread_attr_getguardsize(const pthread_attr_t * __restrict,
size_t * __restrict);
int pthread_attr_setguardsize(pthread_attr_t *, size_t);
int pthread_attr_getinheritsched(const pthread_attr_t * __restrict,
int * __restrict);
int pthread_attr_setinheritsched(pthread_attr_t *, int);
int pthread_attr_getschedparam(const pthread_attr_t * __restrict,
struct sched_param * __restrict);
int pthread_attr_setschedparam(pthread_attr_t * __restrict,
const struct sched_param * __restrict);
int pthread_attr_getschedpolicy(const pthread_attr_t * __restrict,
int * __restrict);
int pthread_attr_setschedpolicy(pthread_attr_t *, int);
int pthread_attr_getscope(const pthread_attr_t * __restrict,
int * __restrict);
int pthread_attr_setscope(pthread_attr_t *, int);
int pthread_attr_getstack(const pthread_attr_t * __restrict,
void ** __restrict, size_t * __restrict);
int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
int pthread_attr_getstacksize(const pthread_attr_t * __restrict,
size_t * __restrict);
int pthread_attr_setstacksize(pthread_attr_t *, size_t);
int pthread_attr_getstackaddr(const pthread_attr_t * __restrict,
void ** __restrict);
int pthread_attr_setstackaddr(pthread_attr_t *, void *);
int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
int pthread_attr_setdetachstate(pthread_attr_t *, int);
int pthread_attr_getname_np(const pthread_attr_t *, char *,
size_t, void **);
int pthread_attr_setname_np(pthread_attr_t *, const char *, void *);
int pthread_mutex_init(pthread_mutex_t * __restrict,
const pthread_mutexattr_t * __restrict);
int pthread_mutex_destroy(pthread_mutex_t *);
int pthread_mutex_lock(pthread_mutex_t *);
int pthread_mutex_trylock(pthread_mutex_t *);
int pthread_mutex_unlock(pthread_mutex_t *);
int pthread_mutexattr_init(pthread_mutexattr_t *);
int pthread_mutexattr_destroy(pthread_mutexattr_t *);
int pthread_mutexattr_gettype(const pthread_mutexattr_t * __restrict,
int * __restrict);
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int);
int pthread_cond_init(pthread_cond_t * __restrict,
const pthread_condattr_t * __restrict);
int pthread_cond_destroy(pthread_cond_t *);
int pthread_cond_wait(pthread_cond_t * __restrict,
pthread_mutex_t * __restrict);
#ifndef __LIBC12_SOURCE__
int pthread_cond_timedwait(pthread_cond_t * __restrict,
pthread_mutex_t * __restrict, const struct timespec * __restrict);
#endif
int pthread_cond_signal(pthread_cond_t *);
int pthread_cond_broadcast(pthread_cond_t *);
int pthread_condattr_init(pthread_condattr_t *);
#if defined(_NETBSD_SOURCE)
int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
#endif
int pthread_condattr_destroy(pthread_condattr_t *);
int pthread_once(pthread_once_t *, void (*)(void));
int pthread_key_create(pthread_key_t *, void (*)(void *));
int pthread_key_delete(pthread_key_t);
int pthread_setspecific(pthread_key_t, const void *);
void* pthread_getspecific(pthread_key_t);
int pthread_cancel(pthread_t);
int pthread_setcancelstate(int, int *);
int pthread_setcanceltype(int, int *);
void pthread_testcancel(void);
int pthread_getname_np(pthread_t, char *, size_t);
int pthread_setname_np(pthread_t, const char *, void *);
int pthread_attr_setcreatesuspend_np(pthread_attr_t *);
int pthread_suspend_np(pthread_t);
int pthread_resume_np(pthread_t);
unsigned int pthread_curcpu_np(void);
struct pthread_cleanup_store {
void *pad[4];
};
#define pthread_cleanup_push(routine, arg) \
{ \
struct pthread_cleanup_store __store; \
pthread__cleanup_push((routine),(arg), &__store);
#define pthread_cleanup_pop(execute) \
pthread__cleanup_pop((execute), &__store); \
}
void pthread__cleanup_push(void (*)(void *), void *, void *);
void pthread__cleanup_pop(int, void *);
int pthread_spin_init(pthread_spinlock_t *, int);
int pthread_spin_destroy(pthread_spinlock_t *);
int pthread_spin_lock(pthread_spinlock_t *);
int pthread_spin_trylock(pthread_spinlock_t *);
int pthread_spin_unlock(pthread_spinlock_t *);
int pthread_rwlock_init(pthread_rwlock_t * __restrict,
const pthread_rwlockattr_t * __restrict);
int pthread_rwlock_destroy(pthread_rwlock_t *);
int pthread_rwlock_rdlock(pthread_rwlock_t *);
int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
int pthread_rwlock_wrlock(pthread_rwlock_t *);
int pthread_rwlock_trywrlock(pthread_rwlock_t *);
#ifndef __LIBC12_SOURCE__
int pthread_rwlock_timedrdlock(pthread_rwlock_t * __restrict,
const struct timespec * __restrict);
int pthread_rwlock_timedwrlock(pthread_rwlock_t * __restrict,
const struct timespec * __restrict);
#endif
int pthread_rwlock_unlock(pthread_rwlock_t *);
int pthread_rwlockattr_init(pthread_rwlockattr_t *);
int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
int pthread_barrier_init(pthread_barrier_t * __restrict,
const pthread_barrierattr_t * __restrict, unsigned int);
int pthread_barrier_wait(pthread_barrier_t *);
int pthread_barrier_destroy(pthread_barrier_t *);
int pthread_barrierattr_init(pthread_barrierattr_t *);
int pthread_barrierattr_destroy(pthread_barrierattr_t *);
int pthread_getschedparam(pthread_t, int * __restrict,
struct sched_param * __restrict);
int pthread_setschedparam(pthread_t, int, const struct sched_param *);
int pthread_setschedprio(pthread_t, int);
int *pthread__errno(void);
#if defined(_NETBSD_SOURCE)
int pthread_getaffinity_np(pthread_t, size_t, cpuset_t *);
int pthread_setaffinity_np(pthread_t, size_t, cpuset_t *);
int pthread_getattr_np(pthread_t, pthread_attr_t *);
int pthread_mutex_held_np(pthread_mutex_t *);
pthread_t pthread_mutex_owner_np(pthread_mutex_t *);
int pthread_rwlock_held_np(pthread_rwlock_t *);
int pthread_rwlock_wrheld_np(pthread_rwlock_t *);
int pthread_rwlock_rdheld_np(pthread_rwlock_t *);
int pthread_cond_has_waiters_np(pthread_cond_t *);
#endif /* _NETBSD_SOURCE */
__END_DECLS
#define PTHREAD_CREATE_JOINABLE 0
#define PTHREAD_CREATE_DETACHED 1
#define PTHREAD_INHERIT_SCHED 0
#define PTHREAD_EXPLICIT_SCHED 1
#define PTHREAD_SCOPE_PROCESS 0
#define PTHREAD_SCOPE_SYSTEM 1
#define PTHREAD_PROCESS_PRIVATE 0
#define PTHREAD_PROCESS_SHARED 1
#define PTHREAD_CANCEL_DEFERRED 0
#define PTHREAD_CANCEL_ASYNCHRONOUS 1
#define PTHREAD_CANCEL_ENABLE 0
#define PTHREAD_CANCEL_DISABLE 1
#define PTHREAD_BARRIER_SERIAL_THREAD 1234567
/*
* POSIX 1003.1-2001, section 2.5.9.3: "The symbolic constant
* PTHREAD_CANCELED expands to a constant expression of type (void *)
* whose value matches no pointer to an object in memory nor the value
* NULL."
*/
#define PTHREAD_CANCELED ((void *) 1)
/*
* Maximum length of a thread's name, including the terminating NUL.
*/
#define PTHREAD_MAX_NAMELEN_NP 32
/*
* Mutex attributes.
*/
#define PTHREAD_MUTEX_NORMAL 0
#define PTHREAD_MUTEX_ERRORCHECK 1
#define PTHREAD_MUTEX_RECURSIVE 2
#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
#define PTHREAD_COND_INITIALIZER _PTHREAD_COND_INITIALIZER
#define PTHREAD_MUTEX_INITIALIZER _PTHREAD_MUTEX_INITIALIZER
#define PTHREAD_ONCE_INIT _PTHREAD_ONCE_INIT
#define PTHREAD_RWLOCK_INITIALIZER _PTHREAD_RWLOCK_INITIALIZER
#define PTHREAD_SPINLOCK_INITIALIZER _PTHREAD_SPINLOCK_INITIALIZER
/*
* Use macros to rename many pthread functions to the corresponding
* libc symbols which are either trivial/no-op stubs or the real
* thing, depending on whether libpthread is linked in to the
* program. This permits code, particularly libraries that do not
* directly use threads but want to be thread-safe in the presence of
* threaded callers, to use pthread mutexes and the like without
* unnecessairly including libpthread in their linkage.
*
* Left out of this list are functions that can't sensibly be trivial
* or no-op stubs in a single-threaded process (pthread_create,
* pthread_kill, pthread_detach), functions that normally block and
* wait for another thread to do something (pthread_join), and
* functions that don't make sense without the previous functions
* (pthread_attr_*). The pthread_cond_wait and pthread_cond_timedwait
* functions are useful in implementing certain protection mechanisms,
* though a non-buggy app shouldn't end up calling them in
* single-threaded mode.
*
* The rename is done as:
* #define pthread_foo __libc_foo
* instead of
* #define pthread_foo(x) __libc_foo((x))
* in order that taking the address of the function ("func =
* &pthread_foo;") continue to work.
*
* POSIX/SUSv3 requires that its functions exist as functions (even if
* macro versions exist) and specifically that "#undef pthread_foo" is
* legal and should not break anything. Code that does such will not
* successfully get the stub behavior implemented here and will
* require libpthread to be linked in.
*/
#ifndef __LIBPTHREAD_SOURCE__
__BEGIN_DECLS
int __libc_mutex_init(pthread_mutex_t * __restrict, const pthread_mutexattr_t * __restrict);
int __libc_mutex_lock(pthread_mutex_t *);
int __libc_mutex_trylock(pthread_mutex_t *);
int __libc_mutex_unlock(pthread_mutex_t *);
int __libc_mutex_destroy(pthread_mutex_t *);
int __libc_mutexattr_init(pthread_mutexattr_t *);
int __libc_mutexattr_settype(pthread_mutexattr_t *, int);
int __libc_mutexattr_destroy(pthread_mutexattr_t *);
__END_DECLS
#define pthread_mutex_init __libc_mutex_init
#define pthread_mutex_lock __libc_mutex_lock
#define pthread_mutex_trylock __libc_mutex_trylock
#define pthread_mutex_unlock __libc_mutex_unlock
#define pthread_mutex_destroy __libc_mutex_destroy
#define pthread_mutexattr_init __libc_mutexattr_init
#define pthread_mutexattr_settype __libc_mutexattr_settype
#define pthread_mutexattr_destroy __libc_mutexattr_destroy
__BEGIN_DECLS
int __libc_cond_init(pthread_cond_t * __restrict,
const pthread_condattr_t * __restrict);
int __libc_cond_signal(pthread_cond_t *);
int __libc_cond_broadcast(pthread_cond_t *);
int __libc_cond_wait(pthread_cond_t * __restrict,
pthread_mutex_t * __restrict);
#ifndef __LIBC12_SOURCE__
int __libc_cond_timedwait(pthread_cond_t * __restrict,
pthread_mutex_t * __restrict, const struct timespec * __restrict);
#endif
int __libc_cond_destroy(pthread_cond_t *);
__END_DECLS
#define pthread_cond_init __libc_cond_init
#define pthread_cond_signal __libc_cond_signal
#define pthread_cond_broadcast __libc_cond_broadcast
#define pthread_cond_wait __libc_cond_wait
#define pthread_cond_timedwait __libc_cond_timedwait
#define pthread_cond_destroy __libc_cond_destroy
__BEGIN_DECLS
int __libc_rwlock_init(pthread_rwlock_t * __restrict,
const pthread_rwlockattr_t * __restrict);
int __libc_rwlock_rdlock(pthread_rwlock_t *);
int __libc_rwlock_wrlock(pthread_rwlock_t *);
int __libc_rwlock_tryrdlock(pthread_rwlock_t *);
int __libc_rwlock_trywrlock(pthread_rwlock_t *);
int __libc_rwlock_unlock(pthread_rwlock_t *);
int __libc_rwlock_destroy(pthread_rwlock_t *);
__END_DECLS
#define pthread_rwlock_init __libc_rwlock_init
#define pthread_rwlock_rdlock __libc_rwlock_rdlock
#define pthread_rwlock_wrlock __libc_rwlock_wrlock
#define pthread_rwlock_tryrdlock __libc_rwlock_tryrdlock
#define pthread_rwlock_trywrlock __libc_rwlock_trywrlock
#define pthread_rwlock_unlock __libc_rwlock_unlock
#define pthread_rwlock_destroy __libc_rwlock_destroy
__BEGIN_DECLS
int __libc_thr_keycreate(pthread_key_t *, void (*)(void *));
int __libc_thr_setspecific(pthread_key_t, const void *);
void *__libc_thr_getspecific(pthread_key_t);
int __libc_thr_keydelete(pthread_key_t);
__END_DECLS
#define pthread_key_create __libc_thr_keycreate
#define pthread_setspecific __libc_thr_setspecific
#define pthread_getspecific __libc_thr_getspecific
#define pthread_key_delete __libc_thr_keydelete
__BEGIN_DECLS
int __libc_thr_once(pthread_once_t *, void (*)(void));
pthread_t __libc_thr_self(void);
void __libc_thr_exit(void *) __attribute__((__noreturn__));
int __libc_thr_setcancelstate(int, int *);
int __libc_thr_equal(pthread_t, pthread_t);
unsigned int __libc_thr_curcpu(void);
__END_DECLS
#define pthread_once __libc_thr_once
#define pthread_self __libc_thr_self
#define pthread_exit __libc_thr_exit
#define pthread_setcancelstate __libc_thr_setcancelstate
#define pthread_equal __libc_thr_equal
#define pthread_curcpu_np __libc_thr_curcpu
#endif /* __LIBPTHREAD_SOURCE__ */
#endif /* _LIB_PTHREAD_H */

View File

@@ -0,0 +1,155 @@
.\" $NetBSD: pthread_attr.3,v 1.22 2012/11/10 23:12:36 uwe Exp $
.\"
.\" Copyright (c) 2002, 2010 The NetBSD Foundation, Inc.
.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
.\"
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" 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(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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.
.\"
.\" $FreeBSD: src/lib/libpthread/man/pthread_attr.3,v 1.11 2002/09/16 19:29:28 mini Exp $
.\"
.Dd July 9, 2010
.Dt PTHREAD_ATTR 3
.Os
.Sh NAME
.Nm pthread_attr_init ,
.Nm pthread_attr_destroy
.Nd thread attribute operations
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_attr_init "pthread_attr_t *attr"
.Ft int
.Fn pthread_attr_destroy "pthread_attr_t *attr"
.Sh DESCRIPTION
Thread attributes are used to specify parameters to
.Fn pthread_create .
One attribute object can be used in multiple calls to
.Fn pthread_create ,
with or without modifications between the calls.
The
.Vt pthread_attr_t
type is an opaque representation of the thread attributes;
any access to the object other than via the described
.Fn pthread_attr_*
functions may result in undefined behavior.
.Pp
The
.Fn pthread_attr_init
function initializes
.Fa attr
with the default thread attributes used in the implementation.
Depending on the implementation, undefined behavior may follow
if an uninitialized thread attribute object is used with some of
the thread attribute functions.
It is therefore a good practice to always use
.Fn pthread_attr_init ,
even if this might be unnecessary.
Undefined behavior may also follow if an already initialized
.Fa attr
is used with
.Fn pthread_attr_init .
.Pp
When the attribute object is no longer needed,
it should be destroyed by using
.Fn pthread_attr_destroy .
The function has no effect on threads that
were created by using a given attribute object.
A destroyed
.Fa attr
can be reinitialized using
.Fn pthread_attr_init ,
but all other actions with the destroyed object are unspecified.
.Pp
The following standard thread attribute functions are available:
.Bl -column -offset indent "pthread_attr_getinheritsched " "XXX"
.It Sy Function Ta Sy Description
.It Xr pthread_attr_getdetachstate 3 Ta thread detach state
.It Xr pthread_attr_getguardsize 3 Ta thread guard size
.It Xr pthread_attr_getinheritsched 3 Ta inherit scheduler attribute
.It Xr pthread_attr_getschedparam 3 Ta thread scheduling parameter
.It Xr pthread_attr_getschedpolicy 3 Ta thread scheduling policy
.It Xr pthread_attr_getscope 3 Ta thread contention scope
.It Xr pthread_attr_getstack 3 Ta thread stack
.It Xr pthread_attr_getstacksize 3 Ta thread stack size
.It Xr pthread_attr_getstackaddr 3 Ta thread stack address
.El
.Pp
Each listed
.Fn pthread_attr_get*
function has a
.Fn pthread_attr_set*
counterpart.
In addition, the following
.Nx
specific extensions are available:
.Bl -column -offset indent "pthread_attr_getinheritsched " "XXX"
.It Sy Function Ta Sy Description
.It Xr pthread_attr_get_np 3 Ta attributes of a running thread
.It Xr pthread_attr_getname_np 3 Ta descriptive name of an attribute
.El
.Sh RETURN VALUES
If successful, these functions return 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
No errors are defined for
.Fn pthread_attr_init
and
.Fn pthread_attr_destroy .
.Sh SEE ALSO
.Xr pthread_create 3 ,
.Xr pthread_join 3
.Sh STANDARDS
Both
.Fn pthread_attr_init
and
.Fn pthread_attr_destroy
conform to
.St -p1003.1-2001 .

View File

@@ -0,0 +1,464 @@
/* $NetBSD: pthread_attr.c,v 1.16 2012/03/02 18:06:05 joerg Exp $ */
/*-
* Copyright (c) 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nathan J. Williams.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: pthread_attr.c,v 1.16 2012/03/02 18:06:05 joerg Exp $");
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifndef __lint__
#define pthread_attr_get_np _pthread_attr_get_np
#endif
#include "pthread.h"
#include "pthread_int.h"
__weak_alias(pthread_attr_get_np, _pthread_attr_get_np)
static struct pthread_attr_private *pthread__attr_init_private(
pthread_attr_t *);
static struct pthread_attr_private *
pthread__attr_init_private(pthread_attr_t *attr)
{
struct pthread_attr_private *p;
if ((p = attr->pta_private) != NULL)
return p;
p = malloc(sizeof(*p));
if (p != NULL) {
memset(p, 0, sizeof(*p));
attr->pta_private = p;
p->ptap_policy = SCHED_OTHER;
}
return p;
}
int
pthread_attr_init(pthread_attr_t *attr)
{
attr->pta_magic = PT_ATTR_MAGIC;
attr->pta_flags = 0;
attr->pta_private = NULL;
return 0;
}
int
pthread_attr_destroy(pthread_attr_t *attr)
{
struct pthread_attr_private *p;
if ((p = attr->pta_private) != NULL)
free(p);
return 0;
}
int
pthread_attr_get_np(pthread_t thread, pthread_attr_t *attr)
{
struct pthread_attr_private *p;
p = pthread__attr_init_private(attr);
if (p == NULL)
return ENOMEM;
attr->pta_flags = thread->pt_flags &
(PT_FLAG_DETACHED | PT_FLAG_SCOPE_SYSTEM | PT_FLAG_EXPLICIT_SCHED);
p->ptap_namearg = thread->pt_name;
p->ptap_stackaddr = thread->pt_stack.ss_sp;
p->ptap_stacksize = thread->pt_stack.ss_size;
p->ptap_guardsize = pthread__pagesize;
return pthread_getschedparam(thread, &p->ptap_policy, &p->ptap_sp);
}
int
pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
{
if (attr->pta_flags & PT_FLAG_DETACHED)
*detachstate = PTHREAD_CREATE_DETACHED;
else
*detachstate = PTHREAD_CREATE_JOINABLE;
return 0;
}
int
pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
{
switch (detachstate) {
case PTHREAD_CREATE_JOINABLE:
attr->pta_flags &= ~PT_FLAG_DETACHED;
break;
case PTHREAD_CREATE_DETACHED:
attr->pta_flags |= PT_FLAG_DETACHED;
break;
default:
return EINVAL;
}
return 0;
}
int
pthread_attr_getguardsize(const pthread_attr_t *attr, size_t *guard)
{
struct pthread_attr_private *p;
if ((p = attr->pta_private) == NULL)
*guard = (size_t)sysconf(_SC_PAGESIZE);
else
*guard = p->ptap_guardsize;
return 0;
}
int
pthread_attr_setguardsize(pthread_attr_t *attr, size_t guard)
{
struct pthread_attr_private *p;
p = pthread__attr_init_private(attr);
if (p == NULL)
return ENOMEM;
p->ptap_guardsize = guard;
return 0;
}
int
pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit)
{
if (attr->pta_flags & PT_FLAG_EXPLICIT_SCHED)
*inherit = PTHREAD_EXPLICIT_SCHED;
else
*inherit = PTHREAD_INHERIT_SCHED;
return 0;
}
int
pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit)
{
switch (inherit) {
case PTHREAD_INHERIT_SCHED:
attr->pta_flags &= ~PT_FLAG_EXPLICIT_SCHED;
break;
case PTHREAD_EXPLICIT_SCHED:
attr->pta_flags |= PT_FLAG_EXPLICIT_SCHED;
break;
default:
return EINVAL;
}
return 0;
}
int
pthread_attr_getscope(const pthread_attr_t *attr, int *scope)
{
if (attr->pta_flags & PT_FLAG_SCOPE_SYSTEM)
*scope = PTHREAD_SCOPE_SYSTEM;
else
*scope = PTHREAD_SCOPE_PROCESS;
return 0;
}
int
pthread_attr_setscope(pthread_attr_t *attr, int scope)
{
switch (scope) {
case PTHREAD_SCOPE_PROCESS:
attr->pta_flags &= ~PT_FLAG_SCOPE_SYSTEM;
break;
case PTHREAD_SCOPE_SYSTEM:
attr->pta_flags |= PT_FLAG_SCOPE_SYSTEM;
break;
default:
return EINVAL;
}
return 0;
}
int
pthread_attr_setschedparam(pthread_attr_t *attr,
const struct sched_param *param)
{
struct pthread_attr_private *p;
int error;
if (param == NULL)
return EINVAL;
p = pthread__attr_init_private(attr);
if (p == NULL)
return ENOMEM;
error = pthread__checkpri(param->sched_priority);
if (error == 0)
p->ptap_sp = *param;
return error;
}
int
pthread_attr_getschedparam(const pthread_attr_t *attr,
struct sched_param *param)
{
struct pthread_attr_private *p;
if (param == NULL)
return EINVAL;
p = attr->pta_private;
if (p == NULL)
memset(param, 0, sizeof(*param));
else
*param = p->ptap_sp;
return 0;
}
int
pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
{
struct pthread_attr_private *p;
switch (policy) {
case SCHED_OTHER:
case SCHED_FIFO:
case SCHED_RR:
p = pthread__attr_init_private(attr);
if (p == NULL)
return ENOMEM;
p->ptap_policy = policy;
return 0;
default:
return ENOTSUP;
}
}
int
pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy)
{
struct pthread_attr_private *p;
p = attr->pta_private;
if (p == NULL) {
*policy = SCHED_OTHER;
return 0;
}
*policy = p->ptap_policy;
return 0;
}
int
pthread_attr_getstack(const pthread_attr_t *attr, void **addr, size_t *size)
{
struct pthread_attr_private *p;
if ((p = attr->pta_private) == NULL) {
*addr = NULL;
*size = pthread__stacksize;
} else {
*addr = p->ptap_stackaddr;
*size = p->ptap_stacksize;
}
return 0;
}
int
pthread_attr_setstack(pthread_attr_t *attr, void *addr, size_t size)
{
struct pthread_attr_private *p;
p = pthread__attr_init_private(attr);
if (p == NULL)
return ENOMEM;
p->ptap_stackaddr = addr;
p->ptap_stacksize = size;
return 0;
}
int
pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *size)
{
struct pthread_attr_private *p;
if ((p = attr->pta_private) == NULL)
*size = pthread__stacksize;
else
*size = p->ptap_stacksize;
return 0;
}
int
pthread_attr_setstacksize(pthread_attr_t *attr, size_t size)
{
struct pthread_attr_private *p;
if (size < (size_t)sysconf(_SC_THREAD_STACK_MIN))
return EINVAL;
p = pthread__attr_init_private(attr);
if (p == NULL)
return ENOMEM;
p->ptap_stacksize = size;
return 0;
}
int
pthread_attr_getstackaddr(const pthread_attr_t *attr, void **addr)
{
struct pthread_attr_private *p;
if ((p = attr->pta_private) == NULL)
*addr = NULL;
else
*addr = p->ptap_stackaddr;
return 0;
}
int
pthread_attr_setstackaddr(pthread_attr_t *attr, void *addr)
{
struct pthread_attr_private *p;
p = pthread__attr_init_private(attr);
if (p == NULL)
return ENOMEM;
p->ptap_stackaddr = addr;
return 0;
}
int
pthread_attr_getname_np(const pthread_attr_t *attr, char *name, size_t len,
void **argp)
{
struct pthread_attr_private *p;
if ((p = attr->pta_private) == NULL) {
name[0] = '\0';
if (argp != NULL)
*argp = NULL;
} else {
strlcpy(name, p->ptap_name, len);
if (argp != NULL)
*argp = p->ptap_namearg;
}
return 0;
}
int
pthread_attr_setname_np(pthread_attr_t *attr, const char *name, void *arg)
{
struct pthread_attr_private *p;
int namelen;
p = pthread__attr_init_private(attr);
if (p == NULL)
return ENOMEM;
namelen = snprintf(p->ptap_name, PTHREAD_MAX_NAMELEN_NP, name, arg);
if (namelen >= PTHREAD_MAX_NAMELEN_NP) {
p->ptap_name[0] = '\0';
return EINVAL;
}
p->ptap_namearg = arg;
return 0;
}
int
pthread_attr_setcreatesuspend_np(pthread_attr_t *attr)
{
attr->pta_flags |= PT_FLAG_SUSPENDED;
return 0;
}
int
pthread_getattr_np(pthread_t thread, pthread_attr_t *attr)
{
int error;
if ((error = pthread_attr_init(attr)) != 0)
return error;
if ((error = pthread_attr_get_np(thread, attr)) != 0) {
(void)pthread_attr_destroy(attr);
return error;
}
return 0;
}

View File

@@ -0,0 +1,121 @@
.\" $NetBSD: pthread_attr_get_np.3,v 1.4 2010/08/06 05:35:42 christos Exp $
.\"
.\" Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi>
.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
.\"
.Dd August 6, 2010
.Dt PTHREAD_ATTR_GET_NP 3
.Os
.Sh NAME
.Nm pthread_attr_get_np
.Nd get attributes of existing thread
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_attr_get_np "pthread_t thread" "pthread_attr_t *attr"
.Ft int
.Fn pthread_getattr_np "pthread_t thread" "pthread_attr_t *attr"
.Sh DESCRIPTION
The
.Fn pthread_attr_get_np
and
.Fn pthread_getattr_np
functions can be used to retrieve attributes of a running
.Fa thread .
The result is stored to
.Fa attr .
.Pp
For
.Fn pthread_attr_get_np
.Fa attr
should be initialized prior to the call by using
.Xr pthread_attr_init 3 .
.Fn pthread_getattr_np
does this automatically.
.Pp
For both functions
.Fa attr
should be freed when it is not in use anymore with
.Xr pthread_attr_destroy 3 .
.Pp
Most fields of
.Fa attr
are the same ones provided during thread creation time as a parameter to
.Xr pthread_create 3 .
The exceptions include:
.Bl -bullet -offset indent
.It
The detach state -- a joinable thread
may have detached itself after the creation.
.It
The guard size, which may vary if the application
has allocated its own thread stack.
.It
The stack address and size;
.Fn pthread_attr_get_np
will always return the thread's real stack address and size,
regardless of the values in the original attributes structure.
.El
.Pp
The returned
.Vt pthread_attr_t
structure is supposed to be used in conjunction with the
.Fn pthread_attr_get*
functions to retrieve individual values from the structure.
When the returned
.Fa attr
is no longer needed, it should be destroyed by using
.Xr pthread_attr_destroy 3 .
.Sh RETURN VALUES
Upon successful completion,
.Fn pthread_attr_get_np
and
.Fn pthread_getattr_np
return 0.
Otherwise an error number is returned to indicate the error.
.Sh COMPATIBILITY
The
.Fn pthread_attr_get_np
and
.Fn pthread_getattr_np
functions are non-standard extensions.
.Sh ERRORS
The
.Fn pthread_attr_get_np
and
.Fn pthread_getattr_np
functions will fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
Insufficient memory.
.It Bq Er ESRCH
Non-existent
.Fa thread .
.El
.Sh SEE ALSO
.Xr pthread 3 ,
.Xr pthread_attr 3

View File

@@ -0,0 +1,119 @@
.\" $NetBSD: pthread_attr_getdetachstate.3,v 1.2 2010/07/09 08:51:28 jruoho Exp $
.\"
.\" Copyright (c) 2002, 2010 The NetBSD Foundation, Inc.
.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
.\"
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" 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(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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.
.\"
.\" $FreeBSD: src/lib/libpthread/man/pthread_attr.3,v 1.11 2002/09/16 19:29:28 mini Exp $
.\"
.Dd July 9, 2010
.Dt PTHREAD_ATTR_GETDETACHSTATE 3
.Os
.Sh NAME
.Nm pthread_attr_getdetachstate
.Nd get and set the
.Dq detach state
attribute
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_attr_getdetachstate "const pthread_attr_t *attr" "int *detachstate"
.Ft int
.Fn pthread_attr_setdetachstate "pthread_attr_t *attr" "int detachstate"
.Sh DESCRIPTION
The attribute parameters for the
.Fn pthread_attr_getdetachstate
and
.Fn pthread_attr_setdetachstate
functions are mutually exclusive and must be one of:
.Bl -tag -width PTHREAD_CREATE_DETACHED -offset 2n
.It Dv PTHREAD_CREATE_JOINABLE
The threads must explicitly be waited for using the
.Xr pthread_join 3
function once they exit for their status to be received and their resources
to be freed.
This is the default.
.It Dv PTHREAD_CREATE_DETACHED
The thread's resources will automatically be freed once the thread exits,
and the thread will not be joined.
.El
.Pp
If the thread is created as detached,
it is an error to use the thread
.Tn ID
with
.Xr pthread_detach 3
or
.Xr pthread_join 3 .
.Sh RETURN VALUES
If successful, these functions return 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
No errors are defined for
.Fn pthread_attr_getdetachstate .
.Pp
The
.Fn pthread_attr_setdetachstate
function should fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa detachstate
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_attr 3 ,
.Xr pthread_detach 3 ,
.Xr pthread_join 3
.Sh STANDARDS
Both functions conform to
.St -p1003.1-2001 .

View File

@@ -0,0 +1,124 @@
.\" $NetBSD: pthread_attr_getguardsize.3,v 1.2 2010/07/08 18:24:34 wiz Exp $
.\"
.\" Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi>
.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
.\"
.Dd July 7, 2010
.Dt PTHREAD_ATTR_GETGUARDSIZE 3
.Os
.Sh NAME
.Nm pthread_attr_getguardsize
.Nd get and set thread guard size
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_attr_getguardsize \
"const pthread_attr_t * restrict attr" "size_t * restrict guardsize"
.Ft int
.Fn pthread_attr_setguardsize "pthread_attr_t *attr" "size_t guardsize"
.Sh DESCRIPTION
The
.Fn pthread_attr_getguardsize
and
.Fn pthread_attr_setguardsize
functions get and set
.Fa guardsize
in the
.Fa attr
object.
If
.Fa guardsize
is larger than 0, the system reserves
an additional region of guarded memory of at least
.Fa guardsize
bytes at the end of the thread's stack for each new thread created by using
.Fa attr .
.Pp
The guarded area is understood to be pages of memory
that are protected from read and write access.
While the guarded area should be rounded by the system page size,
the actual default size is implementation-defined.
In
.Nx
the default
.Fa guardsize
is
.Dv _SC_PAGESIZE ,
the system page size.
.Pp
The rationale behind
.Fa guardsize
is two-fold:
.Bl -enum -offset 2n
.It
On the one hand, it provides protection against overflow of the stack pointer.
If there is a guard area and a thread overflows its
stack pointer into this extra memory area, it should receive a
.Dv SIGSEGV
signal or experience other comparable fatal error condition.
Note that if a thread allocates large data structures on stack,
it may be necessary to raise the default
.Fa guardsize
in order to detect stack overflows.
.It
On the other hand, the overflow protection may waste system resources
if an application that creates a large number of threads knows that it
will never overflow the stack.
In this case it is possible to set
.Fa guardsize
to 0.
.El
.Pp
If
.Xr pthread_attr_setstack 3
or
.Xr pthread_attr_setstackaddr 3
is used to set the stack address attribute in
.Fa attr ,
the guard size attribute is ignored and no guard area will be allocated;
it is the responsibility of the application to handle the overflow conditions.
.Sh RETURN VALUES
If successful, both functions return 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
No errors are defined for
.Fn pthread_attr_getguardsize .
.Pp
The
.Fn pthread_attr_setguardsize
may fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
There was insufficient memory.
.El
.Sh SEE ALSO
.Xr pthread_attr 3 ,
.Xr pthread_attr_setstack 3 ,
.Xr sysconf 3
.Sh STANDARDS
Both functions conform to
.St -p1003.1-2008 .

View File

@@ -0,0 +1,112 @@
.\" $NetBSD: pthread_attr_getinheritsched.3,v 1.3 2013/05/10 21:06:14 christos Exp $
.\"
.\" Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi>
.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
.\"
.Dd May 10, 2013
.Dt PTHREAD_ATTR_GETINHERITSCHED 3
.Os
.Sh NAME
.Nm pthread_attr_getinheritsched
.Nd get and set
.Dq inheritsched
attribute
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_attr_getinheritsched \
"const pthread_attr_t * restrict attr" "int * restrict inheritsched"
.Ft int
.Fn pthread_attr_setinheritsched "pthread_attr_t *attr" "int inheritsched"
.Sh DESCRIPTION
The
.Fn pthread_attr_getinheritsched
and
.Fn pthread_attr_setinheritsched
functions get and set, respectively, the inherit scheduler attribute,
.Fa inheritsched ,
in the
.Fa attr
object.
The
.Fa inheritsched
parameter specifies whether a tread created by using
.Fa attr
will obtain its scheduling attributes directly from
.Fa attr
or whether it will inherit these from the calling thread.
.Pp
Two values are possible for
.Fa inheritsched :
.Bl -tag -width PTHREAD_EXPLICIT_SCHED -offset indent
.It Dv PTHREAD_INHERIT_SCHED
The thread scheduling attributes will be
inherited from the creating thread and the ones in
.Fa attr
are ignored.
.It Dv PTHREAD_EXPLICIT_SCHED
The thread scheduling attributes will be set to the corresponding values in
.Fa attr .
.El
.Pp
The following thread scheduling attributes are affected by
.Fa inheritsched :
.Bl -bullet -offset indent
.It
Scheduling policy; see
.Xr pthread_attr_setschedpolicy 3 .
.It
Scheduling parameter; see
.Xr pthread_attr_getschedparam 3 .
.It
Scheduling contention scope; see
.Xr pthread_attr_getscope 3 .
.El
.Sh RETURN VALUES
If successful, both functions return 0.
Otherwise, an error number is returned to indicate the error.
.Sh COMPATIBILITY
The standard leaves it unspecified which (if any) is the default
inherit scheduler attribute in a newly initialized attribute object.
.Sh ERRORS
No errors are defined for
.Fn pthread_attr_getinheritsched .
.Pp
The
.Fn pthread_attr_setinheritsched
function may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa inheritsched
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_attr 3
.Sh STANDARDS
Both functions conform to
.St -p1003.1-2008 .

Some files were not shown because too many files have changed in this diff Show More