]> git.sur5r.net Git - bacula/bacula/commitdiff
misc minor updates
authorKern Sibbald <kern@sibbald.com>
Tue, 2 Mar 2004 09:31:03 +0000 (09:31 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 2 Mar 2004 09:31:03 +0000 (09:31 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1104 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/README
bacula/kernstodo
bacula/src/console/Makefile.in
bacula/src/dird/fd_cmds.c
bacula/src/dird/job.c
bacula/src/dird/ua_server.c
bacula/src/dird/ua_status.c
bacula/src/filed/status.c
bacula/src/lib/jcr.c
bacula/src/stored/status.c
bacula/src/version.h

index 513b130c99659e89fd3170292499e02217325f02..a360ddd2d7e5f837b4c21de90ea6d4410919346d 100644 (file)
@@ -93,9 +93,11 @@ parameters needed to deal with FreeBSD tape drivers.
 
 License:
 For the most part, Bacula is licensed under GPL version 2 or greater.        
-Regardless of what is specified in the GPL license, Bacula may be linked
+Bacula may be linked with any libraries permitted under the GPL, or 
 with any non-GPLed libraries, including OpenSSL, that are required for 
-its proper functioning.
+its proper functioning, providing the source code of those non-GPLed
+libraries is freely available.
+    
 
 In addition to GPL, there are also parts of Bacula that are licensed
 under LGPL so that they may be used in proprietary code to interface
index 481fcd8ae60a0fb76907dc1ad3d4aa4869fd3646..f89cb4c4a0021a3e6be916f15db3892fd136a127 100644 (file)
@@ -49,7 +49,6 @@ For 1.33 Testing/Documentation:
 - Add an example of using a FIFO in dirdconf.wml 
 - Add an item to the FAQ about running jobs in different timezones.
 - Add some examples of job editing codes.
-
 - Document Dan's new --with-dir-user, ... options.
   See userid.txt
 - Figure out how to use ssh or stunnel to protect Bacula communications.
@@ -71,24 +70,44 @@ For 1.33 Testing/Documentation:
      http://howtos.linux.com/guides/nag2/x-087-2-nfs.mountd.shtml
 
 For 1.33
+- Check: Run = Level=Differential feb-dec 1 at 1:05 to see if wday is empty.
 - Look at installation file permissions with Scott so that make install
   and the rpms agree.
+- Restore attributes of directory if replace=never set but directory
+  did not exist.
+- Allow "delete job jobid=xx jobid=xxx".   
+- Allow "delete job jobid=xxx,yyy,aaa-bbb" i.e. list + ranges.
+- Implement multiple Volume in "purge jobs volume=".
+- Rescue builds incorrect script files on Rufus.  
+- Fix option 2 of restore -- list where file is backed up -- require Client,
+  then list last 20 backups.
+- Allow browsing the catalog to see all versions of a file (with 
+  stat data on each file).
+- Finish code passing files=nnn to restore start.
+- Add level to estimate command.
+- Symbolic link a directory to another one, then backup the symbolic link.
+- Check and possibly fix problems with hard links.
+- Fix "llist jobid=xx" where no fileset or client exists.
+- Release SQLite 2.8.9
+- Add all pools in Dir conf to DB also update them to catch changed
+  LabelFormats and such.
+- Build console in client-only build.
+- Write a Qmsg() to be used in bnet.c to prevent recursion.  Queue the
+  message. If dequeueing toss the messages. Lock while dequeuing so that
+  it cannot be called recursively and set dequeuing flag.
+- Add a .list all files in the restore tree (probably also a list all files)
+  Do both a long and short form.
+
+- Later:
 - Add a regression test for dbcheck.
 - Add disk seeking on restore.
-- Add atime preservation.
 - Allow for optional cancelling of SD and FD in case DIR
   gets a fatal error. Requested by Jesse Guardiani <jesse@wingnet.net>
-- Do not err job if could not write bootstrap file.
 - Bizarre message: Error: Could not open WriteBootstrap file:
 - Build console in client only build.
-- For "list jobs" order by EndTime.
 - Add "limit=n" for "list jobs"
 - Check new HAVE_WIN32 open bits.    
-- Make column listing for running jobs.    
-  JobId Level Type Started Name  Status
-- Make two tape fill test work.
 - Check if the tape has moved before writing.  
-- Save and restore last_job across executions.
 - Implement restart of daemon.
 - Handling removable disks -- see below:
 - Multiple drive autochanger support -- see below.
@@ -97,17 +116,10 @@ For 1.33
 - See comtest-xxx.zip for Windows code to talk to USB.
 - Fix FreeBSD mt_count problem.
 - During install, copy any console.conf to bconsole.conf.
-- Have each daemon save the last_jobs structure when exiting and
-  read it back in when starting up.
-- "restore jobid=1 select" calls get_storage_xxx, which prints "JobId 1 is
-  not running."
 - Add FromClient and ToClient keywords on restore command (or
   BackupClient RestoreClient).
 - Automatic "update slots" on user configuration directive when a
   slot error occurs.
-- Allow "delete job jobid=xx jobid=xxx".   
-- Allow "delete job jobid=xxx,yyy,aaa-bbb" i.e. list + ranges.
-- Implement multiple Volume in "purge jobs volume=".
 - Implement a JobSet, which groups any number of jobs. If the
   JobSet is started, all the jobs are started together.
   Allow Pool, Level, and Schedule overrides.
@@ -116,31 +128,12 @@ For 1.33
   those of the time of the restore, not those of the originalfile.  
   The dates you will find in your restore log seem to be the original
    creation dates
-- Rescue builds incorrect script files on Rufus.  
-- Write a Qmsg() to be used in bnet.c to prevent recursion.  Queue the
-  message. If dequeueing toss the messages. Lock while dequeuing so that
-  it cannot be called recursively and set dequeuing flag.
-- Add all pools in Dir conf to DB also update them to catch changed
-  LabelFormats and such.
-- Symbolic link a directory to another one, then backup the symbolic
-  link.
-- Build console in client-only build.
-- Restore attributes of directory if replace=never set but directory
-  did not exist.
 - Check why Phil's Verify exclude does not work.
 - Phil says that Windows file sizes mismatch in Verify when they should,
   and that either the file size or the catalog size was zero.
-- Fix option 2 of restore -- list where file is backed up -- require Client,
-  then list last 20 backups.
-- Allow browsing the catalog to see all versions of a file (with 
-  stat data on each file).
-- Finish code passing files=nnn to restore start.
-- Add level to estimate command.
 - Check time/dates printed during restore when using Win32 API.
 - Volume "add"ed to Pool gets recycled in first use. VolBytes=0
 - Get rid of 0 dates in LastWritten, ...
-- Fix "llist jobid=xx" where no fileset or client exists.
-- Release SQLite 2.8.9
 - If a tape is recycled while it is mounted, Stanislav Tvrudy must do an
   additional mount to deblock the job.
 - From Johan Decock:
@@ -153,9 +146,6 @@ For 1.33
 - Correct code so that FileSet MD5 is calculated for < and | filename   
   generation.
 - Mark Volume in error on error from WEOF.
-- Why does Bacula need the drive open to do "autochanger list" ?
-- Add a .list all files in the restore tree (probably also a list all files)
-  Do both a long and short form.
 - Implement the Media record flag that indicates that the Volume does disk 
   addressing.
 - Implement VolAddr, which is used when Volume is addressed like a disk,
@@ -168,7 +158,6 @@ For 1.33
 - Look at extracting Win data from BackupRead.
 - Having dashes in filenames apparently creates problems for restore
   by filename.
-- Add data compare on write/read in btape "test". 
 - Implement RestoreJobRetention? Maybe better "JobRetention" in a Job,
   which would take precidence over the Catalog "JobRetention".
 - Implement Label Format in Add and Label console commands.
@@ -1238,7 +1227,7 @@ Block Position: 0
 ====
 
 
-=== for 1.33
+=== Done in 1.33
 - Change console to bconsole.
 - Change smtp to bsmtp.
 - Fix time difference problem between Bacula and Client
@@ -1394,4 +1383,16 @@ Block Position: 0
 - Dates are wrong in restore list from Win32 FD.
 - Dates are wrong in catalog from Win32 FD.
 - Remove h_errno from bnet.c by including proper header.
+- For "list jobs" order by EndTime.
+- Make two tape fill test work.
+- Add atime preservation.
+- Do not err job if could not write bootstrap file.
+- Save and restore last_job across executions.
+- Have each daemon save the last_jobs structure when exiting and
+  read it back in when starting up.
+- "restore jobid=1 select" calls get_storage_xxx, which prints "JobId 1 is
+  not running."
+- Make column listing for running jobs JobId Level Type Started Name  Status
+- Why does Bacula need the drive open to do "autochanger list" ?
+- Add data compare on write/read in btape "test". 
 
index d4695efda9e8c720f882c9b60534a0c8c8720ebe..ba266f27d40fab8e42b24d3eb622a4d5d69ae4a2 100644 (file)
@@ -3,9 +3,9 @@
 #
 @MCOMMON@
 
-srcdir =       .
-VPATH =        .
-.PATH:         .
+srcdir =        .
+VPATH =         .
+.PATH:          .
 
 # one up
 basedir = ..
@@ -30,62 +30,74 @@ CONS_INC=@CONS_INC@
 CONS_LIBS=@CONS_LIBS@
 CONS_LDFLAGS=@CONS_LDFLAGS@
 
-.SUFFIXES:     .c .o
+.SUFFIXES:      .c .o
 .PHONY:
 .DONTCARE:
 
 # inference rules
 .c.o:
-       $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) $(CONS_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
+        $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) $(CONS_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
 #-------------------------------------------------------------------------
 all: Makefile bconsole @STATIC_CONS@
-       @echo "==== Make of console is good ===="
-       @echo " "
+        @echo "==== Make of console is good ===="
+        @echo " "
 
 
 bconsole: $(CONSOBJS) ../lib/libbac.a ../cats/libsql.a
-       $(CXX) $(LDFLAGS) $(CONS_LDFLAGS) -L../lib -L../cats -o $@ $(CONSOBJS) \
-             $(LIBS) $(DLIB) $(CONS_LIBS) -lbac -lsql -lm
+        $(CXX) $(LDFLAGS) $(CONS_LDFLAGS) -L../lib -L../cats -o $@ $(CONSOBJS) \
+              $(LIBS) $(DLIB) $(CONS_LIBS) -lbac -lsql -lm
 
 static-bconsole: $(CONSOBJS) ../lib/libbac.a ../cats/libsql.a
-       $(CXX) -static $(LDFLAGS) $(CONS_LDFLAGS) -L../lib -L../cats -o $@ $(CONSOBJS) \
-             $(LIBS) $(DLIB) $(CONS_LIBS) -lbac -lsql -lm
-       strip $@
+        $(CXX) -static $(LDFLAGS) $(CONS_LDFLAGS) -L../lib -L../cats -o $@ $(CONSOBJS) \
+              $(LIBS) $(DLIB) $(CONS_LIBS) -lbac -lsql -lm
+        strip $@
 
 
 Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
-       cd $(topdir) \
-         && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+        cd $(topdir) \
+          && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
 clean:
-       @$(RMF) console bconsole core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3
-       @$(RMF) static-console static-bconsole gmon.out
+        @$(RMF) console bconsole core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3
+        @$(RMF) static-console static-bconsole gmon.out
 
 realclean: clean
-       @$(RMF) tags console.conf bconsole.conf
+        @$(RMF) tags console.conf bconsole.conf
 
 distclean: realclean
-       if test $(srcdir) = .; then $(MAKE) realclean; fi
-       (cd $(srcdir); $(RMF) Makefile; $(RMF) -r CVS)
+        if test $(srcdir) = .; then $(MAKE) realclean; fi
+        (cd $(srcdir); $(RMF) Makefile; $(RMF) -r CVS)
 
 install: all
-       $(INSTALL_PROGRAM) bconsole $(DESTDIR)$(sbindir)/bconsole
-       @srcconf=bconsole.conf; \
-       if  test -f ${DESTDIR}${sysconfdir}/$$srcconf; then \
-          destconf=$$srcconf.new; \
-          echo "  ==> Found existing $$srcconf, installing new conf file as $$destconf"; \
-       else \
-          destconf=$$srcconf; \
-       fi; \
-       echo "${INSTALL_CONFIG} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf"; \
-       ${INSTALL_CONFIG} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf
-       if test -f static-bconsole; then \
-          $(INSTALL_PROGRAM) static-bconsole $(DESTDIR)$(sbindir)/static-bconsole; \
-       fi
+        @if test -f ${DESTDIR}${sbindir}/console; then \
+           echo " "; \
+           echo "Warning!!!  ${DESTDIR}${sbindir}console found."; \
+           echo " console has been renamed bconsole, so console"; \
+           echo " is no longer used, and you might want to delete it."; \
+           echo " "; \
+        fi
+        $(INSTALL_PROGRAM) bconsole $(DESTDIR)$(sbindir)/bconsole
+        @srcconf=bconsole.conf; \
+        if  test -f ${DESTDIR}${sysconfdir}/$$srcconf; then \
+           destconf=$$srcconf.new; \
+           echo "  ==> Found existing $$srcconf, installing new conf file as $$destconf"; \
+        else \
+           destconf=$$srcconf; \
+           if  test -f ${DESTDIR}${sysconfdir}/console.conf; then \
+              echo "Existing console.conf moved to bconsole.conf"; \
+              @$(MV) ${DESTDIR}${sysconfdir}/console.conf ${DESTDIR}${sysconfdir}/bconsole.conf; \
+              destconf=$$srcconf.new; \
+           fi; \
+        fi; \
+        echo "${INSTALL_CONFIG} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf"; \
+        ${INSTALL_CONFIG} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf
+        if test -f static-bconsole; then \
+           $(INSTALL_PROGRAM) static-bconsole $(DESTDIR)$(sbindir)/static-bconsole; \
+        fi
 
 uninstall:
-       (cd $(DESTDIR)$(sbindir); $(RMF) bconsole static-bconsole)
-       (cd $(DESTDIR)$(sysconfdir); $(RMF) bconsole.conf bconsole.conf.new)
+        (cd $(DESTDIR)$(sbindir); $(RMF) bconsole static-bconsole)
+        (cd $(DESTDIR)$(sysconfdir); $(RMF) console.conf bconsole.conf bconsole.conf.new)
 
 
 
@@ -95,16 +107,16 @@ uninstall:
 # `semi'-automatic since dependencies are generated at distribution time.
 
 depend:
-       @$(MV) Makefile Makefile.bak
-       @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile
-       @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile
-       @$(CC) -S -M $(CPPFLAGS) $(CONS_INC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile
-       @if test -f Makefile ; then \
-           $(RMF) Makefile.bak; \
-       else \
-          $(MV) Makefile.bak Makefile; \
-          echo -e "Something went wrong\n\a"; \
-       fi
+        @$(MV) Makefile Makefile.bak
+        @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile
+        @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile
+        @$(CC) -S -M $(CPPFLAGS) $(CONS_INC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile
+        @if test -f Makefile ; then \
+            $(RMF) Makefile.bak; \
+        else \
+           $(MV) Makefile.bak Makefile; \
+           echo -e "Something went wrong\n\a"; \
+        fi
 
 # -----------------------------------------------------------------------
 # DO NOT DELETE: nice dependency list follows
index 25c3b9cf05cd69baec265316a44498ebafba22a3..3f7be74d69aa35e71849d324043f33e9dde17fee 100644 (file)
@@ -184,6 +184,8 @@ int send_level_command(JCR *jcr)
    case L_BASE:
       bnet_fsend(fd, levelcmd, "base", " ", 0);
       break;
+   /* L_NONE is the console, sending something off to the FD */
+   case L_NONE:
    case L_FULL:
       bnet_fsend(fd, levelcmd, "full", " ", 0);
       break;
index 9cc4c25f8805e14707e9ad6b1ff229fd5ab3b05c..20f3ad42c14202ff3fc2338a0266b9a45755dae0 100644 (file)
@@ -253,7 +253,7 @@ static void *job_thread(void *arg)
             */
            if (status != 0) {
               if (jcr->JobStatus == JS_Terminated) {
-                  Jmsg(jcr, M_ERROR, 0, _("RunAfterJob returned non-zero status=%d\n"),
+                  Jmsg(jcr, M_WARNING, 0, _("RunAfterJob returned non-zero status=%d\n"),
                       status);
               } else {
                   Jmsg(jcr, M_FATAL, 0, _("RunAfterFailedJob returned non-zero status=%d\n"),
index d32a9f6982058e50f5cc5792cdb81ca27870142f..3e291fd62b2e8cdd24cc9db86707a8e75362050b 100644 (file)
@@ -103,7 +103,7 @@ JCR *new_control_jcr(char *base_name, int job_type)
    create_unique_job_name(jcr, base_name);
    jcr->sched_time = jcr->start_time;
    jcr->JobType = job_type;
-   jcr->JobLevel = L_FULL;
+   jcr->JobLevel = L_NONE;
    jcr->JobStatus = JS_Running;
    jcr->JobId = 0;
    /*
index 1d144ead37f3d3c9945af83ba5a5029bf69de588..7618ec6932f80fa25fcf2e561d55a877e2b9d0ce 100644 (file)
@@ -413,8 +413,8 @@ static void list_running_jobs(UAContext *ua)
    }
    njobs = 0;
    bsendmsg(ua, _("\nRunning Jobs:\n"));
-   bsendmsg(ua, _("Level JobId  Job                        Status\n"));
-   bsendmsg(ua, _("====================================================================\n"));
+   bsendmsg(ua, _(" JobId Level   Name                       Status\n"));
+   bsendmsg(ua, _("======================================================================\n"));
    foreach_jcr(jcr) {
       if (jcr->JobId == 0 || !acl_access_ok(ua, Job_ACL, jcr->job->hdr.name)) {
         free_locked_jcr(jcr);
@@ -514,17 +514,17 @@ static void list_running_jobs(UAContext *ua)
       switch (jcr->JobType) {
       case JT_ADMIN:
       case JT_RESTORE:
-         bstrncpy(level, "    ", sizeof(level));
+         bstrncpy(level, "      ", sizeof(level));
         break;
       default:
         bstrncpy(level, level_to_str(jcr->JobLevel), sizeof(level));
-        level[4] = 0;
+        level[7] = 0;
         break;
       }
 
-      bsendmsg(ua, _("%-4s %6d  %-20s %s\n"), 
-        level, 
+      bsendmsg(ua, _("%6d %-6s  %-20s %s\n"), 
         jcr->JobId,
+        level, 
         jcr->Job,
         msg);
 
@@ -551,8 +551,8 @@ static void list_terminated_jobs(UAContext *ua)
    lock_last_jobs_list();
    struct s_last_job *je;
    bsendmsg(ua, _("\nTerminated Jobs:\n"));
-   bsendmsg(ua, _(" JobId  Level   Files      Bytes     Status   Finished        Name \n"));
-   bsendmsg(ua, _("======================================================================\n"));
+   bsendmsg(ua, _(" JobId  Level     Files      Bytes     Status   Finished        Name \n"));
+   bsendmsg(ua, _("========================================================================\n"));
    foreach_dlist(je, last_jobs) {
       char JobName[MAX_NAME_LENGTH];
       char *termstat;
@@ -597,7 +597,7 @@ static void list_terminated_jobs(UAContext *ua)
            *p = 0;
         }
       }
-      bsendmsg(ua, _("%6d  %-4s %8s %14s %-7s  %-8s %s\n"), 
+      bsendmsg(ua, _("%6d  %-6s %8s %14s %-7s  %-8s %s\n"), 
         je->JobId,
         level, 
         edit_uint64_with_commas(je->JobFiles, b1),
index d33c536e8c8232ee4e61beb48347c259abba4816..b588282485342ede313694685c5cb3c0b255fa16 100755 (executable)
@@ -209,7 +209,7 @@ static void  list_terminated_jobs(void sendit(const char *msg, int len, void *sa
            *p = 0;
         }
       }
-      bsnprintf(buf, sizeof(buf), _("%6d  %-4s %8s %14s %-7s  %-8s %s\n"), 
+      bsnprintf(buf, sizeof(buf), _("%6d  %-6s %8s %14s %-7s  %-8s %s\n"), 
         je->JobId,
         level, 
         edit_uint64_with_commas(je->JobFiles, b1),
index 93dc42108a6595b6dd0a342a29ff98fd0c4805de..7e2a80346b456a5b98e504b8db41407edc6dec82 100755 (executable)
@@ -40,20 +40,20 @@ static void jcr_timeout_check(watchdog_t *self);
 
 int num_jobs_run;
 dlist *last_jobs = NULL;
-#define MAX_LAST_JOBS 15
+static const int max_last_jobs = 10;
 
-static JCR *jobs = NULL;             /* pointer to JCR chain */
-static brwlock_t lock;               /* lock for last jobs and JCR chain */
+static JCR *jobs = NULL;              /* pointer to JCR chain */
+static brwlock_t lock;                /* lock for last jobs and JCR chain */
 
 void init_last_jobs_list()
 {
    int errstat;
    struct s_last_job *job_entry = NULL;
    if (!last_jobs) {
-      last_jobs = new dlist(job_entry, &job_entry->link);
+      last_jobs = new dlist(job_entry,  &job_entry->link);
       if ((errstat=rwl_init(&lock)) != 0) {
          Emsg1(M_ABORT, 0, _("Unable to initialize jcr_chain lock. ERR=%s\n"), 
-              strerror(errstat));
+               strerror(errstat));
       }
    }
 
@@ -64,7 +64,7 @@ void term_last_jobs_list()
    struct s_last_job *je;
    if (last_jobs) {
       foreach_dlist(je, last_jobs) {
-        free(je);                     
+         free(je);                     
       }
       delete last_jobs;
       last_jobs = NULL;
@@ -85,24 +85,24 @@ void read_last_jobs_list(int fd, uint64_t addr)
       return;
    }
    Dmsg1(010, "Read num_items=%d\n", num);
-   if (num > 4 * MAX_LAST_JOBS) {  /* sanity check */
+   if (num > 4 * max_last_jobs) {  /* sanity check */
       return;
    }
    for ( ; num; num--) {
       if (read(fd, &job, sizeof(job)) != sizeof(job)) {
          Dmsg1(000, "Read job entry. ERR=%s\n", strerror(errno));
-        return;
+         return;
       }
       if (job.JobId > 0) {
-        je = (struct s_last_job *)malloc(sizeof(struct s_last_job));
-        memcpy((char *)je, (char *)&job, sizeof(job));
-        if (!last_jobs) {
-           init_last_jobs_list();
-        }
-        last_jobs->append(je);
-        if (last_jobs->size() > MAX_LAST_JOBS) {
-           last_jobs->remove(last_jobs->first());
-        }
+         je = (struct s_last_job *)malloc(sizeof(struct s_last_job));
+         memcpy((char *)je, (char *)&job, sizeof(job));
+         if (!last_jobs) {
+            init_last_jobs_list();
+         }
+         last_jobs->append(je);
+         if (last_jobs->size() > max_last_jobs) {
+            last_jobs->remove(last_jobs->first());
+         }
       }
    }
 }
@@ -121,13 +121,13 @@ uint64_t write_last_jobs_list(int fd, uint64_t addr)
       num = last_jobs->size();
       if (write(fd, &num, sizeof(num)) != sizeof(num)) {
          Dmsg1(000, "Error writing num_items: ERR=%s\n", strerror(errno));
-        return 0;
+         return 0;
       }
       foreach_dlist(je, last_jobs) {
-        if (write(fd, je, sizeof(struct s_last_job)) != sizeof(struct s_last_job)) {
+         if (write(fd, je, sizeof(struct s_last_job)) != sizeof(struct s_last_job)) {
             Dmsg1(000, "Error writing job: ERR=%s\n", strerror(errno));
-           return 0;
-        }
+            return 0;
+         }
       }
    }
    /* Return current address */
@@ -196,8 +196,12 @@ JCR *new_jcr(int size, JCR_free_HANDLER *daemon_free_jcr)
    jcr->VolumeName[0] = 0;
    jcr->errmsg = get_pool_memory(PM_MESSAGE);
    jcr->errmsg[0] = 0;
-   strcpy(jcr->Job, "*Console*");     /* default */
-   jcr->JobId = UINT32_MAX;          /* temp non-zero JobId */
+   /* Setup some dummy values */
+   jcr->Job[0] = 0;                   /* no job name by default */
+   jcr->JobId = 0;
+   jcr->JobType = JT_ADMIN;
+   jcr->JobLevel = L_NONE;
+   jcr->JobStatus = JS_Created;
 
    sigtimer.sa_flags = 0;
    sigtimer.sa_handler = timeout_handler;
@@ -219,7 +223,7 @@ JCR *new_jcr(int size, JCR_free_HANDLER *daemon_free_jcr)
 /*
  * Remove a JCR from the chain
  * NOTE! The chain must be locked prior to calling
- *      this routine.
+ *       this routine.
  */
 static void remove_jcr(JCR *jcr)
 {
@@ -227,8 +231,8 @@ static void remove_jcr(JCR *jcr)
    if (!jcr) {
       Emsg0(M_ABORT, 0, "NULL jcr.\n");
    }
-   if (!jcr->prev) {                 /* if no prev */
-      jobs = jcr->next;              /* set new head */
+   if (!jcr->prev) {                  /* if no prev */
+      jobs = jcr->next;               /* set new head */
    } else {
       jcr->prev->next = jcr->next;    /* update prev */
    }
@@ -266,15 +270,15 @@ static void free_common_jcr(JCR *jcr)
       last_job.end_time = time(NULL);
       /* Keep list of last jobs, but not Console where JobId==0 */
       if (last_job.JobId > 0) {
-        je = (struct s_last_job *)malloc(sizeof(struct s_last_job));
-        memcpy((char *)je, (char *)&last_job, sizeof(last_job));
-        if (!last_jobs) {
-           init_last_jobs_list();
-        }
-        last_jobs->append(je);
-        if (last_jobs->size() > MAX_LAST_JOBS) {
-           last_jobs->remove(last_jobs->first());
-        }
+         je = (struct s_last_job *)malloc(sizeof(struct s_last_job));
+         memcpy((char *)je, (char *)&last_job, sizeof(last_job));
+         if (!last_jobs) {
+            init_last_jobs_list();
+         }
+         last_jobs->append(je);
+         if (last_jobs->size() > max_last_jobs) {
+            last_jobs->remove(last_jobs->first());
+         }
       }
       break;
    default:
@@ -282,7 +286,7 @@ static void free_common_jcr(JCR *jcr)
    }
    pthread_mutex_destroy(&jcr->mutex);
 
-   close_msg(jcr);                   /* close messages for this job */
+   close_msg(jcr);                    /* close messages for this job */
    delete jcr->msg_queue;
 
    /* do this after closing messages */
@@ -340,19 +344,19 @@ void free_jcr(JCR *jcr)
 #endif
 
    lock_jcr_chain();
-   jcr->use_count--;                 /* decrement use count */
+   jcr->use_count--;                  /* decrement use count */
    if (jcr->use_count < 0) {
       Emsg2(M_ERROR, 0, _("JCR use_count=%d JobId=%d\n"),
-        jcr->use_count, jcr->JobId);
+         jcr->use_count, jcr->JobId);
    }
    Dmsg3(200, "Dec free_jcr 0x%x use_count=%d jobid=%d\n", jcr, jcr->use_count, jcr->JobId);
-   if (jcr->use_count > 0) {         /* if in use */
+   if (jcr->use_count > 0) {          /* if in use */
       unlock_jcr_chain();
       Dmsg2(200, "free_jcr 0x%x use_count=%d\n", jcr, jcr->use_count);
       return;
    }
    remove_jcr(jcr);
-   job_end_pop(jcr);                 /* pop and call hooked routines */
+   job_end_pop(jcr);                  /* pop and call hooked routines */
 
    Dmsg1(200, "End job=%d\n", jcr->JobId);
    if (jcr->daemon_free_jcr) {
@@ -361,7 +365,7 @@ void free_jcr(JCR *jcr)
 
    free_common_jcr(jcr);
 
-   close_msg(NULL);                  /* flush any daemon messages */
+   close_msg(NULL);                   /* flush any daemon messages */
    unlock_jcr_chain();
    Dmsg0(200, "Exit free_jcr\n");
 }
@@ -373,35 +377,35 @@ void free_jcr(JCR *jcr)
  */
 void free_locked_jcr(JCR *jcr)
 {
-   jcr->use_count--;                 /* decrement use count */
+   jcr->use_count--;                  /* decrement use count */
    Dmsg2(200, "Dec free_locked_jcr 0x%x use_count=%d\n", jcr, jcr->use_count);
-   if (jcr->use_count > 0) {         /* if in use */
+   if (jcr->use_count > 0) {          /* if in use */
       return;
    }
    remove_jcr(jcr);
-   jcr->daemon_free_jcr(jcr);        /* call daemon free routine */
+   jcr->daemon_free_jcr(jcr);         /* call daemon free routine */
    free_common_jcr(jcr);
 }
 
 
 
 /*
- * Given a JobId, find the JCR     
+ * Given a JobId, find the JCR      
  *   Returns: jcr on success
- *           NULL on failure
+ *            NULL on failure
  */
 JCR *get_jcr_by_id(uint32_t JobId)
 {
-   JCR *jcr;      
+   JCR *jcr;       
 
-   lock_jcr_chain();                   /* lock chain */
+   lock_jcr_chain();                    /* lock chain */
    for (jcr = jobs; jcr; jcr=jcr->next) {
       if (jcr->JobId == JobId) {
-        P(jcr->mutex);
-        jcr->use_count++;
-        V(jcr->mutex);
+         P(jcr->mutex);
+         jcr->use_count++;
+         V(jcr->mutex);
          Dmsg2(200, "Inc get_jcr 0x%x use_count=%d\n", jcr, jcr->use_count);
-        break;
+         break;
       }
    }
    unlock_jcr_chain();
@@ -409,23 +413,23 @@ JCR *get_jcr_by_id(uint32_t JobId)
 }
 
 /*
- * Given a SessionId and SessionTime, find the JCR     
+ * Given a SessionId and SessionTime, find the JCR      
  *   Returns: jcr on success
- *           NULL on failure
+ *            NULL on failure
  */
 JCR *get_jcr_by_session(uint32_t SessionId, uint32_t SessionTime)
 {
-   JCR *jcr;      
+   JCR *jcr;       
 
    lock_jcr_chain();
    for (jcr = jobs; jcr; jcr=jcr->next) {
       if (jcr->VolSessionId == SessionId && 
-         jcr->VolSessionTime == SessionTime) {
-        P(jcr->mutex);
-        jcr->use_count++;
-        V(jcr->mutex);
+          jcr->VolSessionTime == SessionTime) {
+         P(jcr->mutex);
+         jcr->use_count++;
+         V(jcr->mutex);
          Dmsg2(200, "Inc get_jcr 0x%x use_count=%d\n", jcr, jcr->use_count);
-        break;
+         break;
       }
    }
    unlock_jcr_chain();
@@ -434,15 +438,15 @@ JCR *get_jcr_by_session(uint32_t SessionId, uint32_t SessionTime)
 
 
 /*
- * Given a Job, find the JCR     
+ * Given a Job, find the JCR      
  *  compares on the number of characters in Job
  *  thus allowing partial matches.
  *   Returns: jcr on success
- *           NULL on failure
+ *            NULL on failure
  */
 JCR *get_jcr_by_partial_name(char *Job)
 {
-   JCR *jcr;      
+   JCR *jcr;       
    int len;
 
    if (!Job) {
@@ -452,11 +456,11 @@ JCR *get_jcr_by_partial_name(char *Job)
    len = strlen(Job);
    for (jcr = jobs; jcr; jcr=jcr->next) {
       if (strncmp(Job, jcr->Job, len) == 0) {
-        P(jcr->mutex);
-        jcr->use_count++;
-        V(jcr->mutex);
+         P(jcr->mutex);
+         jcr->use_count++;
+         V(jcr->mutex);
          Dmsg2(200, "Inc get_jcr 0x%x use_count=%d\n", jcr, jcr->use_count);
-        break;
+         break;
       }
    }
    unlock_jcr_chain();
@@ -465,14 +469,14 @@ JCR *get_jcr_by_partial_name(char *Job)
 
 
 /*
- * Given a Job, find the JCR     
+ * Given a Job, find the JCR      
  *  requires an exact match of names.
  *   Returns: jcr on success
- *           NULL on failure
+ *            NULL on failure
  */
 JCR *get_jcr_by_full_name(char *Job)
 {
-   JCR *jcr;      
+   JCR *jcr;       
 
    if (!Job) {
       return NULL;
@@ -480,11 +484,11 @@ JCR *get_jcr_by_full_name(char *Job)
    lock_jcr_chain();
    for (jcr = jobs; jcr; jcr=jcr->next) {
       if (strcmp(jcr->Job, Job) == 0) {
-        P(jcr->mutex);
-        jcr->use_count++;
-        V(jcr->mutex);
+         P(jcr->mutex);
+         jcr->use_count++;
+         V(jcr->mutex);
          Dmsg2(200, "Inc get_jcr 0x%x use_count=%d\n", jcr, jcr->use_count);
-        break;
+         break;
       }
    }
    unlock_jcr_chain();
@@ -517,7 +521,7 @@ void lock_jcr_chain()
    int errstat;
    if ((errstat=rwl_writelock(&lock)) != 0) {
       Emsg1(M_ABORT, 0, "rwl_writelock failure. ERR=%s\n",
-          strerror(errstat));
+           strerror(errstat));
    }
 }
 
@@ -529,7 +533,7 @@ void unlock_jcr_chain()
    int errstat;
    if ((errstat=rwl_writeunlock(&lock)) != 0) {
       Emsg1(M_ABORT, 0, "rwl_writeunlock failure. ERR=%s\n",
-          strerror(errstat));
+           strerror(errstat));
    }
 }
 
@@ -557,8 +561,8 @@ bool init_jcr_subsystem(void)
    watchdog_t *wd = new_watchdog();
 
    wd->one_shot = false;
-   wd->interval = 30;  /* FIXME: should be configurable somewhere, even
-                        if only with a #define */
+   wd->interval = 30;   /* FIXME: should be configurable somewhere, even
+                         if only with a #define */
    wd->callback = jcr_timeout_check;
 
    register_watchdog(wd);
@@ -579,45 +583,45 @@ static void jcr_timeout_check(watchdog_t *self)
     */
    lock_jcr_chain();
    foreach_jcr(jcr) {
-      free_locked_jcr(jcr);          /* OK to free now cuz chain is locked */
+      free_locked_jcr(jcr);           /* OK to free now cuz chain is locked */
       if (jcr->JobId == 0) {
-        continue;
+         continue;
       }
       fd = jcr->store_bsock;
       if (fd) {
-        timer_start = fd->timer_start;
-        if (timer_start && (watchdog_time - timer_start) > fd->timeout) {
-           fd->timer_start = 0;      /* turn off timer */
-           fd->timed_out = TRUE;
-           Jmsg(jcr, M_ERROR, 0, _(
+         timer_start = fd->timer_start;
+         if (timer_start && (watchdog_time - timer_start) > fd->timeout) {
+            fd->timer_start = 0;      /* turn off timer */
+            fd->timed_out = TRUE;
+            Jmsg(jcr, M_ERROR, 0, _(
 "Watchdog sending kill after %d secs to thread stalled reading Storage daemon.\n"),
-                watchdog_time - timer_start);
-           pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL);
-        }
+                 watchdog_time - timer_start);
+            pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL);
+         }
       }
       fd = jcr->file_bsock;
       if (fd) {
-        timer_start = fd->timer_start;
-        if (timer_start && (watchdog_time - timer_start) > fd->timeout) {
-           fd->timer_start = 0;      /* turn off timer */
-           fd->timed_out = TRUE;
-           Jmsg(jcr, M_ERROR, 0, _(
+         timer_start = fd->timer_start;
+         if (timer_start && (watchdog_time - timer_start) > fd->timeout) {
+            fd->timer_start = 0;      /* turn off timer */
+            fd->timed_out = TRUE;
+            Jmsg(jcr, M_ERROR, 0, _(
 "Watchdog sending kill after %d secs to thread stalled reading File daemon.\n"),
-                watchdog_time - timer_start);
-           pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL);
-        }
+                 watchdog_time - timer_start);
+            pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL);
+         }
       }
       fd = jcr->dir_bsock;
       if (fd) {
-        timer_start = fd->timer_start;
-        if (timer_start && (watchdog_time - timer_start) > fd->timeout) {
-           fd->timer_start = 0;      /* turn off timer */
-           fd->timed_out = TRUE;
-           Jmsg(jcr, M_ERROR, 0, _(
+         timer_start = fd->timer_start;
+         if (timer_start && (watchdog_time - timer_start) > fd->timeout) {
+            fd->timer_start = 0;      /* turn off timer */
+            fd->timed_out = TRUE;
+            Jmsg(jcr, M_ERROR, 0, _(
 "Watchdog sending kill after %d secs to thread stalled reading Director.\n"),
-                watchdog_time - timer_start);
-           pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL);
-        }
+                 watchdog_time - timer_start);
+            pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL);
+         }
       }
 
    }
@@ -631,5 +635,5 @@ static void jcr_timeout_check(watchdog_t *self)
  */
 static void timeout_handler(int sig)
 {
-   return;                           /* thus interrupting the function */
+   return;                            /* thus interrupting the function */
 }
index a66a349a898fdbb727409aa18d5883d6669395cc..45a5dd7f10d39697a9b9930b077754fa265c3ff1 100644 (file)
@@ -305,7 +305,7 @@ static void list_terminated_jobs(void *arg)
            *p = 0;
         }
       }
-      bsnprintf(buf, sizeof(buf), _("%6d  %-4s %8s %14s %-7s  %-8s %s\n"), 
+      bsnprintf(buf, sizeof(buf), _("%6d  %-6s %8s %14s %-7s  %-8s %s\n"), 
         je->JobId,
         level, 
         edit_uint64_with_commas(je->JobFiles, b1),
index 4c1a6f35d5d5f1ad0ac70220035baa5e4d943e2b..28720383232ae71dd9a10e27d77dfe6fda469efc 100644 (file)
@@ -2,8 +2,8 @@
 #undef  VERSION
 #define VERSION "1.33.4"
 #define VSTRING "1"
-#define BDATE   "28 Feb 2004"
-#define LSMDATE "28Feb04"
+#define BDATE   "01 Mar 2004"
+#define LSMDATE "01Mar04"
 
 /* Debug flags */
 #undef  DEBUG