/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
}
}
-/* Set Job type in JCR and also set appropriate read flag */
-void JCR::set_JobType(int32_t JobType)
-{
- m_JobType = JobType;
-}
-
-/* Set Job level in JCR and also set appropriate read flag */
-void JCR::set_JobLevel(int32_t JobLevel)
-{
- m_JobLevel = JobLevel;
-}
-
bool JCR::JobReads()
{
switch (m_JobType) {
/* Setup some dummy values */
bstrncpy(jcr->Job, "*System*", sizeof(jcr->Job));
jcr->JobId = 0;
- jcr->set_JobType(JT_SYSTEM); /* internal job until defined */
- jcr->set_JobLevel(L_NONE);
- set_jcr_job_status(jcr, JS_Created); /* ready to run */
+ jcr->setJobType(JT_SYSTEM); /* internal job until defined */
+ jcr->setJobLevel(L_NONE);
+ jcr->setJobStatus(JS_Created); /* ready to run */
set_jcr_in_tsd(jcr);
sigtimer.sa_flags = 0;
sigtimer.sa_handler = timeout_handler;
return jcr;
}
+/*
+ * Given a thread id, find the JobId
+ * Returns: JobId on success
+ * 0 on failure
+ */
+uint32_t get_jobid_from_tid(pthread_t tid)
+{
+ JCR *jcr = NULL;
+ bool found = false;
+
+ foreach_jcr(jcr) {
+ if (pthread_equal(jcr->my_thread_id, tid)) {
+ found = true;
+ break;
+ }
+ }
+ endeach_jcr(jcr);
+ if (found) {
+ return jcr->JobId;
+ }
+ return 0;
+}
+
+
/*
* Given a SessionId and SessionTime, find the JCR
* Returns: jcr on success
case JS_ErrorTerminated:
case JS_FatalError:
case JS_Canceled:
+ case JS_Incomplete:
priority = 10;
break;
case JS_Error: