journal-remote.c revision fdfccdbc985944a57017a25f44dd6acc1a937bab
2N/A along with systemd; If not, see <http://www.gnu.org/licenses/>.
2N/A#include <inttypes.h>
#include <getopt.h>
#include "sd-daemon.h"
#include "sd-event.h"
#include "journal-file.h"
#include "journald-native.h"
#include "socket-util.h"
#include "mkdir.h"
#include "build.h"
#include "macro.h"
#include "strv.h"
#include "journal-remote-parse.h"
#include "journal-remote-write.h"
static bool arg_stdin = false;
static int arg_compress = true;
static int arg_seal = false;
return -errno;
if (child_pid < 0) {
r = -errno;
if (child_pid == 0) {
return fd[0];
"-HAccept: application/vnd.fdo.journal",
url);
if (!words)
return log_oom();
if (!name)
return log_oom();
for(c = name; *c; c++) {
if (!arg_output) {
return log_oom();
return log_oom();
if (!output)
return log_oom();
&s->metrics,
s->mmap,
typedef struct RemoteServer {
} RemoteServer;
int fd,
void *userdata);
int fd,
void *userdata);
return log_oom();
return log_oom();
s->active++;
assert(s);
if (source) {
s->active--;
char *realname;
assert(s);
if (name) {
if (!realname)
return log_oom();
return log_oom();
goto error;
int fd, r;
if (fd < 0)
return fd;
s->active ++;
void *userdata) {
assert(s);
assert(s);
int r, n, fd;
assert(s);
setup_signals(s);
n = sd_listen_fds(true);
strerror(-n));
return -EINVAL;
if (arg_url) {
if (!urlv)
return log_oom();
if (!url)
return log_oom();
if (arg_getter) {
if (fd < 0)
return fd;
if (arg_listen_raw) {
if (arg_stdin) {
if (s->active == 0) {
return -EINVAL;
ssize_t i;
for(i = 0; i < s->sources_size; i++)
remove_source(s, i);
int fd,
void *userdata) {
} else if (r == -E2BIG) {
int fd,
void *userdata) {
int fd2, r;
if (fd2 < 0) {
return -errno;
case AF_INET:
case AF_INET6: {
return -EINVAL;
static int help(void) {
help();
case ARG_VERSION:
case ARG_URL:
if (arg_url) {
return -EINVAL;
case ARG_GETTER:
if (arg_getter) {
return -EINVAL;
case ARG_LISTEN_RAW:
if (arg_listen_raw) {
return -EINVAL;
case ARG_STDIN:
arg_stdin = true;
if (arg_output) {
return -EINVAL;
case ARG_COMPRESS:
arg_compress = true;
case ARG_NO_COMPRESS:
arg_compress = false;
case ARG_SEAL:
arg_seal = true;
case ARG_NO_SEAL:
arg_seal = false;
return -EINVAL;
return -EINVAL;
return -EINVAL;
RemoteServer s = {};
int r, r2;
log_show_color(true);
if (remoteserver_init(&s) < 0)
return EXIT_FAILURE;
sd_notify(false,
while (s.active) {
if (r == SD_EVENT_FINISHED)