core: Optimize fork/exec for *BSD and Solaris.