Example #1
0
static bool close_attr_spool_file(JCR *jcr, BSOCK *bs)
{
    POOLMEM *name;
    char tbuf[MAX_TIME_LENGTH];

    Dmsg1(100, "Close attr spool file at %s\n", bstrftimes(tbuf, sizeof(tbuf), (utime_t)time(NULL)));
    if (bs->m_spool_fd == -1) {
        return true;
    }

    name = get_pool_memory(PM_MESSAGE);

    P(mutex);
    spool_stats.attr_jobs--;
    spool_stats.total_attr_jobs++;
    V(mutex);

    make_unique_spool_filename(jcr, &name, bs->m_fd);
    close(bs->m_spool_fd);
    unlink(name);
    free_pool_memory(name);
    bs->m_spool_fd = -1;
    bs->clear_spooling();

    return true;
}
Example #2
0
bool open_attr_spool_file(JCR *jcr, BSOCK *bs)
{
   POOLMEM *name  = get_pool_memory(PM_MESSAGE);

   make_unique_spool_filename(jcr, &name, bs->m_fd);
   bs->m_spool_fd = fopen(name, "w+b");
   if (!bs->m_spool_fd) {
      berrno be;
      Jmsg(jcr, M_FATAL, 0, _("fopen attr spool file %s failed: ERR=%s\n"), name,
           be.bstrerror());
      free_pool_memory(name);
      return false;
   }
   P(mutex);
   spool_stats.attr_jobs++;
   V(mutex);
   free_pool_memory(name);
   return true;
}
Example #3
0
/*
 * Tell Director where to find the attributes spool file
 *  Note, if we are not on the same machine, the Director will
 *  return an error, and the higher level routine will transmit
 *  the data record by record -- using bsock->despool().
 */
static bool blast_attr_spool_file(JCR *jcr, boffset_t size)
{
    /* send full spool file name */
    POOLMEM *name  = get_pool_memory(PM_MESSAGE);
    make_unique_spool_filename(jcr, &name, jcr->dir_bsock->m_fd);
    bash_spaces(name);
    jcr->dir_bsock->fsend("BlastAttr Job=%s File=%s\n", jcr->Job, name);
    free_pool_memory(name);

    if (jcr->dir_bsock->recv() <= 0) {
        Jmsg(jcr, M_FATAL, 0, _("Network error on BlastAttributes.\n"));
        jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
        return false;
    }

    if (!bstrcmp(jcr->dir_bsock->msg, "1000 OK BlastAttr\n")) {
        return false;
    }
    return true;
}
Example #4
0
static bool open_attr_spool_file(JCR *jcr, BSOCK *bs)
{
    POOLMEM *name  = get_pool_memory(PM_MESSAGE);

    make_unique_spool_filename(jcr, &name, bs->m_fd);
    bs->m_spool_fd = open(name, O_CREAT | O_TRUNC | O_RDWR | O_BINARY, 0640);
    if (bs->m_spool_fd == -1) {
        berrno be;

        Jmsg(jcr, M_FATAL, 0, _("fopen attr spool file %s failed: ERR=%s\n"), name, be.bstrerror());
        jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
        free_pool_memory(name);
        return false;
    }

    P(mutex);
    spool_stats.attr_jobs++;
    V(mutex);

    free_pool_memory(name);

    return true;
}