| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include "syslog-util.h" /* IWYU pragma: keep */ |
| 5 |
|
| 6 |
int journal_fd_nonblock(bool nonblock); |
| 7 |
void close_journal_fd(void); |
| 8 |
|
| 9 |
/* We declare sd_journal_stream_fd() as async-signal-safe. So instead of strjoin(), which calls malloc() |
| 10 |
* internally, use a macro + alloca(). */ |
| 11 |
#define journal_stream_path(log_namespace) \ |
| 12 |
({ \ |
| 13 |
const char *_ns = (log_namespace), *_ret; \ |
| 14 |
if (!_ns) \ |
| 15 |
_ret = "/run/systemd/journal/stdout"; \ |
| 16 |
else if (log_namespace_name_valid(_ns)) \ |
| 17 |
_ret = strjoina("/run/systemd/journal.", _ns, "/stdout"); \ |
| 18 |
else \ |
| 19 |
_ret = NULL; \ |
| 20 |
_ret; \ |
| 21 |
}) |