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