Fix bootstrapping crash.

If a custom small_size2bin table was required due to non-default size
class settings, memory allocation prior to initializing chunk parameters
would cause a crash due to division by 0.  The fix re-orders the various
*_boot() function calls.

Bootstrapping is simpler now than it was before the base allocator
started just using the chunk allocator directly.  This allows
arena_boot[01]() to be combined.

Add error detection for pthread_atfork() and atexit() function calls.
diff --git a/jemalloc/src/jemalloc.c b/jemalloc/src/jemalloc.c
index 885209b..55c77ed 100644
--- a/jemalloc/src/jemalloc.c
+++ b/jemalloc/src/jemalloc.c
@@ -702,6 +702,15 @@
 		}
 	}
 
+	/* Register fork handlers. */
+	if (pthread_atfork(jemalloc_prefork, jemalloc_postfork,
+	    jemalloc_postfork) != 0) {
+		malloc_write4("<jemalloc>", ": Error in pthread_atfork()\n", "",
+		    "");
+		if (opt_abort)
+			abort();
+	}
+
 	if (ctl_boot()) {
 		malloc_mutex_unlock(&init_lock);
 		return (true);
@@ -717,18 +726,25 @@
 #endif
 	if (opt_stats_print) {
 		/* Print statistics at exit. */
-		atexit(stats_print_atexit);
+		if (atexit(stats_print_atexit) != 0) {
+			malloc_write4("<jemalloc>", ": Error in atexit()\n", "",
+			    "");
+			if (opt_abort)
+				abort();
+		}
 	}
 
-	/* Register fork handlers. */
-	pthread_atfork(jemalloc_prefork, jemalloc_postfork, jemalloc_postfork);
+	if (chunk_boot()) {
+		malloc_mutex_unlock(&init_lock);
+		return (true);
+	}
 
 	if (base_boot()) {
 		malloc_mutex_unlock(&init_lock);
 		return (true);
 	}
 
-	if (arena_boot0()) {
+	if (arena_boot()) {
 		malloc_mutex_unlock(&init_lock);
 		return (true);
 	}
@@ -737,12 +753,6 @@
 	tcache_boot();
 #endif
 
-	if (chunk_boot()) {
-		malloc_mutex_unlock(&init_lock);
-		return (true);
-	}
-	arena_boot1();
-
 	if (huge_boot()) {
 		malloc_mutex_unlock(&init_lock);
 		return (true);