From 7ca92ba1a97619faebe0861ae775c46899093c00 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 22 Nov 2008 18:36:12 +0000 Subject: [PATCH] Remove all time_t from arguments in favor of utime_t, which is machine independent. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8076 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/baconfig.h | 4 ++-- bacula/src/dird/getmsg.c | 11 ++++++---- bacula/src/dird/msgchan.c | 2 +- bacula/src/dird/protos.h | 2 +- bacula/src/dird/ua_output.c | 6 ++--- bacula/src/dird/ua_status.c | 4 ++-- bacula/src/filed/accurate.c | 4 ++-- bacula/src/filed/fd_plugins.c | 4 ++-- bacula/src/filed/fd_plugins.h | 2 +- bacula/src/host.h.in | 15 ++++++------- bacula/src/jcr.h | 6 ++--- bacula/src/lib/bnet.c | 2 -- bacula/src/lib/bsnprintf.c | 30 ++++++++++++------------- bacula/src/lib/bsys.c | 4 ++-- bacula/src/lib/btime.c | 41 ++++++++++++++++++----------------- bacula/src/lib/jcr.c | 2 -- bacula/src/lib/message.c | 18 +++++++-------- bacula/src/lib/message.h | 9 ++++---- bacula/src/lib/protos.h | 8 +++---- bacula/src/lib/tls.c | 3 +-- bacula/src/lib/util.c | 3 ++- bacula/src/lib/watchdog.c | 6 ++--- bacula/src/lib/watchdog.h | 22 +++++++++---------- bacula/src/stored/label.c | 20 ++++++++--------- bacula/src/stored/record.h | 20 ++++++++--------- bacula/technotes-2.5 | 2 ++ 26 files changed, 125 insertions(+), 125 deletions(-) diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index ffd3562d04..ea97586501 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -542,8 +542,8 @@ class JCR; void d_msg(const char *file, int line, int level, const char *fmt,...); void p_msg(const char *file, int line, int level, const char *fmt,...); void e_msg(const char *file, int line, int type, int level, const char *fmt,...); -void j_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...); -void q_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...); +void j_msg(const char *file, int line, JCR *jcr, int type, utime_t mtime, const char *fmt,...); +void q_msg(const char *file, int line, JCR *jcr, int type, utime_t mtime, const char *fmt,...); int m_msg(const char *file, int line, POOLMEM **msgbuf, const char *fmt,...); int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...); diff --git a/bacula/src/dird/getmsg.c b/bacula/src/dird/getmsg.c index 4cfd87d765..c0237489b4 100644 --- a/bacula/src/dird/getmsg.c +++ b/bacula/src/dird/getmsg.c @@ -128,7 +128,8 @@ int bget_dirmsg(BSOCK *bs) int32_t n; char Job[MAX_NAME_LENGTH]; char MsgType[20]; - int type, level; + int type; + utime_t mtime; /* message time */ JCR *jcr = bs->jcr(); char *msg; @@ -200,10 +201,12 @@ int bget_dirmsg(BSOCK *bs) /* * Here we are expecting a message of the following format: * Jmsg Job=nnn type=nnn level=nnn Message-string + * Note, level should really be mtime, but that changes + * the protocol. */ if (bs->msg[0] == 'J') { /* Job message */ - if (sscanf(bs->msg, "Jmsg Job=%127s type=%d level=%d", - Job, &type, &level) != 3) { + if (sscanf(bs->msg, "Jmsg Job=%127s type=%d level=%lld", + Job, &type, &mtime) != 3) { Jmsg1(jcr, M_ERROR, 0, _("Malformed message: %s\n"), bs->msg); continue; } @@ -216,7 +219,7 @@ int bget_dirmsg(BSOCK *bs) msg++; /* skip leading space */ } Dmsg1(900, "Dispatch msg: %s", msg); - dispatch_message(jcr, type, level, msg); + dispatch_message(jcr, type, mtime, msg); continue; } /* diff --git a/bacula/src/dird/msgchan.c b/bacula/src/dird/msgchan.c index 56ab82efa5..5c2f1aa11c 100644 --- a/bacula/src/dird/msgchan.c +++ b/bacula/src/dird/msgchan.c @@ -189,7 +189,7 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore) jcr->job->SpoolAttributes, jcr->fileset->MD5, jcr->spool_data, jcr->write_part_after_job, jcr->job->PreferMountedVolumes, edit_int64(jcr->spool_size, ed2)); - Dmsg1(100, ">stored: %s\n", sd->msg); + Dmsg1(100, ">stored: %s", sd->msg); if (bget_dirmsg(sd) > 0) { Dmsg1(100, "msg); if (sscanf(sd->msg, OKjob, &jcr->VolSessionId, diff --git a/bacula/src/dird/protos.h b/bacula/src/dird/protos.h index 3509ed4a92..9cbdcb1135 100644 --- a/bacula/src/dird/protos.h +++ b/bacula/src/dird/protos.h @@ -219,7 +219,7 @@ void update_vol_pool(UAContext *ua, char *val, MEDIA_DBR *mr, POOL_DBR *opr); /* ua_output.c */ void prtit(void *ctx, const char *msg); bool complete_jcr_for_job(JCR *jcr, JOB *job, POOL *pool); -RUN *find_next_run(RUN *run, JOB *job, time_t &runtime, int ndays); +RUN *find_next_run(RUN *run, JOB *job, utime_t &runtime, int ndays); /* ua_restore.c */ int get_next_jobid_from_list(char **p, JobId_t *JobId); diff --git a/bacula/src/dird/ua_output.c b/bacula/src/dird/ua_output.c index aaf9140acc..9679a7d82f 100644 --- a/bacula/src/dird/ua_output.c +++ b/bacula/src/dird/ua_output.c @@ -445,7 +445,7 @@ static bool list_nextvol(UAContext *ua, int ndays) JCR *jcr; USTORE store; RUN *run; - time_t runtime; + utime_t runtime; bool found = false; MEDIA_DBR mr; POOL_DBR pr; @@ -512,7 +512,7 @@ get_out: * For a given job, we examine all his run records * to see if it is scheduled today or tomorrow. */ -RUN *find_next_run(RUN *run, JOB *job, time_t &runtime, int ndays) +RUN *find_next_run(RUN *run, JOB *job, utime_t &runtime, int ndays) { time_t now, future, endtime; SCHED *sched; @@ -586,7 +586,7 @@ RUN *find_next_run(RUN *run, JOB *job, time_t &runtime, int ndays) runtm.tm_min = run->minute; runtm.tm_sec = 0; runtime = mktime(&runtm); - Dmsg2(200, "now=%d runtime=%d\n", now, runtime); + Dmsg2(200, "now=%d runtime=%lld\n", now, runtime); if ((runtime > now) && (runtime < endtime)) { Dmsg2(200, "Found it level=%d %c\n", run->level, run->level); return run; /* found it, return run resource */ diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index 4291b51f74..b430007d22 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -441,7 +441,7 @@ struct sched_pkt { JOB *job; int level; int priority; - time_t runtime; + utime_t runtime; POOL *pool; STORE *store; }; @@ -528,7 +528,7 @@ static int my_compare(void *item1, void *item2) */ static void list_scheduled_jobs(UAContext *ua) { - time_t runtime; + utime_t runtime; RUN *run; JOB *job; int level, num_jobs = 0; diff --git a/bacula/src/filed/accurate.c b/bacula/src/filed/accurate.c index 0db9fc20ae..e7fd644720 100644 --- a/bacula/src/filed/accurate.c +++ b/bacula/src/filed/accurate.c @@ -38,8 +38,8 @@ static int dbglvl=200; typedef struct PrivateCurFile { hlink link; char *fname; - time_t ctime; - time_t mtime; + utime_t ctime; + utime_t mtime; bool seen; } CurFile; diff --git a/bacula/src/filed/fd_plugins.c b/bacula/src/filed/fd_plugins.c index c21e275c1a..5f4084fee1 100644 --- a/bacula/src/filed/fd_plugins.c +++ b/bacula/src/filed/fd_plugins.c @@ -56,7 +56,7 @@ static bRC baculaGetValue(bpContext *ctx, bVariable var, void *value); static bRC baculaSetValue(bpContext *ctx, bVariable var, void *value); static bRC baculaRegisterEvents(bpContext *ctx, ...); static bRC baculaJobMsg(bpContext *ctx, const char *file, int line, - int type, time_t mtime, const char *fmt, ...); + int type, utime_t mtime, const char *fmt, ...); static bRC baculaDebugMsg(bpContext *ctx, const char *file, int line, int level, const char *fmt, ...); static void *baculaMalloc(bpContext *ctx, const char *file, int line, @@ -789,7 +789,7 @@ static bRC baculaRegisterEvents(bpContext *ctx, ...) } static bRC baculaJobMsg(bpContext *ctx, const char *file, int line, - int type, time_t mtime, const char *fmt, ...) + int type, utime_t mtime, const char *fmt, ...) { va_list arg_ptr; char buf[2000]; diff --git a/bacula/src/filed/fd_plugins.h b/bacula/src/filed/fd_plugins.h index 899f6503cb..9072c94df6 100644 --- a/bacula/src/filed/fd_plugins.h +++ b/bacula/src/filed/fd_plugins.h @@ -203,7 +203,7 @@ typedef struct s_baculaFuncs { bRC (*getBaculaValue)(bpContext *ctx, bVariable var, void *value); bRC (*setBaculaValue)(bpContext *ctx, bVariable var, void *value); bRC (*JobMessage)(bpContext *ctx, const char *file, int line, - int type, time_t mtime, const char *fmt, ...); + int type, utime_t mtime, const char *fmt, ...); bRC (*DebugMessage)(bpContext *ctx, const char *file, int line, int level, const char *fmt, ...); void *(*baculaMalloc)(bpContext *ctx, const char *file, int line, diff --git a/bacula/src/host.h.in b/bacula/src/host.h.in index d1432c2466..cc465f3881 100644 --- a/bacula/src/host.h.in +++ b/bacula/src/host.h.in @@ -1,13 +1,7 @@ -/* - * Define Host machine - * - * Version $Id$ - * - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2006 Free Software Foundation Europe e.V. + Copyright (C) 2000-2008 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. @@ -31,9 +25,14 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * Define Host machine + * + * Version $Id$ + * + */ #define HOST_OS "@host@@post_host@" #define BACULA "@BACULA@" #define DISTNAME "@DISTNAME@" #define DISTVER "@DISTVER@" - diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 57ba318250..8eb784ca36 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -334,7 +334,7 @@ public: POOLMEM *acl_text; /* text of ACL for backup */ int32_t last_type; /* type of last file saved/verified */ int incremental; /* set if incremental for SINCE */ - time_t mtime; /* begin time for SINCE */ + utime_t mtime; /* begin time for SINCE */ int listing; /* job listing in estimate */ long Ticket; /* Ticket */ char *big_buf; /* I/O buffer */ @@ -441,8 +441,8 @@ struct s_last_job { uint32_t VolSessionTime; uint32_t JobFiles; uint64_t JobBytes; - time_t start_time; - time_t end_time; + utime_t start_time; + utime_t end_time; char Job[MAX_NAME_LENGTH]; }; diff --git a/bacula/src/lib/bnet.c b/bacula/src/lib/bnet.c index 0440ba7432..9cc236998c 100644 --- a/bacula/src/lib/bnet.c +++ b/bacula/src/lib/bnet.c @@ -41,8 +41,6 @@ #include "jcr.h" #include -extern time_t watchdog_time; - #ifndef INADDR_NONE #define INADDR_NONE -1 #endif diff --git a/bacula/src/lib/bsnprintf.c b/bacula/src/lib/bsnprintf.c index 41aa2901f5..df1867a14c 100644 --- a/bacula/src/lib/bsnprintf.c +++ b/bacula/src/lib/bsnprintf.c @@ -1,18 +1,3 @@ -/* - * Copyright Patrick Powell 1995 - * - * This code is based on code written by Patrick Powell - * (papowell@astart.com) It may be used for any purpose as long - * as this notice remains intact on all source code distributions. - * - * Adapted for Bacula -- note there were lots of bugs in - * the original code: %lld and %s were seriously broken, and - * with FP turned off %f seg faulted. - * - * Kern Sibbald, November MMV - * - * Version $Id$ - */ /* Bacula® - The Network Backup Solution @@ -40,6 +25,21 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * Copyright Patrick Powell 1995 + * + * This code is based on code written by Patrick Powell + * (papowell@astart.com) It may be used for any purpose as long + * as this notice remains intact on all source code distributions. + * + * Adapted for Bacula -- note there were lots of bugs in + * the original code: %lld and %s were seriously broken, and + * with FP turned off %f seg faulted. + * + * Kern Sibbald, November MMV + * + * Version $Id$ + */ diff --git a/bacula/src/lib/bsys.c b/bacula/src/lib/bsys.c index bf722f8645..91e7873667 100644 --- a/bacula/src/lib/bsys.c +++ b/bacula/src/lib/bsys.c @@ -57,7 +57,7 @@ static pthread_cond_t timer = PTHREAD_COND_INITIALIZER; * to recall this routine if he/she REALLY wants to sleep the * requested time. */ -int bmicrosleep(time_t sec, long usec) +int bmicrosleep(int32_t sec, int32_t usec) { struct timespec timeout; struct timeval tv; @@ -84,7 +84,7 @@ int bmicrosleep(time_t sec, long usec) timeout.tv_sec++; } - Dmsg2(200, "pthread_cond_timedwait sec=%d usec=%d\n", sec, usec); + Dmsg2(200, "pthread_cond_timedwait sec=%lld usec=%d\n", sec, usec); /* Note, this unlocks mutex during the sleep */ P(timer_mutex); stat = pthread_cond_timedwait(&timer, &timer_mutex, &timeout); diff --git a/bacula/src/lib/btime.c b/bacula/src/lib/btime.c index 2485d60d49..2901b27b11 100644 --- a/bacula/src/lib/btime.c +++ b/bacula/src/lib/btime.c @@ -52,52 +52,52 @@ #include /* Formatted time for user display: dd-Mon-yyyy hh:mm */ -char *bstrftime(char *dt, int maxlen, utime_t tim) +char *bstrftime(char *dt, int maxlen, utime_t utime) { - time_t ttime = (time_t)tim; + time_t time = (time_t)utime; struct tm tm; /* ***FIXME**** the format and localtime_r() should be user configurable */ - (void)localtime_r(&ttime, &tm); + (void)localtime_r(&time, &tm); strftime(dt, maxlen, "%d-%b-%Y %H:%M", &tm); return dt; } /* Formatted time for user display: dd-Mon-yyyy hh:mm:ss */ -char *bstrftimes(char *dt, int maxlen, utime_t tim) +char *bstrftimes(char *dt, int maxlen, utime_t utime) { - time_t ttime = (time_t)tim; + time_t time = (time_t)utime; struct tm tm; /* ***FIXME**** the format and localtime_r() should be user configurable */ - (void)localtime_r(&ttime, &tm); + (void)localtime_r(&time, &tm); strftime(dt, maxlen, "%d-%b-%Y %H:%M:%S", &tm); return dt; } /* Formatted time for user display: dd-Mon hh:mm */ -char *bstrftime_ny(char *dt, int maxlen, utime_t tim) +char *bstrftime_ny(char *dt, int maxlen, utime_t utime) { - time_t ttime = (time_t)tim; + time_t time = (time_t)utime; struct tm tm; /* ***FIXME**** the format and localtime_r() should be user configurable */ - (void)localtime_r(&ttime, &tm); + (void)localtime_r(&time, &tm); strftime(dt, maxlen, "%d-%b %H:%M", &tm); return dt; } /* Formatted time for user display: dd-Mon-yy hh:mm (no century) */ -char *bstrftime_nc(char *dt, int maxlen, utime_t tim) +char *bstrftime_nc(char *dt, int maxlen, utime_t utime) { - time_t ttime = (time_t)tim; + time_t time = (time_t)utime; struct tm tm; char *p, *q; /* ***FIXME**** the format and localtime_r() should be user configurable */ - (void)localtime_r(&ttime, &tm); + (void)localtime_r(&time, &tm); /* NOTE! since the compiler complains about %y, I use %y and cut the century */ strftime(dt, maxlen, "%d-%b-%Y %H:%M", &tm); /* overlay the century */ @@ -112,11 +112,11 @@ char *bstrftime_nc(char *dt, int maxlen, utime_t tim) /* Unix time to standard time string yyyy-mm-dd hh:mm:ss */ -char *bstrutime(char *dt, int maxlen, utime_t tim) +char *bstrutime(char *dt, int maxlen, utime_t utime) { - time_t ttime = (time_t)tim; + time_t time = (time_t)utime; struct tm tm; - (void)localtime_r(&ttime, &tm); + (void)localtime_r(&time, &tm); strftime(dt, maxlen, "%Y-%m-%d %H:%M:%S", &tm); return dt; } @@ -125,7 +125,7 @@ char *bstrutime(char *dt, int maxlen, utime_t tim) utime_t str_to_utime(char *str) { struct tm tm; - time_t ttime; + time_t time; /* Check for bad argument */ if (!str || *str == 0) { @@ -148,11 +148,11 @@ utime_t str_to_utime(char *str) } tm.tm_wday = tm.tm_yday = 0; tm.tm_isdst = -1; - ttime = mktime(&tm); - if (ttime == -1) { - ttime = 0; + time = mktime(&tm); + if (time == -1) { + time = 0; } - return (utime_t)ttime; + return (utime_t)time; } @@ -218,6 +218,7 @@ int tm_woy(time_t stime) int woy, fty, tm_yday; time_t time4; struct tm tm; + memset(&tm, 0, sizeof(struct tm)); (void)localtime_r(&stime, &tm); tm_yday = tm.tm_yday; diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index 65e48d816a..961376bf72 100644 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -56,7 +56,6 @@ const int dbglvl = 3400; /* External variables we reference */ -extern time_t watchdog_time; /* External referenced functions */ void free_bregexps(alist *bregexps); @@ -1068,4 +1067,3 @@ void _dbg_print_jcr(FILE *fp) } } } - diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index e150e2c44f..1371bbc05f 100644 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -51,7 +51,7 @@ const char *working_directory = NULL; /* working directory path stored her int verbose = 0; /* increase User messages */ int debug_level = 0; /* debug level */ bool dbg_timestamp = false; /* print timestamp in debug output */ -time_t daemon_start_time = 0; /* Daemon start time */ +utime_t daemon_start_time = 0; /* Daemon start time */ const char *version = VERSION " (" BDATE ")"; char my_name[30]; /* daemon name is stored here */ char host_name[50]; /* host machine name */ @@ -600,7 +600,7 @@ static bool open_dest_file(JCR *jcr, DEST *d, const char *mode) /* * Handle sending the message to the appropriate place */ -void dispatch_message(JCR *jcr, int type, time_t mtime, char *msg) +void dispatch_message(JCR *jcr, int type, utime_t mtime, char *msg) { DEST *d; char dt[MAX_TIME_LENGTH]; @@ -616,7 +616,7 @@ void dispatch_message(JCR *jcr, int type, time_t mtime, char *msg) * Most messages are prefixed by a date and time. If mtime is * zero, then we use the current time. If mtime is 1 (special * kludge), we do not prefix the date and time. Otherwise, - * we assume mtime is a time_t and use it. + * we assume mtime is a utime_t and use it. */ if (mtime == 0) { mtime = time(NULL); @@ -784,7 +784,7 @@ send_to_file: case MD_DIRECTOR: Dmsg1(850, "DIRECTOR for following msg: %s", msg); if (jcr && jcr->dir_bsock && !jcr->dir_bsock->errors) { - bnet_fsend(jcr->dir_bsock, "Jmsg Job=%s type=%d level=%d %s", + bnet_fsend(jcr->dir_bsock, "Jmsg Job=%s type=%d level=%lld %s", jcr->Job, type, mtime, msg); } break; @@ -851,7 +851,7 @@ d_msg(const char *file, int line, int level, const char *fmt,...) int len; va_list arg_ptr; bool details = true; - time_t mtime; + utime_t mtime; if (level < 0) { details = false; @@ -1083,7 +1083,7 @@ e_msg(const char *file, int line, int type, int level, const char *fmt,...) * */ void -Jmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...) +Jmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...) { char rbuf[5000]; va_list arg_ptr; @@ -1180,7 +1180,7 @@ Jmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...) * If we come here, prefix the message with the file:line-number, * then pass it on to the normal Jmsg routine. */ -void j_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...) +void j_msg(const char *file, int line, JCR *jcr, int type, utime_t mtime, const char *fmt,...) { va_list arg_ptr; int i, len, maxlen; @@ -1323,7 +1323,7 @@ static pthread_mutex_t msg_queue_mutex = PTHREAD_MUTEX_INITIALIZER; * sending a message, it is a bit messy to recursively call * yourself when the bnet packet is not reentrant). */ -void Qmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...) +void Qmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...) { va_list arg_ptr; int len, maxlen; @@ -1390,7 +1390,7 @@ bail_out: * If we come here, prefix the message with the file:line-number, * then pass it on to the normal Qmsg routine. */ -void q_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...) +void q_msg(const char *file, int line, JCR *jcr, int type, utime_t mtime, const char *fmt,...) { va_list arg_ptr; int i, len, maxlen; diff --git a/bacula/src/lib/message.h b/bacula/src/lib/message.h index 9d66f2eac8..923075ff2a 100644 --- a/bacula/src/lib/message.h +++ b/bacula/src/lib/message.h @@ -135,15 +135,15 @@ enum { struct MQUEUE_ITEM { dlink link; int type; - time_t mtime; + utime_t mtime; char msg[1]; }; void d_msg(const char *file, int line, int level, const char *fmt,...); void e_msg(const char *file, int line, int type, int level, const char *fmt,...); -void Jmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...); -void Qmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...); +void Jmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...); +void Qmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...); bool get_trace(void); struct B_DB; @@ -158,10 +158,9 @@ extern DLL_IMP_EXP bool dbg_timestamp; /* print timestamp in d extern DLL_IMP_EXP int verbose; extern DLL_IMP_EXP char my_name[]; extern DLL_IMP_EXP const char * working_directory; -extern DLL_IMP_EXP time_t daemon_start_time; +extern DLL_IMP_EXP utime_t daemon_start_time; extern DLL_IMP_EXP int console_msg_pending; extern DLL_IMP_EXP FILE * con_fd; /* Console file descriptor */ extern DLL_IMP_EXP brwlock_t con_lock; /* Console lock structure */ - diff --git a/bacula/src/lib/protos.h b/bacula/src/lib/protos.h index a9280769dc..34a336295b 100644 --- a/bacula/src/lib/protos.h +++ b/bacula/src/lib/protos.h @@ -70,7 +70,7 @@ int pool_sprintf (char *pool_buf, const char *fmt, ...); void create_pid_file (char *dir, const char *progname, int port); int delete_pid_file (char *dir, const char *progname, int port); void drop (char *uid, char *gid); -int bmicrosleep (time_t sec, long usec); +int bmicrosleep (int32_t sec, int32_t usec); char *bfgets (char *s, int size, FILE *fd); void make_unique_filename (POOLMEM **name, int Id, char *what); #ifndef HAVE_STRTOLL @@ -225,8 +225,8 @@ void term_msg (void); void close_msg (JCR *jcr); void add_msg_dest (MSGS *msg, int dest, int type, char *where, char *dest_code); void rem_msg_dest (MSGS *msg, int dest, int type, char *where); -void Jmsg (JCR *jcr, int type, time_t mtime, const char *fmt, ...); -void dispatch_message (JCR *jcr, int type, time_t mtime, char *buf); +void Jmsg (JCR *jcr, int type, utime_t mtime, const char *fmt, ...); +void dispatch_message (JCR *jcr, int type, utime_t mtime, char *buf); void init_console_msg (const char *wd); void free_msgs_res (MSGS *msgs); void dequeue_messages (JCR *jcr); @@ -310,7 +310,7 @@ void bash_spaces (char *str); void bash_spaces (POOL_MEM &pm); void unbash_spaces (char *str); void unbash_spaces (POOL_MEM &pm); -char * encode_time (time_t time, char *buf); +char * encode_time (utime_t time, char *buf); char * encode_mode (mode_t mode, char *buf); int do_shell_expansion (char *name, int name_len); void jobstatus_to_ascii (int JobStatus, char *msg, int maxlen); diff --git a/bacula/src/lib/tls.c b/bacula/src/lib/tls.c index 54a424d3b7..f5f0623a3c 100644 --- a/bacula/src/lib/tls.c +++ b/bacula/src/lib/tls.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2005-2007 Free Software Foundation Europe e.V. + Copyright (C) 2005-2008 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. @@ -51,7 +51,6 @@ #include "bacula.h" #include -extern time_t watchdog_time; #ifdef HAVE_TLS /* Is TLS enabled? */ diff --git a/bacula/src/lib/util.c b/bacula/src/lib/util.c index 16683c50e7..1d93d1b542 100644 --- a/bacula/src/lib/util.c +++ b/bacula/src/lib/util.c @@ -134,10 +134,11 @@ unbash_spaces(POOL_MEM &pm) } } -char *encode_time(time_t time, char *buf) +char *encode_time(utime_t utime, char *buf) { struct tm tm; int n = 0; + time_t time = utime; #if defined(HAVE_WIN32) /* diff --git a/bacula/src/lib/watchdog.c b/bacula/src/lib/watchdog.c index 2e39e7349b..c51b88a6c9 100644 --- a/bacula/src/lib/watchdog.c +++ b/bacula/src/lib/watchdog.c @@ -38,8 +38,8 @@ #include "jcr.h" /* Exported globals */ -time_t watchdog_time = 0; /* this has granularity of SLEEP_TIME */ -time_t watchdog_sleep_time = 60; /* examine things every 60 seconds */ +utime_t watchdog_time = 0; /* this has granularity of SLEEP_TIME */ +utime_t watchdog_sleep_time = 60; /* examine things every 60 seconds */ /* Locals */ static pthread_mutex_t timer_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -244,7 +244,7 @@ extern "C" void *watchdog_thread(void *arg) struct timespec timeout; struct timeval tv; struct timezone tz; - time_t next_time; + utime_t next_time; Dmsg0(800, "NicB-reworked watchdog thread entered\n"); diff --git a/bacula/src/lib/watchdog.h b/bacula/src/lib/watchdog.h index b9dc783ea4..942c523099 100644 --- a/bacula/src/lib/watchdog.h +++ b/bacula/src/lib/watchdog.h @@ -1,13 +1,7 @@ -/* - * Watchdog timer routines - * - * Kern Sibbald, December MMII - * -*/ /* Bacula® - The Network Backup Solution - Copyright (C) 2002-2007 Free Software Foundation Europe e.V. + Copyright (C) 2002-2008 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. @@ -31,6 +25,12 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * Watchdog timer routines + * + * Kern Sibbald, December MMII + * +*/ enum { TYPE_CHILD = 1, @@ -42,16 +42,16 @@ enum { struct s_watchdog_t { bool one_shot; - time_t interval; + utime_t interval; void (*callback)(struct s_watchdog_t *wd); void (*destructor)(struct s_watchdog_t *wd); void *data; /* Private data below - don't touch outside of watchdog.c */ dlink link; - time_t next_fire; + utime_t next_fire; }; typedef struct s_watchdog_t watchdog_t; /* Exported globals */ -extern time_t DLL_IMP_EXP watchdog_time; /* this has granularity of SLEEP_TIME */ -extern time_t DLL_IMP_EXP watchdog_sleep_time; /* examine things every 60 seconds */ +extern utime_t DLL_IMP_EXP watchdog_time; /* this has granularity of SLEEP_TIME */ +extern utime_t DLL_IMP_EXP watchdog_sleep_time; /* examine things every 60 seconds */ diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index 8df3339a46..881bf95096 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -923,15 +923,15 @@ void dump_volume_label(DEVICE *dev) if (dev->VolHdr.VerNum >= 11) { char dt[50]; - bstrftime(dt, sizeof(dt), btime_to_unix(dev->VolHdr.label_btime)); + bstrftime(dt, sizeof(dt), btime_to_utime(dev->VolHdr.label_btime)); Pmsg1(-1, _("Date label written: %s\n"), dt); } else { - dt.julian_day_number = dev->VolHdr.label_date; - dt.julian_day_fraction = dev->VolHdr.label_time; - tm_decode(&dt, &tm); - Pmsg5(-1, -_("Date label written: %04d-%02d-%02d at %02d:%02d\n"), - tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min); + dt.julian_day_number = dev->VolHdr.label_date; + dt.julian_day_fraction = dev->VolHdr.label_time; + tm_decode(&dt, &tm); + Pmsg5(-1, + _("Date label written: %04d-%02d-%02d at %02d:%02d\n"), + tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min); } bail_out: @@ -992,7 +992,7 @@ static void dump_session_label(DEV_RECORD *rec, const char *type) } if (label.VerNum >= 11) { char dt[50]; - bstrftime(dt, sizeof(dt), btime_to_unix(label.write_btime)); + bstrftime(dt, sizeof(dt), btime_to_utime(label.write_btime)); Pmsg1(-1, _("Date written : %s\n"), dt); } else { dt.julian_day_number = label.write_date; @@ -1071,7 +1071,7 @@ void dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose) switch (rec->FileIndex) { case SOS_LABEL: unser_session_label(&label, rec); - bstrftimes(dt, sizeof(dt), btime_to_unix(label.write_btime)); + bstrftimes(dt, sizeof(dt), btime_to_utime(label.write_btime)); Pmsg6(-1, _("%s Record: File:blk=%u:%u SessId=%d SessTime=%d JobId=%d\n"), type, dev->file, dev->block_num, rec->VolSessionId, rec->VolSessionTime, label.JobId); Pmsg4(-1, _(" Job=%s Date=%s Level=%c Type=%c\n"), @@ -1080,7 +1080,7 @@ void dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose) case EOS_LABEL: char ed1[30], ed2[30]; unser_session_label(&label, rec); - bstrftimes(dt, sizeof(dt), btime_to_unix(label.write_btime)); + bstrftimes(dt, sizeof(dt), btime_to_utime(label.write_btime)); Pmsg6(-1, _("%s Record: File:blk=%u:%u SessId=%d SessTime=%d JobId=%d\n"), type, dev->file, dev->block_num, rec->VolSessionId, rec->VolSessionTime, label.JobId); Pmsg7(-1, _(" Date=%s Level=%c Type=%c Files=%s Bytes=%s Errors=%d Status=%c\n"), diff --git a/bacula/src/stored/record.h b/bacula/src/stored/record.h index de480971c1..87f53aede6 100644 --- a/bacula/src/stored/record.h +++ b/bacula/src/stored/record.h @@ -1,16 +1,7 @@ -/* - * Record, and label definitions for Bacula - * media data format. - * - * Kern Sibbald, MM - * - * Version $Id$ - * - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2006 Free Software Foundation Europe e.V. + Copyright (C) 2000-2008 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. @@ -34,6 +25,15 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * Record, and label definitions for Bacula + * media data format. + * + * Kern Sibbald, MM + * + * Version $Id$ + * + */ #ifndef __RECORD_H diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index e91c1ff9a6..41f21be48a 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -11,6 +11,8 @@ mixed priorities General: 22Nov08 +kes Remove all time_t from arguments in favor of utime_t, which is + machine independent. kes Add more debug to match_bsr.c and use %u for unsigned debug editing. 20Nov08 ebl Apply patch for bug #1182 about Recycle flag -- 2.39.5