Add job number specific dumping and fix atexit() error

The threads/process jobs should use _exit() so they don't run
the main atexit() function.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/fio.c b/fio.c
index 90bad97..c17ea3c 100644
--- a/fio.c
+++ b/fio.c
@@ -1233,12 +1233,15 @@
 				if (pthread_detach(td->thread) < 0)
 					perror("pthread_detach");
 			} else {
+				pid_t pid;
 				dprint(FD_PROCESS, "will fork\n");
-				if (!fork()) {
+				pid = fork();
+				if (!pid) {
 					int ret = fork_main(shm_id, i);
 
-					exit(ret);
-				}
+					_exit(ret);
+				} else if (i == fio_debug_jobno)
+					*fio_debug_jobp = pid;
 			}
 			fio_mutex_down(startup_mutex);
 		}