journal-remote-write.c revision 0e72da6fe8671d49b4d458519f5ac7600fd04f03
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2012 Zbigniew Jędrzejewski-Szmek
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "journal-remote.h"
return log_oom();
return 0;
}
}
size_t n = 0, i;
return n;
}
size_t i;
}
/**********************************************************************
**********************************************************************
**********************************************************************/
if (r < 0) {
if (*f)
else
log_error_errno(r, "Failed to create rotated journal: %m");
}
return r;
}
Writer *w;
if (!w)
return NULL;
w->mmap = mmap_cache_new();
if (!w->mmap) {
free(w);
return NULL;
}
w->n_ref = 1;
return w;
}
if (!w)
return NULL;
if (w->journal) {
}
if (w->server && w->hashmap_key)
free(w->hashmap_key);
if (w->mmap)
mmap_cache_unref(w->mmap);
free(w);
return NULL;
}
if (w && (-- w->n_ref <= 0))
writer_free(w);
return NULL;
}
if (w)
return w;
}
int writer_write(Writer *w,
struct iovec_wrapper *iovw,
bool compress,
bool seal) {
int r;
assert(w);
if (journal_file_rotate_suggested(w->journal, 0)) {
log_info("%s: Journal header limits reached or header out-of-date, rotating",
if (r < 0)
return r;
}
if (r >= 0) {
if (w->server)
return 1;
}
if (r < 0)
return r;
else
log_debug("Retrying write.");
if (r < 0)
return r;
if (w->server)
return 1;
}