1 | // SPDX-License-Identifier: GPL-3.0-or-later |
2 | |
3 | #pragma once |
4 | |
5 | #define SYSLOGD_RPC_X(ARGS, PB, arg) \ |
6 | ARGS(arg, 0, set_name, SET_NAME, "s", ARG(STRING, name)) \ |
7 | ARGS(arg, 1, log, LOG, "s", ARG(STRING, message)) \ |
8 | ARGS(arg, 2, logc, LOGC, "ss", ARG(STRING, category), ARG(STRING, message)) |
9 | |
10 | #define SYSLOGD_SERVICE_NAME "syslogd" |
11 | |
12 | #ifdef __MOS_RPC_CLIENT__ |
13 | #include <librpc/rpc_client.h> |
14 | #include <stdio.h> |
15 | |
16 | RPC_DECLARE_CLIENT(syslogd, SYSLOGD_RPC_X) |
17 | |
18 | should_inline void syslogd_logf(rpc_server_stub_t *logger, const char *fmt, ...) |
19 | { |
20 | va_list args; |
21 | va_start(args, fmt); |
22 | char buffer[1024]; |
23 | vsnprintf(buffer, sizeof(buffer), fmt, args); |
24 | syslogd_log(logger, buffer); |
25 | va_end(args); |
26 | } |
27 | #endif |
28 | |