1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 This file is part of systemd.
7 Copyright 2017 Lennart Poettering
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 #include <sys/types.h>
28 typedef struct ClientContext ClientContext
;
30 #include "journald-server.h"
32 struct ClientContext
{
60 sd_id128_t invocation_id
;
67 struct iovec
*extra_fields_iovec
;
68 size_t extra_fields_n_iovec
;
69 void *extra_fields_data
;
70 nsec_t extra_fields_mtime
;
73 int client_context_get(
76 const struct ucred
*ucred
,
77 const char *label
, size_t label_len
,
81 int client_context_acquire(
84 const struct ucred
*ucred
,
85 const char *label
, size_t label_len
,
89 ClientContext
* client_context_release(Server
*s
, ClientContext
*c
);
91 void client_context_maybe_refresh(
94 const struct ucred
*ucred
,
95 const char *label
, size_t label_size
,
99 void client_context_acquire_default(Server
*s
);
100 void client_context_flush_all(Server
*s
);
102 static inline size_t client_context_extra_fields_n_iovec(const ClientContext
*c
) {
103 return c
? c
->extra_fields_n_iovec
: 0;
106 static inline bool client_context_test_priority(const ClientContext
*c
, int priority
) {
110 if (c
->log_level_max
< 0)
113 return LOG_PRI(priority
) <= c
->log_level_max
;