+ td_set_runstate(td, TD_INITIALIZED);
+ dprint(FD_MUTEX, "up startup_mutex\n");
+ fio_mutex_up(startup_mutex);
+ dprint(FD_MUTEX, "wait on td->mutex\n");
+ fio_mutex_down(td->mutex);
+ dprint(FD_MUTEX, "done waiting on td->mutex\n");
+
+ /*
+ * the ->mutex mutex is now no longer used, close it to avoid
+ * eating a file descriptor
+ */
+ fio_mutex_remove(td->mutex);
+
+ /*
+ * A new gid requires privilege, so we need to do this before setting
+ * the uid.
+ */
+ if (td->o.gid != -1U && setgid(td->o.gid)) {
+ td_verror(td, errno, "setgid");
+ goto err;
+ }
+ if (td->o.uid != -1U && setuid(td->o.uid)) {
+ td_verror(td, errno, "setuid");
+ goto err;
+ }
+
+ /*
+ * If we have a gettimeofday() thread, make sure we exclude that
+ * thread from this job
+ */
+ if (td->o.gtod_cpu)
+ fio_cpu_clear(&td->o.cpumask, td->o.gtod_cpu);
+
+ /*
+ * Set affinity first, in case it has an impact on the memory
+ * allocations.
+ */
+ if (td->o.cpumask_set && fio_setaffinity(td->pid, td->o.cpumask) == -1) {