/* * Return a free job structure. */ static struct thread_data *get_new_job(int global, struct thread_data *parent, int preserve_eo) { struct thread_data *td; if (global) return &def_thread; if (setup_thread_area()) { log_err("error: failed to setup shm segment\n"); return NULL; } if (thread_number >= max_jobs) { log_err("error: maximum number of jobs (%d) reached.\n", max_jobs); return NULL; } td = &threads[thread_number++]; *td = *parent; td->io_ops = NULL; if (!preserve_eo) td->eo = NULL; td->o.uid = td->o.gid = -1U; dup_files(td, parent); fio_options_mem_dupe(td); profile_add_hooks(td); td->thread_number = thread_number; return td; }
/* * Return a free job structure. */ static struct thread_data *get_new_job(int global, struct thread_data *parent, int preserve_eo, const char *jobname) { struct thread_data *td; if (global) { set_cmd_options(&def_thread); return &def_thread; } if (setup_thread_area()) { log_err("error: failed to setup shm segment\n"); return NULL; } if (thread_number >= max_jobs) { log_err("error: maximum number of jobs (%d) reached.\n", max_jobs); return NULL; } td = &threads[thread_number++]; *td = *parent; td->io_ops = NULL; if (!preserve_eo) td->eo = NULL; td->o.uid = td->o.gid = -1U; dup_files(td, parent); fio_options_mem_dupe(td); profile_add_hooks(td); td->thread_number = thread_number; td->subjob_number = 0; if (jobname) td->o.name = strdup(jobname); if (!parent->o.group_reporting) stat_number++; set_cmd_options(td); return td; }