• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

systemd / systemd / 13688105616

05 Mar 2025 11:59PM UTC coverage: 71.788% (-0.07%) from 71.855%
13688105616

push

github

yuwata
mkosi: update debian commit reference

* dfdab6b205 Install new files
* e00bee5b4a Install new files

294781 of 410628 relevant lines covered (71.79%)

715950.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.67
/src/basic/missing_syscall.h
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2
#pragma once
3

4
/* Missing glibc definitions to access certain kernel APIs */
5

6
#include <errno.h>
7
#include <linux/time_types.h>
8
#include <signal.h>
9
#include <sys/syscall.h>
10
#include <sys/types.h>
11
#include <sys/wait.h>
12
#include <unistd.h>
13

14
#ifdef ARCH_MIPS
15
#include <asm/sgidefs.h>
16
#endif
17

18
#include "macro.h"
19
#include "missing_keyctl.h"
20
#include "missing_sched.h"
21
#include "missing_syscall_def.h"
22

23
/* ======================================================================= */
24

25
#if !HAVE_FCHMODAT2
26
/* since kernel v6.6 (78252deb023cf0879256fcfbafe37022c390762b) */
27
static inline int missing_fchmodat2(int dirfd, const char *path, mode_t mode, int flags) {
24,707✔
28
        return syscall(__NR_fchmodat2, dirfd, path, mode, flags);
24,707✔
29
}
30

31
#  define fchmodat2 missing_fchmodat2
32
#endif
33

34
/* ======================================================================= */
35

36
#if !HAVE_PIVOT_ROOT
37
static inline int missing_pivot_root(const char *new_root, const char *put_old) {
2,871✔
38
        return syscall(__NR_pivot_root, new_root, put_old);
2,871✔
39
}
40

41
#  define pivot_root missing_pivot_root
42
#endif
43

44
/* ======================================================================= */
45

46
#if !HAVE_IOPRIO_GET
47
static inline int missing_ioprio_get(int which, int who) {
2,094✔
48
        return syscall(__NR_ioprio_get, which, who);
2,094✔
49
}
50

51
#  define ioprio_get missing_ioprio_get
52
#endif
53

54
/* ======================================================================= */
55

56
#if !HAVE_IOPRIO_SET
57
static inline int missing_ioprio_set(int which, int who, int ioprio) {
8✔
58
        return syscall(__NR_ioprio_set, which, who, ioprio);
8✔
59
}
60

61
#  define ioprio_set missing_ioprio_set
62
#endif
63

64
/* ======================================================================= */
65

66
#if !HAVE_KCMP
67
static inline int missing_kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2) {
7,445✔
68
        return syscall(__NR_kcmp, pid1, pid2, type, idx1, idx2);
7,445✔
69
}
70

71
#  define kcmp missing_kcmp
72
#endif
73

74
/* ======================================================================= */
75

76
#if !HAVE_KEYCTL
77
static inline long missing_keyctl(int cmd, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5) {
22,034✔
78
        return syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5);
22,034✔
79

80
#  define keyctl missing_keyctl
81
}
82

83
/* ======================================================================= */
84

85
static inline key_serial_t missing_add_key(const char *type, const char *description, const void *payload, size_t plen, key_serial_t ringid) {
10,343✔
86
        return syscall(__NR_add_key, type, description, payload, plen, ringid);
10,343✔
87

88
#  define add_key missing_add_key
89
}
90

91
/* ======================================================================= */
92

93
static inline key_serial_t missing_request_key(const char *type, const char *description, const char * callout_info, key_serial_t destringid) {
12✔
94
        return syscall(__NR_request_key, type, description, callout_info, destringid);
12✔
95

96
#  define request_key missing_request_key
97
}
98
#endif
99

100
/* ======================================================================= */
101

102
#if !HAVE_BPF
103
union bpf_attr;
104

105
static inline int missing_bpf(int cmd, union bpf_attr *attr, size_t size) {
2,911✔
106
        return (int) syscall(__NR_bpf, cmd, attr, size);
2,911✔
107
}
108

109
#  define bpf missing_bpf
110
#endif
111

112
/* ======================================================================= */
113

114
#if !HAVE_SET_MEMPOLICY
115
enum {
116
        MPOL_DEFAULT,
117
        MPOL_PREFERRED,
118
        MPOL_BIND,
119
        MPOL_INTERLEAVE,
120
        MPOL_LOCAL,
121
};
122

123
static inline long missing_set_mempolicy(int mode, const unsigned long *nodemask,
17✔
124
                           unsigned long maxnode) {
125
        return syscall(__NR_set_mempolicy, mode, nodemask, maxnode);
17✔
126
}
127

128
#  define set_mempolicy missing_set_mempolicy
129
#endif
130

131
#if !HAVE_GET_MEMPOLICY
132
static inline long missing_get_mempolicy(int *mode, unsigned long *nodemask,
19✔
133
                           unsigned long maxnode, void *addr,
134
                           unsigned long flags) {
135
        return syscall(__NR_get_mempolicy, mode, nodemask, maxnode, addr, flags);
19✔
136
}
137

138
#  define get_mempolicy missing_get_mempolicy
139
#endif
140

141
/* ======================================================================= */
142

143
#if !HAVE_PIDFD_SEND_SIGNAL
144
/* since kernel v5.1 (3eb39f47934f9d5a3027fe00d906a45fe3a15fad) */
145
static inline int missing_pidfd_send_signal(int fd, int sig, siginfo_t *info, unsigned flags) {
146
        return syscall(__NR_pidfd_send_signal, fd, sig, info, flags);
147
}
148

149
#  define pidfd_send_signal missing_pidfd_send_signal
150
#endif
151

152
/* ======================================================================= */
153

154
#if !HAVE_PIDFD_OPEN
155
/* since kernel v5.3 (7615d9e1780e26e0178c93c55b73309a5dc093d7) */
156
static inline int missing_pidfd_open(pid_t pid, unsigned flags) {
157
        return syscall(__NR_pidfd_open, pid, flags);
158
}
159

160
#  define pidfd_open missing_pidfd_open
161
#endif
162

163
/* ======================================================================= */
164

165
#if !HAVE_RT_TGSIGQUEUEINFO
166
static inline int missing_rt_tgsigqueueinfo(pid_t tgid, pid_t tid, int sig, siginfo_t *info) {
×
167
        return syscall(__NR_rt_tgsigqueueinfo, tgid, tid, sig, info);
×
168
}
169

170
#  define rt_tgsigqueueinfo missing_rt_tgsigqueueinfo
171
#endif
172

173
/* ======================================================================= */
174

175
#if !HAVE_EXECVEAT
176
/* since kernel v3.19 (51f39a1f0cea1cacf8c787f652f26dfee9611874) */
177
static inline int missing_execveat(int dirfd, const char *pathname,
178
                                   char *const argv[], char *const envp[],
179
                                   int flags) {
180
        return syscall(__NR_execveat, dirfd, pathname, argv, envp, flags);
181
}
182

183
#  define execveat missing_execveat
184
#endif
185

186
/* ======================================================================= */
187

188
#if !HAVE_CLOSE_RANGE
189
/* since kernel v5.9 (9b4feb630e8e9801603f3cab3a36369e3c1cf88d) */
190
static inline int missing_close_range(unsigned first_fd, unsigned end_fd, unsigned flags) {
191
        /* Kernel-side the syscall expects fds as unsigned integers (just like close() actually), while
192
         * userspace exclusively uses signed integers for fds. glibc chose to expose it 1:1 however, hence we
193
         * do so here too, even if we end up passing signed fds to it most of the time. */
194
        return syscall(__NR_close_range,
195
                       first_fd,
196
                       end_fd,
197
                       flags);
198
}
199

200
#  define close_range missing_close_range
201
#endif
202

203
/* ======================================================================= */
204

205
#if !HAVE_SCHED_SETATTR
206
/* since kernel 3.14 (e6cfc0295c7d51b008999a8b13a44fb43f8685ea) */
207
static inline ssize_t missing_sched_setattr(pid_t pid, struct sched_attr *attr, unsigned int flags) {
208
        return syscall(__NR_sched_setattr, pid, attr, flags);
209
}
210

211
#  define sched_setattr missing_sched_setattr
212
#endif
213

214
/* ======================================================================= */
215

216
/* glibc does not provide clone() on ia64, only clone2(). Not only that, but it also doesn't provide a
217
 * prototype, only the symbol in the shared library (it provides a prototype for clone(), but not the
218
 * symbol in the shared library). */
219
#if defined(__ia64__)
220
int __clone2(int (*fn)(void *), void *stack_base, size_t stack_size, int flags, void *arg);
221
#define HAVE_CLONE 0
222
#else
223
/* We know that everywhere else clone() is available, so we don't bother with a meson check (that takes time
224
 * at build time) and just define it. Once the kernel drops ia64 support, we can drop this too. */
225
#define HAVE_CLONE 1
226
#endif
227

228
/* ======================================================================= */
229

230
#if !HAVE_QUOTACTL_FD
231
/* since kernel v5.14 (64c2c2c62f92339b176ea24403d8db16db36f9e6) */
232
static inline int missing_quotactl_fd(int fd, int cmd, int id, void *addr) {
312✔
233
        return syscall(__NR_quotactl_fd, fd, cmd, id, addr);
312✔
234
}
235

236
#  define quotactl_fd missing_quotactl_fd
237
#endif
238

239
/* ======================================================================= */
240

241
#if !HAVE_SETXATTRAT
242
/* since kernel v6.13 (6140be90ec70c39fa844741ca3cc807dd0866394) */
243
struct xattr_args {
244
        _align_(8) uint64_t value;
245
        uint32_t size;
246
        uint32_t flags;
247
};
248

249
static inline int missing_setxattrat(int fd, const char *path, int at_flags, const char *name, const struct xattr_args *args, size_t size) {
1✔
250
        return syscall(__NR_setxattrat, fd, path, at_flags, name, args, size);
1✔
251
}
252

253
#  define setxattrat missing_setxattrat
254
#endif
255

256
/* ======================================================================= */
257

258
#if !HAVE_REMOVEXATTRAT
259
/* since kernel v6.13 (6140be90ec70c39fa844741ca3cc807dd0866394) */
260
static inline int missing_removexattrat(int fd, const char *path, int at_flags, const char *name) {
×
261
        return syscall(__NR_removexattrat, fd, path, at_flags, name);
×
262
}
263

264
#  define removexattrat missing_removexattrat
265
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc