]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/journal/journald-context.h
headers: remove unneeded includes from util.h
[thirdparty/systemd.git] / src / journal / journald-context.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
22e3a02b
LP
2#pragma once
3
22e3a02b
LP
4#include <inttypes.h>
5#include <sys/types.h>
6
7#include "sd-id128.h"
8
ca78ad1d
ZJS
9#include "time-util.h"
10
22e3a02b
LP
11typedef struct ClientContext ClientContext;
12
13#include "journald-server.h"
14
15struct ClientContext {
16 unsigned n_ref;
17 unsigned lru_index;
18 usec_t timestamp;
19 bool in_lru;
20
21 pid_t pid;
22 uid_t uid;
23 gid_t gid;
24
25 char *comm;
26 char *exe;
27 char *cmdline;
28 char *capeff;
29
30 uint32_t auditid;
31 uid_t loginuid;
32
33 char *cgroup;
34 char *session;
35 uid_t owner_uid;
36
37 char *unit;
38 char *user_unit;
39
40 char *slice;
41 char *user_slice;
42
43 sd_id128_t invocation_id;
44
45 char *label;
46 size_t label_size;
d3070fbd
LP
47
48 int log_level_max;
49
50 struct iovec *extra_fields_iovec;
51 size_t extra_fields_n_iovec;
52 void *extra_fields_data;
53 nsec_t extra_fields_mtime;
90fc172e
AZ
54
55 usec_t log_rate_limit_interval;
56 unsigned log_rate_limit_burst;
22e3a02b
LP
57};
58
59int client_context_get(
60 Server *s,
61 pid_t pid,
62 const struct ucred *ucred,
63 const char *label, size_t label_len,
64 const char *unit_id,
65 ClientContext **ret);
66
67int client_context_acquire(
68 Server *s,
69 pid_t pid,
70 const struct ucred *ucred,
71 const char *label, size_t label_len,
72 const char *unit_id,
73 ClientContext **ret);
74
75ClientContext* client_context_release(Server *s, ClientContext *c);
76
77void client_context_maybe_refresh(
78 Server *s,
79 ClientContext *c,
80 const struct ucred *ucred,
81 const char *label, size_t label_size,
82 const char *unit_id,
83 usec_t tstamp);
84
85void client_context_acquire_default(Server *s);
86void client_context_flush_all(Server *s);
d3070fbd
LP
87
88static inline size_t client_context_extra_fields_n_iovec(const ClientContext *c) {
89 return c ? c->extra_fields_n_iovec : 0;
90}
91
92static inline bool client_context_test_priority(const ClientContext *c, int priority) {
93 if (!c)
94 return true;
95
96 if (c->log_level_max < 0)
97 return true;
98
99 return LOG_PRI(priority) <= c->log_level_max;
100}