job *job_alloc(void) { job *pj; pj = (job *)calloc(1, sizeof(job)); if (pj == NULL) { log_err(errno, "job_alloc", (char *)"no memory"); return(NULL); } pj->ji_qs.qs_version = PBS_QS_VERSION; CLEAR_LINK(pj->ji_alljobs); CLEAR_LINK(pj->ji_jobque); CLEAR_HEAD(pj->ji_tasks); pj->ji_taskid = TM_NULL_TASK + 1; pj->ji_obit = TM_NULL_EVENT; pj->ji_nodekill = TM_ERROR_NODE; pj->ji_momhandle = -1; /* mark mom connection invalid */ /* set the working attributes to "unspecified" */ job_init_wattr(pj); return(pj); } /* END job_alloc() */
job *job_alloc(void) { job *pj; pj = (job *)calloc(1, sizeof(job)); if (pj == NULL) { log_err(errno, "job_alloc", "no memory"); return(NULL); } pj->ji_qs.qs_version = PBS_QS_VERSION; CLEAR_LINK(pj->ji_alljobs); CLEAR_LINK(pj->ji_jobque); CLEAR_HEAD(pj->ji_tasks); pj->ji_taskid = TM_NULL_TASK + 1; pj->ji_numnodes = 0; pj->ji_numvnod = 0; pj->ji_hosts = NULL; pj->ji_vnods = NULL; pj->ji_resources = NULL; pj->ji_obit = TM_NULL_EVENT; pj->ji_preq = NULL; pj->ji_nodekill = TM_ERROR_NODE; pj->ji_flags = 0; pj->ji_globid = NULL; pj->ji_stdout = 0; pj->ji_stderr = 0; pj->ji_qs.ji_un.ji_momt.ji_exitstat = 0; pj->ji_job_is_being_rerun = 0; pj->ji_momhandle = -1; /* mark mom connection invalid */ /* set the working attributes to "unspecified" */ job_init_wattr(pj); return(pj); } /* END job_alloc() */
job::job() : ji_momstat(0), ji_modified(0), ji_momhandle(-1), ji_radix(0), ji_has_delete_nanny(false), ji_qhdr(NULL), ji_lastdest(0), ji_retryok(0), ji_rejectdest(), ji_is_array_template(false), ji_have_nodes_request(false), ji_external_clone(NULL), ji_cray_clone(NULL), ji_parent_job(NULL), ji_internal_id(-1), ji_being_recycled(false), ji_last_reported_time(0), ji_mod_time(0), ji_queue_counted(0), ji_being_deleted(false), ji_commit_done(false) { memset(this->ji_arraystructid, 0, sizeof(ji_arraystructid)); memset(&this->ji_qs, 0, sizeof(this->ji_qs)); this->ji_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(this->ji_mutex,NULL); lock_ji_mutex(this, __func__, NULL, LOGLEVEL); this->ji_qs.qs_version = PBS_QS_VERSION; /* set the working attributes to "unspecified" */ job_init_wattr(); } // END constructor()