if (do_read) {
btimer_t *tid;
if (ff_pkt->type == FT_FIFO) {
- tid = start_thread_timer(pthread_self(), 60);
+ tid = start_thread_timer(jcr, pthread_self(), 60);
} else {
tid = NULL;
}
/* Timeout open() in 60 seconds */
if (attr->type == FT_FIFO) {
Dmsg0(400, "Set FIFO timer\n");
- tid = start_thread_timer(pthread_self(), 60);
+ tid = start_thread_timer(jcr, pthread_self(), 60);
} else {
tid = NULL;
}
bpipe->worker_stime = time(NULL);
bpipe->wait = wait;
if (wait > 0) {
- bpipe->timer_id = start_child_timer(bpipe->worker_pid, wait);
+ bpipe->timer_id = start_child_timer(NULL, bpipe->worker_pid, wait);
}
return bpipe;
}
/* Try to trap out of OS call when time expires */
if (max_retry_time) {
- tid = start_thread_timer(pthread_self(), (uint32_t)max_retry_time);
+ tid = start_thread_timer(jcr, pthread_self(), (uint32_t)max_retry_time);
}
for (i = 0; !open(jcr, name, host, service, port, heart_beat, &fatal);
* Returns: btimer_t *(pointer to btimer_t struct) on success
* NULL on failure
*/
-btimer_t *start_child_timer(pid_t pid, uint32_t wait)
+btimer_t *start_child_timer(JCR *jcr, pid_t pid, uint32_t wait)
{
btimer_t *wid;
wid->type = TYPE_CHILD;
wid->pid = pid;
wid->killed = false;
+ wid->jcr = jcr;
wid->wd->callback = callback_child_timer;
wid->wd->one_shot = false;
*/
self->one_shot = true;
}
+ Jmsg(wid->jcr, M_INFO, 0, _("Child timer expired. Child process killed.\n"));
}
/*
* Returns: btimer_t *(pointer to btimer_t struct) on success
* NULL on failure
*/
-btimer_t *start_thread_timer(pthread_t tid, uint32_t wait)
+btimer_t *start_thread_timer(JCR *jcr, pthread_t tid, uint32_t wait)
{
btimer_t *wid;
wid = btimer_start_common(wait);
}
wid->type = TYPE_PTHREAD;
wid->tid = tid;
+ wid->jcr = jcr;
wid->wd->callback = callback_thread_timer;
wid->wd->one_shot = true;
wid->type = TYPE_BSOCK;
wid->tid = pthread_self();
wid->bsock = bsock;
+ wid->jcr = bsock->jcr();
wid->wd->callback = callback_thread_timer;
wid->wd->one_shot = true;
wid->bsock->set_timed_out();
}
pthread_kill(wid->tid, TIMEOUT_SIGNAL);
+ Jmsg(wid->jcr, M_INFO, 0, _("Thread timer expired. Thread interrupted.\n"));
}
static btimer_t *btimer_start_common(uint32_t wait)
pid_t pid; /* process id if TYPE_CHILD */
pthread_t tid; /* thread id if TYPE_PTHREAD */
BSOCK *bsock; /* Pointer to BSOCK */
+ JCR *jcr; /* Pointer to job control record */
};
#endif /* __BTIMERS_H_ */
if (level <= debug_level) {
#ifdef FULL_LOCATION
if (details) {
- len = bsnprintf(buf, sizeof(buf), "%s: %s:%d jid=%u",
+ len = bsnprintf(buf, sizeof(buf), "%s: %s:%d jid=%u ",
my_name, get_basename(file), line, get_jobid_from_tid());
} else {
len = 0;
-/*
- * Prototypes for lib directory of Bacula
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2007 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.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Prototypes for lib directory of Bacula
+ *
+ * Version $Id$
+ */
class JCR;
bool unregister_watchdog(watchdog_t *wd);
/* timers.c */
-btimer_t *start_child_timer(pid_t pid, uint32_t wait);
+btimer_t *start_child_timer(JCR *jcr, pid_t pid, uint32_t wait);
void stop_child_timer(btimer_t *wid);
-btimer_t *start_thread_timer(pthread_t tid, uint32_t wait);
+btimer_t *start_thread_timer(JCR *jcr, pthread_t tid, uint32_t wait);
void stop_thread_timer(btimer_t *wid);
btimer_t *start_bsock_timer(BSOCK *bs, uint32_t wait);
void stop_bsock_timer(btimer_t *wid);
errno = 0;
if (is_fifo() && timeout) {
/* Set open timer */
- tid = start_thread_timer(pthread_self(), timeout);
+ tid = start_thread_timer(dcr->jcr, pthread_self(), timeout);
}
Dmsg2(100, "Try open %s mode=%s\n", print_name(), mode_to_str(omode));
#if defined(HAVE_WIN32)
General:
26Sep07
+kes Add jcr to timer packets so if killed message can be sent to job.
kes Add JobId to all Dmsg() output.
kes Put some FD auth code on dbglvl rather than fixed.
kes Return insert attributes error message in db msg buffer to avoid