develooper Front page | perl.perl5.porters | Postings from June 2003

Changes to fork() in Solaris 10

Alan Burlison
June 30, 2003 13:08
Changes to fork() in Solaris 10
Message ID:
FYI, the semantics of fork() are changing in Solaris 10:

	In all previous Solaris releases back to the
	first that contained Posix threads (pthreads), the definition
	of the semantics of fork(2) has been problematic.

	In particular, for multithreaded processes not linked with
	-lpthread, fork() replicates all of the parent process's
	threads in the child (the so-called forkall() semantics),
	whereas for a process linked with -lpthread, fork() becomes
	fork1() and only the calling thread is replicated in the
	child of fork().

	If this is not confusing enough, a process not linked with
	-lpthread can execute dlopen() of some library that is linked
	with -lpthread and thereby itself become linked with libpthread
	on the fly.  If this happens, the definition of fork() changes
	to fork1() on the fly and there is nothing the process can do
	to detect this or to protect against it since there is no
	forkall() interface in the system.

         The change to libc is small, just make fork() be a synonym for
	fork1() and change the name of the previous fork() to forkall().
	The remainder of the change is to find all instances of fork()
	in Solaris and change them to forkall() if appropriate.

I don't think this will have any effect on Perl as it already links with 
pthread when built threaded, so this is just a heads-up.

Alan Burlison
-- Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About