lack of pthread_atfork() in FreeBSD 4.8

Dan Nelson dnelson at
Mon Aug 25 14:12:24 PDT 2003

In the last episode (Aug 26), Alex said:
> Dan Nelson wrote:
> >In the last episode (Aug 25), Alex said:
> >>I've got a problem when compiling Peter Gutmann's CryptLib under
> >>FreeBSD 4.8 as it needs some unimplemented function in pthreads
> >>library pthread_atfork().
> >
> >Use the port?  /usr/ports/security/cryptlib builds just fine for me on
> >4.x and 5.x
> >
> I have no actual idea what Peter had changed there since beta 4 that was 
> compiled w/out any problem but I need beta 5 because of SSH problems in 
> previous betas under FreeBSD.
> I looked through /usr/ports/security/cryptlib and found it just 
> downloading tarball from Peter's ftp with all faults I'm facing every 
> time when compiling it.
> I mean original makefile ignores -pthread option and hence makes a mass 
> of linker errors to occur.

The pthread_atfork() business is only required for broken pthreads
implementations that return a different value for getpid() from each
thread (i.e. Linux).  He's got his ifdefs backwrds imho.  The code in
rndunix.c:1270 should test for __LINUX__, instead of testing for all
other unixes  :)

Try adding || defined(__FreeBSD__) to the set of tests on line 1270.

	Dan Nelson
	dnelson at

More information about the freebsd-questions mailing list