#For FreeBSD 3.0 # # The pthreads library for FreeBSD doesn't contain the sigwait function # and there is some bugs in it. To fix this, run this file trough 'patch' # in the /usr/src/lib/libc_r/uthread directory. Follow after # this the instructions that can be found with 'man pthread' about how to # recompile the libc_r library. # # You can test if you have a 'modern' libc_r.a with: # # > nm /usr/lib/libc_r.a | grep sigwait. # # If the above doesn't find sigwait you have to use this patch and recompile # libc_r. # diff of Makefile.inc in /usr/src/lib/libc_r/uthread/ and . 85a86 > uthread_sigwait.c \ diff of pthread_private.h in /usr/src/lib/libc_r/uthread/ and . 243c243,244 < PS_STATE_MAX --- > PS_STATE_MAX, > PS_SIGSUSPEND 344c345 < sigset_t sigmask; --- > sigset_t sigmask,sigwaitmask; diff of uthread_kern.c in /usr/src/lib/libc_r/uthread/ and . 53c53,54 < static sigset_t sig_to_block = 0xffffffff; --- > /* Changed by monty for easy debugging of pthreads with gdb */ > static sigset_t sig_to_block = ~((1 << 5) | (1 << 6) | (1 << 4)); 893a895 > case PS_SIGSUSPEND: 909a912,913 > if (sigismember(&pthread->sigwaitmask, sig)) > { 914a919 > } 1100a1106 > case PS_SIGSUSPEND: 1449a1456 > case PS_SIGSUSPEND: diff of uthread_sigsuspend.c in /usr/src/lib/libc_r/uthread/ and . 50,51c50,51 < /* Combine the caller's mask with the current one: */ < _thread_run->sigmask |= *set; --- > /* Replace the caller's mask with the current one: */ > _thread_run->sigmask= *set;/* Patched by Monty */ 54c54 < _thread_kern_sched_state(PS_SIGWAIT, __FILE__, __LINE__); --- > _thread_kern_sched_state(PS_SIGSUSPEND, __FILE__, __LINE__); diff of uthread_sigwait.c in /usr/src/lib/libc_r/uthread/ and . 38a39,40 > /* This version of sigwait is modifed by monty@tcx.se to work properly */ > 42c44 < int ret; --- > int ret=0; 49,51d50 < /* Save the current sigmal mask: */ < oset = _thread_run->sigmask; < 53c52,56 < _thread_run->sigmask |= *set; --- > _thread_run->sigmask &= ~*set; > _thread_run->sigwaitmask = *set; > > /* Clear for easy error check */ > _thread_run->signo=0; 62a66,68 > > /* Reset the sigwait mask for debugging */ > _thread_run->sigwaitmask = 0;