]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/status.c
Remove broken run when code
[bacula/bacula] / bacula / src / stored / status.c
index 07f6c7ac06da2974975eddf78d441f31f77904ed..00ebed2fd7913092a31d10ceda8763e0a9d9ddfc 100644 (file)
@@ -1,3 +1,30 @@
+/*
+   Bacula® - The Network Backup Solution
+
+   Copyright (C) 2003-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.
+   This program is Free Software; you can redistribute it and/or
+   modify it under the terms of version two of the GNU General Public
+   License as published by the Free Software Foundation plus additions
+   that are listed in the file LICENSE.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+   Bacula® is a registered trademark of John Walker.
+   The licensor of Bacula is the Free Software Foundation Europe
+   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
 /*
  *  This file handles the status command
  *
@@ -6,20 +33,6 @@
  *   Version $Id$
  *
  */
-/*
-   Copyright (C) 2003-2006 Kern Sibbald
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License
-   version 2 as amended with additional clauses defined in the
-   file LICENSE in the main source directory.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
-   the file LICENSE for additional details.
-
- */
 
 #include "bacula.h"
 #include "stored.h"
@@ -30,6 +43,7 @@
 extern BSOCK *filed_chan;
 extern int r_first, r_last;
 extern struct s_res resources[];
+extern void *start_heap;
 
 /* Static variables */
 static char qstatus[] = ".status %127s\n";
@@ -55,11 +69,12 @@ void output_status(void sendit(const char *msg, int len, void *sarg), void *arg)
    AUTOCHANGER *changer;
    DEVICE *dev;
    char dt[MAX_TIME_LENGTH];
-   char *msg, b1[35], b2[35], b3[35], b4[35];
+   char b1[35], b2[35], b3[35], b4[35], b5[35];
+   POOLMEM *msg;
    int bpb;
    int len;
 
-   msg = (char *)get_pool_memory(PM_MESSAGE);
+   msg = get_pool_memory(PM_MESSAGE);
 
    len = Mmsg(msg, _("%s Version: %s (%s) %s %s %s\n"), 
               my_name, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER);
@@ -72,11 +87,12 @@ void output_status(void sendit(const char *msg, int len, void *sarg), void *arg)
         dt, num_jobs_run, num_jobs_run == 1 ? "" : "s");
    sendit(msg, len, arg);
 
-   len = Mmsg(msg, _(" Heap: bytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"),
-         edit_uint64_with_commas(sm_bytes, b1),
-         edit_uint64_with_commas(sm_max_bytes, b2),
-         edit_uint64_with_commas(sm_buffers, b3),
-         edit_uint64_with_commas(sm_max_buffers, b4));
+   len = Mmsg(msg, _(" Heap: heap=%s smbytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"),
+         edit_uint64_with_commas((char *)sbrk(0)-(char *)start_heap, b1),
+         edit_uint64_with_commas(sm_bytes, b2),
+         edit_uint64_with_commas(sm_max_bytes, b3),
+         edit_uint64_with_commas(sm_buffers, b4),
+         edit_uint64_with_commas(sm_max_buffers, b5));
    sendit(msg, len, arg);
 
    /*
@@ -204,7 +220,7 @@ static void send_blocked_status(DEVICE *dev, void sendit(const char *msg, int le
       free_pool_memory(msg);
       return;
    }
-   switch (dev->dev_blocked) {
+   switch (dev->blocked()) {
    case BST_UNMOUNTED:
       len = Mmsg(msg, _("    Device is BLOCKED. User unmounted.\n"));
       sendit(msg, len, arg);
@@ -299,7 +315,7 @@ static void send_blocked_status(DEVICE *dev, void sendit(const char *msg, int le
          dev->state & ST_MOUNTED ? "" : "!");
       sendit(msg, len, arg);
 
-      len = Mmsg(msg, _("num_writers=%d block=%d\n\n"), dev->num_writers, dev->dev_blocked);
+      len = Mmsg(msg, _("num_writers=%d block=%d\n\n"), dev->num_writers, dev->blocked());
       sendit(msg, len, arg);
 
       len = Mmsg(msg, _("Device parameters:\n"));
@@ -353,7 +369,7 @@ static void list_running_jobs(void sendit(const char *msg, int len, void *sarg),
          }
          if (rdcr && rdcr->device) {
             len = Mmsg(msg, _("Reading: %s %s job %s JobId=%d Volume=\"%s\"\n"
-                            "    pool=\"%s\" device=\"%s\"\n"),
+                            "    pool=\"%s\" device=%s\n"),
                    job_level_to_str(jcr->JobLevel),
                    job_type_to_str(jcr->JobType),
                    JobName,
@@ -366,7 +382,7 @@ static void list_running_jobs(void sendit(const char *msg, int len, void *sarg),
          }
          if (dcr && dcr->device) {
             len = Mmsg(msg, _("Writing: %s %s job %s JobId=%d Volume=\"%s\"\n"
-                            "    pool=\"%s\" device=\"%s\"\n"),
+                            "    pool=\"%s\" device=%s\n"),
                    job_level_to_str(jcr->JobLevel),
                    job_type_to_str(jcr->JobType),
                    JobName,
@@ -376,6 +392,9 @@ static void list_running_jobs(void sendit(const char *msg, int len, void *sarg),
                    dcr->dev?dcr->dev->print_name(): 
                             dcr->device->device_name);
             sendit(msg, len, arg);
+            len= Mmsg(msg, _("    spooling=%d despooling=%d despool_wait=%d\n"),
+                   dcr->spooling, dcr->despooling, dcr->despool_wait);
+            sendit(msg, len, arg);
          }
          sec = time(NULL) - jcr->run_time;
          if (sec <= 0) {