]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/filed/job.c
Update configure to set x on logrotate
[bacula/bacula] / bacula / src / filed / job.c
index 23796405bd665c26cbdc1c76ed5b69c4b1bcf59c..458e3a5a8b6269466beddc9a5b3e40f9d893b89b 100644 (file)
@@ -7,7 +7,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -50,13 +50,13 @@ static int verify_cmd(JCR *jcr);
 static int restore_cmd(JCR *jcr);
 static int storage_cmd(JCR *jcr);
 static int session_cmd(JCR *jcr);
-static int response(JCR *jcr, BSOCK *sd, char *resp, char *cmd);
+static int response(JCR *jcr, BSOCK *sd, char *resp, const char *cmd);
 static void filed_free_jcr(JCR *jcr);
 static int open_sd_read_session(JCR *jcr);
 static int send_bootstrap_file(JCR *jcr);
 static int runbefore_cmd(JCR *jcr);
 static int runafter_cmd(JCR *jcr);
-static int run_cmd(JCR *jcr, char *cmd, char *name);
+static int run_cmd(JCR *jcr, char *cmd, const char *name);
 
 
 /* Exported functions */
@@ -114,7 +114,7 @@ static char OKverify[]    = "2000 OK verify\n";
 static char OKrestore[]   = "2000 OK restore\n";
 static char OKsession[]   = "2000 OK session\n";
 static char OKstore[]     = "2000 OK storage\n";
-static char OKjob[]       = "2000 OK Job " HOST_OS "," DISTNAME "," DISTVER;
+static char OKjob[]       = "2000 OK Job %s,%s,%s";
 static char OKsetdebug[]  = "2000 OK setdebug=%d\n";
 static char BADjob[]      = "2901 Bad Job\n";
 static char EndJob[]      = "2800 End Job TermCode=%d JobFiles=%u ReadBytes=%s JobBytes=%s Errors=%u\n";
@@ -257,17 +257,17 @@ static int cancel_cmd(JCR *jcr)
            P(cjcr->mutex);
            cjcr->store_bsock->timed_out = 1;
            cjcr->store_bsock->terminated = 1;
-#ifndef HAVE_CYGWIN
+#if !defined(HAVE_CYGWIN) && !defined(HAVE_WIN32)
            pthread_kill(cjcr->my_thread_id, TIMEOUT_SIGNAL);
 #endif
            V(cjcr->mutex);
         }
         set_jcr_job_status(cjcr, JS_Canceled);
         free_jcr(cjcr);
-         bnet_fsend(dir, "2001 Job %s marked to be canceled.\n", Job);
+         bnet_fsend(dir, _("2001 Job %s marked to be canceled.\n"), Job);
       }
    } else {
-      bnet_fsend(dir, "2902 Error scanning cancel command.\n");
+      bnet_fsend(dir, _("2902 Error scanning cancel command.\n"));
    }
    bnet_sig(dir, BNET_EOD);
    return 1;
@@ -281,15 +281,16 @@ static int cancel_cmd(JCR *jcr)
 static int setdebug_cmd(JCR *jcr)
 {
    BSOCK *dir = jcr->dir_bsock;
-   int level;
+   int level, trace_flag;
 
    Dmsg1(110, "setdebug_cmd: %s", dir->msg);
-   if (sscanf(dir->msg, "setdebug=%d", &level) != 1 || level < 0) {
+   if (sscanf(dir->msg, "setdebug=%d trace=%d", &level, &trace_flag) != 2 || level < 0) {
       pm_strcpy(&jcr->errmsg, dir->msg);
       bnet_fsend(dir, "2991 Bad setdebug command: %s\n", jcr->errmsg);
       return 0;   
    }
    debug_level = level;
+   set_trace(trace_flag);
    return bnet_fsend(dir, OKsetdebug, level);
 }
 
@@ -333,7 +334,7 @@ static int job_cmd(JCR *jcr)
    jcr->sd_auth_key = bstrdup(sd_auth_key);
    free_pool_memory(sd_auth_key);
    Dmsg2(120, "JobId=%d Auth=%s\n", jcr->JobId, jcr->sd_auth_key);
-   return bnet_fsend(dir, OKjob);
+   return bnet_fsend(dir, OKjob, HOST_OS, DISTNAME, DISTVER);
 }
 
 static int runbefore_cmd(JCR *jcr)
@@ -387,7 +388,7 @@ static int runafter_cmd(JCR *jcr)
    return bnet_fsend(dir, OKRunAfter);
 }
 
-static int run_cmd(JCR *jcr, char *cmd, char *name)
+static int run_cmd(JCR *jcr, char *cmd, const char *name)
 {
    POOLMEM *ecmd = get_pool_memory(PM_FNAME);
    int status;
@@ -627,7 +628,6 @@ static int level_cmd(JCR *jcr)
       Dmsg2(100, "Got since time: %s mtime_only=%d\n", ctime(&mtime), mtime_only);
       jcr->incremental = 1;          /* set incremental or decremental backup */
       jcr->mtime = mtime;            /* set since time */
-      jcr->mtime_only = mtime_only;   /* and what to compare */
    /*
     * We get his UTC since time, then sync the clocks and correct it
     *  to agree with our clock.
@@ -677,7 +677,6 @@ static int level_cmd(JCR *jcr)
       Dmsg2(100, "adj = %d since_time=%d\n", (int)adj, (int)since_time);
       jcr->incremental = 1;          /* set incremental or decremental backup */
       jcr->mtime = since_time;       /* set since time */
-      jcr->mtime_only = mtime_only;   /* and what to compare */
    } else {
       Jmsg1(jcr, M_FATAL, 0, "Unknown backup level: %s\n", level);
       free_memory(level);
@@ -1133,7 +1132,7 @@ static void filed_free_jcr(JCR *jcr)
  *  Returns: 0 on failure
  *          1 on success
  */
-int response(JCR *jcr, BSOCK *sd, char *resp, char *cmd)
+int response(JCR *jcr, BSOCK *sd, char *resp, const char *cmd)
 {
    if (sd->errors) {
       return 0;