]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/missing.h
networkd: add support to configure ip rule port range and protocol.
[thirdparty/systemd.git] / src / basic / missing.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
c2f1db8f 2#pragma once
b9f880f4
LP
3
4/* Missing glibc definitions to access certain kernel APIs */
5
3b794314 6#include <errno.h>
8ae4b6d1 7#include <fcntl.h>
d5dd44b0 8#include <inttypes.h>
875c2e22 9#include <linux/audit.h>
2822da4f 10#include <linux/capability.h>
43767d9d 11#include <linux/falloc.h>
926062f0 12#include <linux/fib_rules.h>
8ae4b6d1
TG
13#include <linux/if_link.h>
14#include <linux/input.h>
15#include <linux/loop.h>
cf1755ba 16#include <linux/neighbour.h>
8ae4b6d1
TG
17#include <linux/oom.h>
18#include <linux/rtnetlink.h>
43a6a52e 19#include <net/ethernet.h>
8ae4b6d1
TG
20#include <stdlib.h>
21#include <sys/resource.h>
4e0399e6 22#include <sys/socket.h>
4c2e1b39 23#include <sys/stat.h>
8ae4b6d1 24#include <sys/syscall.h>
c932fb71 25#include <uchar.h>
8ae4b6d1 26#include <unistd.h>
dd6c17b1 27
9c869d08 28#if WANT_LINUX_STAT_H
75720bff
FB
29#include <linux/stat.h>
30#endif
31
349cc4a5 32#if HAVE_AUDIT
dd6c17b1
LP
33#include <libaudit.h>
34#endif
b9f880f4 35
d59d0a2b 36#ifdef ARCH_MIPS
37#include <asm/sgidefs.h>
38#endif
39
349cc4a5 40#if HAVE_LINUX_BTRFS_H
700c6087
LP
41#include <linux/btrfs.h>
42#endif
43
349cc4a5 44#if HAVE_LINUX_VM_SOCKETS_H
4e0399e6
SH
45#include <linux/vm_sockets.h>
46#else
47#define VMADDR_CID_ANY -1U
48struct sockaddr_vm {
49 unsigned short svm_family;
50 unsigned short svm_reserved1;
51 unsigned int svm_port;
52 unsigned int svm_cid;
53 unsigned char svm_zero[sizeof(struct sockaddr) -
54 sizeof(unsigned short) -
55 sizeof(unsigned short) -
56 sizeof(unsigned int) -
57 sizeof(unsigned int)];
58};
59#endif /* !HAVE_LINUX_VM_SOCKETS_H */
60
b9f880f4
LP
61#ifndef RLIMIT_RTTIME
62#define RLIMIT_RTTIME 15
63#endif
64
517d56b1
LP
65/* If RLIMIT_RTTIME is not defined, then we cannot use RLIMIT_NLIMITS as is */
66#define _RLIMIT_MAX (RLIMIT_RTTIME+1 > RLIMIT_NLIMITS ? RLIMIT_RTTIME+1 : RLIMIT_NLIMITS)
67
4fd5948e
LP
68#ifndef F_LINUX_SPECIFIC_BASE
69#define F_LINUX_SPECIFIC_BASE 1024
70#endif
71
72#ifndef F_SETPIPE_SZ
73#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
74#endif
75
76#ifndef F_GETPIPE_SZ
77#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
78#endif
79
a6082d77
DM
80#ifndef F_ADD_SEALS
81#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
a6082d77 82#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
a6082d77 83
a6082d77 84#define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */
a6082d77 85#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
a6082d77 86#define F_SEAL_GROW 0x0004 /* prevent file from growing */
a6082d77
DM
87#define F_SEAL_WRITE 0x0008 /* prevent writes */
88#endif
89
f4a53250
MM
90#ifndef F_OFD_GETLK
91#define F_OFD_GETLK 36
92#define F_OFD_SETLK 37
93#define F_OFD_SETLKW 38
94#endif
95
a6082d77 96#ifndef MFD_ALLOW_SEALING
45071fca
LP
97#define MFD_ALLOW_SEALING 0x0002U
98#endif
99
100#ifndef MFD_CLOEXEC
101#define MFD_CLOEXEC 0x0001U
a6082d77
DM
102#endif
103
16c42ce1
KS
104#ifndef IP_FREEBIND
105#define IP_FREEBIND 15
106#endif
107
dd6c17b1
LP
108#ifndef OOM_SCORE_ADJ_MIN
109#define OOM_SCORE_ADJ_MIN (-1000)
110#endif
111
112#ifndef OOM_SCORE_ADJ_MAX
113#define OOM_SCORE_ADJ_MAX 1000
114#endif
15ae422b 115
4927fcae 116#ifndef AUDIT_SERVICE_START
dd6c17b1 117#define AUDIT_SERVICE_START 1130 /* Service (daemon) start */
4927fcae
LP
118#endif
119
120#ifndef AUDIT_SERVICE_STOP
dd6c17b1 121#define AUDIT_SERVICE_STOP 1131 /* Service (daemon) stop */
4927fcae
LP
122#endif
123
6ea832a2
LP
124#ifndef TIOCVHANGUP
125#define TIOCVHANGUP 0x5437
126#endif
127
b90865ba
KS
128#ifndef IP_TRANSPARENT
129#define IP_TRANSPARENT 19
130#endif
131
66269b05
TG
132#ifndef SOL_NETLINK
133#define SOL_NETLINK 270
134#endif
135
9c5a882b
TG
136#ifndef NETLINK_LIST_MEMBERSHIPS
137#define NETLINK_LIST_MEMBERSHIPS 9
138#endif
139
62bc4efc
SS
140#ifndef SOL_SCTP
141#define SOL_SCTP 132
142#endif
143
97768fc5
LP
144#ifndef GRND_NONBLOCK
145#define GRND_NONBLOCK 0x0001
146#endif
147
148#ifndef GRND_RANDOM
149#define GRND_RANDOM 0x0002
150#endif
151
0f3be6ca
LP
152#ifndef FS_NOCOW_FL
153#define FS_NOCOW_FL 0x00800000
154#endif
155
4b357e15
MM
156#ifndef BTRFS_IOCTL_MAGIC
157#define BTRFS_IOCTL_MAGIC 0x94
158#endif
159
160#ifndef BTRFS_PATH_NAME_MAX
161#define BTRFS_PATH_NAME_MAX 4087
162#endif
163
164#ifndef BTRFS_DEVICE_PATH_NAME_MAX
165#define BTRFS_DEVICE_PATH_NAME_MAX 1024
166#endif
167
168#ifndef BTRFS_FSID_SIZE
169#define BTRFS_FSID_SIZE 16
170#endif
171
172#ifndef BTRFS_UUID_SIZE
173#define BTRFS_UUID_SIZE 16
174#endif
175
8e8ba792
MO
176#ifndef BTRFS_SUBVOL_RDONLY
177#define BTRFS_SUBVOL_RDONLY (1ULL << 1)
178#endif
179
180#ifndef BTRFS_SUBVOL_NAME_MAX
181#define BTRFS_SUBVOL_NAME_MAX 4039
182#endif
183
184#ifndef BTRFS_INO_LOOKUP_PATH_MAX
185#define BTRFS_INO_LOOKUP_PATH_MAX 4080
186#endif
187
188#ifndef BTRFS_SEARCH_ARGS_BUFSIZE
189#define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key))
190#endif
191
3f952f92
LP
192#ifndef BTRFS_QGROUP_LEVEL_SHIFT
193#define BTRFS_QGROUP_LEVEL_SHIFT 48
194#endif
195
349cc4a5 196#if ! HAVE_LINUX_BTRFS_H
122b7907
HGB
197#define BTRFS_IOC_QGROUP_ASSIGN _IOW(BTRFS_IOCTL_MAGIC, 41, \
198 struct btrfs_ioctl_qgroup_assign_args)
199#define BTRFS_IOC_QGROUP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 42, \
200 struct btrfs_ioctl_qgroup_create_args)
201#define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \
202 struct btrfs_ioctl_quota_rescan_args)
203#define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \
204 struct btrfs_ioctl_quota_rescan_args)
205
206struct btrfs_ioctl_quota_rescan_args {
207 __u64 flags;
208 __u64 progress;
209 __u64 reserved[6];
210};
211
212struct btrfs_ioctl_qgroup_assign_args {
213 __u64 assign;
214 __u64 src;
215 __u64 dst;
216};
217
218struct btrfs_ioctl_qgroup_create_args {
219 __u64 create;
220 __u64 qgroupid;
221};
222
4b357e15
MM
223struct btrfs_ioctl_vol_args {
224 int64_t fd;
225 char name[BTRFS_PATH_NAME_MAX + 1];
226};
227
8e8ba792
MO
228struct btrfs_qgroup_limit {
229 __u64 flags;
230 __u64 max_rfer;
231 __u64 max_excl;
232 __u64 rsv_rfer;
233 __u64 rsv_excl;
234};
235
236struct btrfs_qgroup_inherit {
237 __u64 flags;
238 __u64 num_qgroups;
239 __u64 num_ref_copies;
240 __u64 num_excl_copies;
241 struct btrfs_qgroup_limit lim;
242 __u64 qgroups[0];
243};
244
d97fb408
MO
245struct btrfs_ioctl_qgroup_limit_args {
246 __u64 qgroupid;
247 struct btrfs_qgroup_limit lim;
248};
249
8e8ba792
MO
250struct btrfs_ioctl_vol_args_v2 {
251 __s64 fd;
252 __u64 transid;
253 __u64 flags;
254 union {
255 struct {
256 __u64 size;
257 struct btrfs_qgroup_inherit *qgroup_inherit;
258 };
259 __u64 unused[4];
260 };
261 char name[BTRFS_SUBVOL_NAME_MAX + 1];
262};
263
4b357e15
MM
264struct btrfs_ioctl_dev_info_args {
265 uint64_t devid; /* in/out */
266 uint8_t uuid[BTRFS_UUID_SIZE]; /* in/out */
267 uint64_t bytes_used; /* out */
268 uint64_t total_bytes; /* out */
269 uint64_t unused[379]; /* pad to 4k */
270 char path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */
271};
272
273struct btrfs_ioctl_fs_info_args {
274 uint64_t max_id; /* out */
275 uint64_t num_devices; /* out */
276 uint8_t fsid[BTRFS_FSID_SIZE]; /* out */
277 uint64_t reserved[124]; /* pad to 1k */
278};
8e8ba792
MO
279
280struct btrfs_ioctl_ino_lookup_args {
281 __u64 treeid;
282 __u64 objectid;
283 char name[BTRFS_INO_LOOKUP_PATH_MAX];
284};
285
286struct btrfs_ioctl_search_key {
287 /* which root are we searching. 0 is the tree of tree roots */
288 __u64 tree_id;
289
290 /* keys returned will be >= min and <= max */
291 __u64 min_objectid;
292 __u64 max_objectid;
293
294 /* keys returned will be >= min and <= max */
295 __u64 min_offset;
296 __u64 max_offset;
297
298 /* max and min transids to search for */
299 __u64 min_transid;
300 __u64 max_transid;
301
302 /* keys returned will be >= min and <= max */
303 __u32 min_type;
304 __u32 max_type;
305
306 /*
307 * how many items did userland ask for, and how many are we
308 * returning
309 */
310 __u32 nr_items;
311
312 /* align to 64 bits */
313 __u32 unused;
314
315 /* some extra for later */
316 __u64 unused1;
317 __u64 unused2;
318 __u64 unused3;
319 __u64 unused4;
320};
321
322struct btrfs_ioctl_search_header {
323 __u64 transid;
324 __u64 objectid;
325 __u64 offset;
326 __u32 type;
327 __u32 len;
328};
329
8e8ba792
MO
330struct btrfs_ioctl_search_args {
331 struct btrfs_ioctl_search_key key;
332 char buf[BTRFS_SEARCH_ARGS_BUFSIZE];
333};
334
335struct btrfs_ioctl_clone_range_args {
336 __s64 src_fd;
337 __u64 src_offset, src_length;
338 __u64 dest_offset;
339};
d97fb408
MO
340
341#define BTRFS_QUOTA_CTL_ENABLE 1
342#define BTRFS_QUOTA_CTL_DISABLE 2
343#define BTRFS_QUOTA_CTL_RESCAN__NOTUSED 3
344struct btrfs_ioctl_quota_ctl_args {
345 __u64 cmd;
346 __u64 status;
347};
4b357e15
MM
348#endif
349
350#ifndef BTRFS_IOC_DEFRAG
7bed7f0e
ZJS
351#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
352 struct btrfs_ioctl_vol_args)
4b357e15
MM
353#endif
354
d97fb408
MO
355#ifndef BTRFS_IOC_RESIZE
356#define BTRFS_IOC_RESIZE _IOW(BTRFS_IOCTL_MAGIC, 3, \
357 struct btrfs_ioctl_vol_args)
358#endif
359
8e8ba792
MO
360#ifndef BTRFS_IOC_CLONE
361#define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int)
362#endif
363
364#ifndef BTRFS_IOC_CLONE_RANGE
365#define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \
366 struct btrfs_ioctl_clone_range_args)
367#endif
368
369#ifndef BTRFS_IOC_SUBVOL_CREATE
370#define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, \
371 struct btrfs_ioctl_vol_args)
372#endif
373
374#ifndef BTRFS_IOC_SNAP_DESTROY
375#define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \
376 struct btrfs_ioctl_vol_args)
377#endif
378
379#ifndef BTRFS_IOC_TREE_SEARCH
380#define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \
381 struct btrfs_ioctl_search_args)
382#endif
383
384#ifndef BTRFS_IOC_INO_LOOKUP
385#define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \
386 struct btrfs_ioctl_ino_lookup_args)
387#endif
388
389#ifndef BTRFS_IOC_SNAP_CREATE_V2
390#define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \
391 struct btrfs_ioctl_vol_args_v2)
392#endif
393
394#ifndef BTRFS_IOC_SUBVOL_GETFLAGS
395#define BTRFS_IOC_SUBVOL_GETFLAGS _IOR(BTRFS_IOCTL_MAGIC, 25, __u64)
396#endif
397
398#ifndef BTRFS_IOC_SUBVOL_SETFLAGS
399#define BTRFS_IOC_SUBVOL_SETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 26, __u64)
400#endif
401
4b357e15
MM
402#ifndef BTRFS_IOC_DEV_INFO
403#define BTRFS_IOC_DEV_INFO _IOWR(BTRFS_IOCTL_MAGIC, 30, \
404 struct btrfs_ioctl_dev_info_args)
405#endif
406
407#ifndef BTRFS_IOC_FS_INFO
408#define BTRFS_IOC_FS_INFO _IOR(BTRFS_IOCTL_MAGIC, 31, \
7bed7f0e
ZJS
409 struct btrfs_ioctl_fs_info_args)
410#endif
411
412#ifndef BTRFS_IOC_DEVICES_READY
413#define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, \
414 struct btrfs_ioctl_vol_args)
4b357e15
MM
415#endif
416
d97fb408
MO
417#ifndef BTRFS_IOC_QUOTA_CTL
418#define BTRFS_IOC_QUOTA_CTL _IOWR(BTRFS_IOCTL_MAGIC, 40, \
419 struct btrfs_ioctl_quota_ctl_args)
420#endif
421
422#ifndef BTRFS_IOC_QGROUP_LIMIT
423#define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, \
424 struct btrfs_ioctl_qgroup_limit_args)
425#endif
426
306578e5
SS
427#ifndef BTRFS_IOC_QUOTA_RESCAN_WAIT
428#define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46)
429#endif
430
10f9c755
LP
431#ifndef BTRFS_FIRST_FREE_OBJECTID
432#define BTRFS_FIRST_FREE_OBJECTID 256
433#endif
434
d9e2daaf
LP
435#ifndef BTRFS_LAST_FREE_OBJECTID
436#define BTRFS_LAST_FREE_OBJECTID -256ULL
437#endif
438
b6b18498
LP
439#ifndef BTRFS_ROOT_TREE_OBJECTID
440#define BTRFS_ROOT_TREE_OBJECTID 1
441#endif
442
443#ifndef BTRFS_QUOTA_TREE_OBJECTID
444#define BTRFS_QUOTA_TREE_OBJECTID 8ULL
445#endif
446
10f9c755
LP
447#ifndef BTRFS_ROOT_ITEM_KEY
448#define BTRFS_ROOT_ITEM_KEY 132
449#endif
450
b6b18498
LP
451#ifndef BTRFS_QGROUP_STATUS_KEY
452#define BTRFS_QGROUP_STATUS_KEY 240
453#endif
454
455#ifndef BTRFS_QGROUP_INFO_KEY
456#define BTRFS_QGROUP_INFO_KEY 242
457#endif
458
459#ifndef BTRFS_QGROUP_LIMIT_KEY
460#define BTRFS_QGROUP_LIMIT_KEY 244
461#endif
462
5bcd08db
LP
463#ifndef BTRFS_QGROUP_RELATION_KEY
464#define BTRFS_QGROUP_RELATION_KEY 246
465#endif
466
d9e2daaf
LP
467#ifndef BTRFS_ROOT_BACKREF_KEY
468#define BTRFS_ROOT_BACKREF_KEY 144
469#endif
470
746f8906
LP
471#ifndef BTRFS_SUPER_MAGIC
472#define BTRFS_SUPER_MAGIC 0x9123683E
473#endif
474
efdb0237
LP
475#ifndef CGROUP_SUPER_MAGIC
476#define CGROUP_SUPER_MAGIC 0x27e0eb
477#endif
478
09961995
AC
479#ifndef CGROUP2_SUPER_MAGIC
480#define CGROUP2_SUPER_MAGIC 0x63677270
481#endif
482
3228995c
CB
483#ifndef CLONE_NEWCGROUP
484#define CLONE_NEWCGROUP 0x02000000
485#endif
486
efdb0237
LP
487#ifndef TMPFS_MAGIC
488#define TMPFS_MAGIC 0x01021994
489#endif
490
88cd066e
LP
491#ifndef MQUEUE_MAGIC
492#define MQUEUE_MAGIC 0x19800202
493#endif
494
87c05f36
DH
495#ifndef SECURITYFS_MAGIC
496#define SECURITYFS_MAGIC 0x73636673
497#endif
498
499#ifndef TRACEFS_MAGIC
500#define TRACEFS_MAGIC 0x74726163
501#endif
502
503#ifndef BPF_FS_MAGIC
504#define BPF_FS_MAGIC 0xcafe4a11
505#endif
506
77f9fa3b
LP
507#ifndef OCFS2_SUPER_MAGIC
508#define OCFS2_SUPER_MAGIC 0x7461636f
509#endif
510
94d82985
LP
511#ifndef MS_MOVE
512#define MS_MOVE 8192
513#endif
514
7ef71470
ZJS
515#ifndef MS_REC
516#define MS_REC 16384
517#endif
518
7cb1094a 519#ifndef MS_PRIVATE
7ef71470 520#define MS_PRIVATE (1<<18)
7cb1094a
HH
521#endif
522
7ef71470
ZJS
523#ifndef MS_REC
524#define MS_REC (1<<19)
525#endif
526
527#ifndef MS_SHARED
528#define MS_SHARED (1<<20)
529#endif
530
531#ifndef MS_RELATIME
532#define MS_RELATIME (1<<21)
533#endif
534
535#ifndef MS_KERNMOUNT
536#define MS_KERNMOUNT (1<<22)
537#endif
538
539#ifndef MS_I_VERSION
540#define MS_I_VERSION (1<<23)
54ecda32
LP
541#endif
542
48ac500b 543#ifndef MS_STRICTATIME
7ef71470 544#define MS_STRICTATIME (1<<24)
48ac500b
LP
545#endif
546
7ef71470
ZJS
547#ifndef MS_LAZYTIME
548#define MS_LAZYTIME (1<<25)
a9621528
AM
549#endif
550
7ef71470
ZJS
551#ifndef SCM_SECURITY
552#define SCM_SECURITY 0x03
a9621528
AM
553#endif
554
8351ceae
LP
555#ifndef PR_SET_NO_NEW_PRIVS
556#define PR_SET_NO_NEW_PRIVS 38
557#endif
d4447f4d
AK
558
559#ifndef PR_SET_CHILD_SUBREAPER
560#define PR_SET_CHILD_SUBREAPER 36
561#endif
a8348796 562
80ebe5c2
HGB
563#ifndef PR_SET_MM_ARG_START
564#define PR_SET_MM_ARG_START 8
565#endif
566
567#ifndef PR_SET_MM_ARG_END
568#define PR_SET_MM_ARG_END 9
569#endif
570
571#ifndef PR_SET_MM_ENV_START
572#define PR_SET_MM_ENV_START 10
573#endif
574
575#ifndef PR_SET_MM_ENV_END
576#define PR_SET_MM_ENV_END 11
577#endif
578
1381f244
HGB
579#ifndef EFIVARFS_MAGIC
580#define EFIVARFS_MAGIC 0xde5e81e4
581#endif
582
8cbe9f06
HGB
583#ifndef SMACK_MAGIC
584#define SMACK_MAGIC 0x43415d53
585#endif
586
ffc01f06
HGB
587#ifndef DM_DEFERRED_REMOVE
588#define DM_DEFERRED_REMOVE (1 << 17)
589#endif
590
56766f99
HGB
591#ifndef MAX_HANDLE_SZ
592#define MAX_HANDLE_SZ 128
593#endif
594
349cc4a5
ZJS
595#if ! HAVE_SECURE_GETENV
596# if HAVE___SECURE_GETENV
4db17f29
ZJS
597# define secure_getenv __secure_getenv
598# else
66330455 599# error "neither secure_getenv nor __secure_getenv are available"
4db17f29
ZJS
600# endif
601#endif
85210bff
LP
602
603#ifndef CIFS_MAGIC_NUMBER
65b3903f 604# define CIFS_MAGIC_NUMBER 0xFF534D42
85210bff 605#endif
8742514c
LP
606
607#ifndef TFD_TIMER_CANCEL_ON_SET
65b3903f 608# define TFD_TIMER_CANCEL_ON_SET (1 << 1)
8742514c 609#endif
f7db7a69
SL
610
611#ifndef SO_REUSEPORT
65b3903f 612# define SO_REUSEPORT 15
f7db7a69 613#endif
118ecf32 614
43f2c88d
LP
615#ifndef SO_PEERGROUPS
616# define SO_PEERGROUPS 59
617#endif
618
118ecf32 619#ifndef EVIOCREVOKE
65b3903f 620# define EVIOCREVOKE _IOW('E', 0x91, int)
118ecf32
DH
621#endif
622
d5dd44b0
LP
623#ifndef EVIOCSMASK
624
625struct input_mask {
626 uint32_t type;
627 uint32_t codes_size;
628 uint64_t codes_ptr;
629};
630
631#define EVIOCSMASK _IOW('E', 0x93, struct input_mask)
632#endif
633
118ecf32 634#ifndef DRM_IOCTL_SET_MASTER
65b3903f 635# define DRM_IOCTL_SET_MASTER _IO('d', 0x1e)
118ecf32
DH
636#endif
637
638#ifndef DRM_IOCTL_DROP_MASTER
65b3903f
ZJS
639# define DRM_IOCTL_DROP_MASTER _IO('d', 0x1f)
640#endif
641
daad709a
YM
642/* The precise definition of __O_TMPFILE is arch specific; use the
643 * values defined by the kernel (note: some are hexa, some are octal,
644 * duplicated as-is from the kernel definitions):
645 * - alpha, parisc, sparc: each has a specific value;
646 * - others: they use the "generic" value.
647 */
c09918f9
LP
648
649#ifndef __O_TMPFILE
daad709a
YM
650#if defined(__alpha__)
651#define __O_TMPFILE 0100000000
652#elif defined(__parisc__) || defined(__hppa__)
653#define __O_TMPFILE 0400000000
654#elif defined(__sparc__) || defined(__sparc64__)
655#define __O_TMPFILE 0x2000000
656#else
c09918f9
LP
657#define __O_TMPFILE 020000000
658#endif
d5df18e4 659#endif
c09918f9
LP
660
661/* a horrid kludge trying to make sure that this will fail on old kernels */
662#ifndef O_TMPFILE
663#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
664#endif
665
4b9545f1 666#if !HAVE_LO_FLAGS_PARTSCAN
5f381b35
LP
667#define LO_FLAGS_PARTSCAN 8
668#endif
a853c45d
LP
669
670#ifndef LOOP_CTL_REMOVE
671#define LOOP_CTL_REMOVE 0x4C81
672#endif
673
674#ifndef LOOP_CTL_GET_FREE
675#define LOOP_CTL_GET_FREE 0x4C82
676#endif
0830ba61 677
4b9545f1 678#if !HAVE_IFLA_INET6_ADDR_GEN_MODE
84dd59b5
DH
679#define IFLA_INET6_UNSPEC 0
680#define IFLA_INET6_FLAGS 1
681#define IFLA_INET6_CONF 2
682#define IFLA_INET6_STATS 3
683#define IFLA_INET6_MCAST 4
684#define IFLA_INET6_CACHEINFO 5
685#define IFLA_INET6_ICMP6STATS 6
686#define IFLA_INET6_TOKEN 7
687#define IFLA_INET6_ADDR_GEN_MODE 8
688#define __IFLA_INET6_MAX 9
689
3282493a 690#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
84dd59b5
DH
691
692#define IN6_ADDR_GEN_MODE_EUI64 0
693#define IN6_ADDR_GEN_MODE_NONE 1
f4f5e50a
AJ
694#endif
695
4b9545f1 696#if !HAVE_IN6_ADDR_GEN_MODE_STABLE_PRIVACY
fbc38f23 697#define IN6_ADDR_GEN_MODE_STABLE_PRIVACY 2
84dd59b5
DH
698#endif
699
4b9545f1 700#if !HAVE_IFLA_MACVLAN_FLAGS
75616a13
ZJS
701#define IFLA_MACVLAN_UNSPEC 0
702#define IFLA_MACVLAN_MODE 1
703#define IFLA_MACVLAN_FLAGS 2
704#define __IFLA_MACVLAN_MAX 3
705
706#define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1)
707#endif
708
d384826f 709#if !HAVE_IFLA_IPVLAN_FLAGS
c4a5ddc9
TG
710#define IFLA_IPVLAN_UNSPEC 0
711#define IFLA_IPVLAN_MODE 1
d384826f
SS
712#define IFLA_IPVLAN_FLAGS 2
713#define __IFLA_IPVLAN_MAX 3
c4a5ddc9
TG
714
715#define IFLA_IPVLAN_MAX (__IFLA_IPVLAN_MAX - 1)
716
717#define IPVLAN_MODE_L2 0
718#define IPVLAN_MODE_L3 1
d384826f 719#define IPVLAN_MODE_L3S 2
c4a5ddc9
TG
720#define IPVLAN_MAX 2
721#endif
722
d384826f
SS
723#if !HAVE_IPVLAN_F_PRIVATE
724#define IPVLAN_F_PRIVATE 0x01
725#define IPVLAN_F_VEPA 0x02
726#define __IPVLAN_F_PRIVATE_MAX 3
727
728#define HAVE_IPVLAN_F_PRIVATE_MAX (__HAVE_IPVLAN_F_PRIVATE_MAX - 1)
729#endif
730
4b9545f1 731#if !HAVE_IFLA_VTI_REMOTE
6589d0db
JAS
732#define IFLA_VTI_UNSPEC 0
733#define IFLA_VTI_LINK 1
734#define IFLA_VTI_IKEY 2
735#define IFLA_VTI_OKEY 3
736#define IFLA_VTI_LOCAL 4
737#define IFLA_VTI_REMOTE 5
738#define __IFLA_VTI_MAX 6
739
740#define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1)
741#endif
742
4b9545f1 743#if !HAVE_IFLA_PHYS_PORT_ID
bacef2a2 744#define IFLA_EXT_MASK 29
81577dc2
ZJS
745#undef IFLA_PROMISCUITY
746#define IFLA_PROMISCUITY 30
747#define IFLA_NUM_TX_QUEUES 31
748#define IFLA_NUM_RX_QUEUES 32
749#define IFLA_CARRIER 33
750#define IFLA_PHYS_PORT_ID 34
751#define __IFLA_MAX 35
752
753#define IFLA_MAX (__IFLA_MAX - 1)
754#endif
755
99f68ef0 756#if !HAVE_IFLA_BOND_AD_ACTOR_SYSTEM
81577dc2
ZJS
757#define IFLA_BOND_UNSPEC 0
758#define IFLA_BOND_MODE 1
759#define IFLA_BOND_ACTIVE_SLAVE 2
760#define IFLA_BOND_MIIMON 3
761#define IFLA_BOND_UPDELAY 4
762#define IFLA_BOND_DOWNDELAY 5
763#define IFLA_BOND_USE_CARRIER 6
764#define IFLA_BOND_ARP_INTERVAL 7
765#define IFLA_BOND_ARP_IP_TARGET 8
766#define IFLA_BOND_ARP_VALIDATE 9
767#define IFLA_BOND_ARP_ALL_TARGETS 10
768#define IFLA_BOND_PRIMARY 11
769#define IFLA_BOND_PRIMARY_RESELECT 12
770#define IFLA_BOND_FAIL_OVER_MAC 13
771#define IFLA_BOND_XMIT_HASH_POLICY 14
772#define IFLA_BOND_RESEND_IGMP 15
773#define IFLA_BOND_NUM_PEER_NOTIF 16
774#define IFLA_BOND_ALL_SLAVES_ACTIVE 17
775#define IFLA_BOND_MIN_LINKS 18
776#define IFLA_BOND_LP_INTERVAL 19
777#define IFLA_BOND_PACKETS_PER_SLAVE 20
778#define IFLA_BOND_AD_LACP_RATE 21
779#define IFLA_BOND_AD_SELECT 22
780#define IFLA_BOND_AD_INFO 23
99f68ef0
TJ
781#define IFLA_BOND_AD_ACTOR_SYS_PRIO 24
782#define IFLA_BOND_AD_USER_PORT_KEY 25
783#define IFLA_BOND_AD_ACTOR_SYSTEM 26
784#define __IFLA_BOND_MAX 27
0830ba61 785
79306206 786#define IFLA_BOND_MAX (__IFLA_BOND_MAX - 1)
0830ba61 787#endif
81577dc2 788
4b9545f1 789#if !HAVE_IFLA_VLAN_PROTOCOL
81577dc2
ZJS
790#define IFLA_VLAN_UNSPEC 0
791#define IFLA_VLAN_ID 1
792#define IFLA_VLAN_FLAGS 2
793#define IFLA_VLAN_EGRESS_QOS 3
794#define IFLA_VLAN_INGRESS_QOS 4
795#define IFLA_VLAN_PROTOCOL 5
796#define __IFLA_VLAN_MAX 6
797
798#define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1)
799#endif
800
4b9545f1 801#if !HAVE_IFLA_VXLAN_GPE
81577dc2
ZJS
802#define IFLA_VXLAN_UNSPEC 0
803#define IFLA_VXLAN_ID 1
804#define IFLA_VXLAN_GROUP 2
805#define IFLA_VXLAN_LINK 3
806#define IFLA_VXLAN_LOCAL 4
807#define IFLA_VXLAN_TTL 5
808#define IFLA_VXLAN_TOS 6
809#define IFLA_VXLAN_LEARNING 7
810#define IFLA_VXLAN_AGEING 8
811#define IFLA_VXLAN_LIMIT 9
812#define IFLA_VXLAN_PORT_RANGE 10
813#define IFLA_VXLAN_PROXY 11
814#define IFLA_VXLAN_RSC 12
815#define IFLA_VXLAN_L2MISS 13
816#define IFLA_VXLAN_L3MISS 14
817#define IFLA_VXLAN_PORT 15
818#define IFLA_VXLAN_GROUP6 16
819#define IFLA_VXLAN_LOCAL6 17
583c14fc
MO
820#define IFLA_VXLAN_UDP_CSUM 18
821#define IFLA_VXLAN_UDP_ZERO_CSUM6_TX 19
822#define IFLA_VXLAN_UDP_ZERO_CSUM6_RX 20
823#define IFLA_VXLAN_REMCSUM_TX 21
824#define IFLA_VXLAN_REMCSUM_RX 22
825#define IFLA_VXLAN_GBP 23
826#define IFLA_VXLAN_REMCSUM_NOPARTIAL 24
015e1916
SS
827#define IFLA_VXLAN_COLLECT_METADATA 25
828#define IFLA_VXLAN_LABEL 26
829#define IFLA_VXLAN_GPE 27
830
831#define __IFLA_VXLAN_MAX 28
81577dc2
ZJS
832
833#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
834#endif
835
4b9545f1 836#if !HAVE_IFLA_GENEVE_LABEL
d0780ca9
SS
837#define IFLA_GENEVE_UNSPEC 0
838#define IFLA_GENEVE_ID 1
839#define IFLA_GENEVE_REMOTE 2
840#define IFLA_GENEVE_TTL 3
841#define IFLA_GENEVE_TOS 4
842#define IFLA_GENEVE_PORT 5
843#define IFLA_GENEVE_COLLECT_METADATA 6
844#define IFLA_GENEVE_REMOTE6 7
845#define IFLA_GENEVE_UDP_CSUM 8
846#define IFLA_GENEVE_UDP_ZERO_CSUM6_TX 9
847#define IFLA_GENEVE_UDP_ZERO_CSUM6_RX 10
848#define IFLA_GENEVE_LABEL 11
849
850#define __IFLA_GENEVE_MAX 12
851
852#define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1)
853#endif
854
4b9545f1 855#if !HAVE_IFLA_IPTUN_ENCAP_DPORT
81577dc2
ZJS
856#define IFLA_IPTUN_UNSPEC 0
857#define IFLA_IPTUN_LINK 1
858#define IFLA_IPTUN_LOCAL 2
859#define IFLA_IPTUN_REMOTE 3
860#define IFLA_IPTUN_TTL 4
861#define IFLA_IPTUN_TOS 5
862#define IFLA_IPTUN_ENCAP_LIMIT 6
863#define IFLA_IPTUN_FLOWINFO 7
864#define IFLA_IPTUN_FLAGS 8
865#define IFLA_IPTUN_PROTO 9
866#define IFLA_IPTUN_PMTUDISC 10
867#define IFLA_IPTUN_6RD_PREFIX 11
868#define IFLA_IPTUN_6RD_RELAY_PREFIX 12
869#define IFLA_IPTUN_6RD_PREFIXLEN 13
870#define IFLA_IPTUN_6RD_RELAY_PREFIXLEN 14
56bf3853
SS
871#define IFLA_IPTUN_ENCAP_TYPE 15
872#define IFLA_IPTUN_ENCAP_FLAGS 16
873#define IFLA_IPTUN_ENCAP_SPORT 17
874#define IFLA_IPTUN_ENCAP_DPORT 18
875
876#define __IFLA_IPTUN_MAX 19
81577dc2
ZJS
877
878#define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1)
879#endif
880
2266864b 881#if !HAVE_IFLA_GRE_ERSPAN_HWID
66f4bc77
SS
882#define IFLA_GRE_UNSPEC 0
883#define IFLA_GRE_LINK 1
884#define IFLA_GRE_IFLAGS 2
885#define IFLA_GRE_OFLAGS 3
886#define IFLA_GRE_IKEY 4
887#define IFLA_GRE_OKEY 5
888#define IFLA_GRE_LOCAL 6
889#define IFLA_GRE_REMOTE 7
890#define IFLA_GRE_TTL 8
891#define IFLA_GRE_TOS 9
892#define IFLA_GRE_PMTUDISC 10
893#define IFLA_GRE_ENCAP_LIMIT 11
894#define IFLA_GRE_FLOWINFO 12
895#define IFLA_GRE_FLAGS 13
896#define IFLA_GRE_ENCAP_TYPE 14
897#define IFLA_GRE_ENCAP_FLAGS 15
898#define IFLA_GRE_ENCAP_SPORT 16
899#define IFLA_GRE_ENCAP_DPORT 17
2266864b
SS
900#define IFLA_GRE_COLLECT_METADATA 18
901#define IFLA_GRE_IGNORE_DF 19
902#define IFLA_GRE_FWMARK 20
903#define IFLA_GRE_ERSPAN_INDEX 21
904#define IFLA_GRE_ERSPAN_VER 22
905#define IFLA_GRE_ERSPAN_DIR 23
906#define IFLA_GRE_ERSPAN_HWID 24
907#define __IFLA_GRE_MAX 25
66f4bc77
SS
908
909#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1)
910#endif
911
4b9545f1 912#if !HAVE_IFLA_BRIDGE_VLAN_INFO
81577dc2
ZJS
913#define IFLA_BRIDGE_FLAGS 0
914#define IFLA_BRIDGE_MODE 1
915#define IFLA_BRIDGE_VLAN_INFO 2
916#define __IFLA_BRIDGE_MAX 3
917
918#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
919#endif
623a4c97 920
13b498f9
TJ
921#ifndef BRIDGE_VLAN_INFO_RANGE_BEGIN
922#define BRIDGE_VLAN_INFO_RANGE_BEGIN (1<<3) /* VLAN is start of vlan range */
923#endif
924
925#ifndef BRIDGE_VLAN_INFO_RANGE_END
926#define BRIDGE_VLAN_INFO_RANGE_END (1<<4) /* VLAN is end of vlan range */
927#endif
928
4b9545f1 929#if !HAVE_IFLA_BR_VLAN_DEFAULT_PVID
c3eae485
SS
930#define IFLA_BR_UNSPEC 0
931#define IFLA_BR_FORWARD_DELAY 1
932#define IFLA_BR_HELLO_TIME 2
933#define IFLA_BR_MAX_AGE 3
934#define IFLA_BR_AGEING_TIME 4
935#define IFLA_BR_STP_STATE 5
936#define IFLA_BR_PRIORITY 6
3fef7a3f
SS
937#define IFLA_BR_VLAN_FILTERING 7
938#define IFLA_BR_VLAN_PROTOCOL 8
939#define IFLA_BR_GROUP_FWD_MASK 9
940#define IFLA_BR_ROOT_ID 10
941#define IFLA_BR_BRIDGE_ID 11
942#define IFLA_BR_ROOT_PORT 12
943#define IFLA_BR_ROOT_PATH_COST 13
944#define IFLA_BR_TOPOLOGY_CHANGE 14
945#define IFLA_BR_TOPOLOGY_CHANGE_DETECTED 15
946#define IFLA_BR_HELLO_TIMER 16
947#define IFLA_BR_TCN_TIMER 17
948#define IFLA_BR_TOPOLOGY_CHANGE_TIMER 18
949#define IFLA_BR_GC_TIMER 19
950#define IFLA_BR_GROUP_ADDR 20
951#define IFLA_BR_FDB_FLUSH 21
952#define IFLA_BR_MCAST_ROUTER 22
953#define IFLA_BR_MCAST_SNOOPING 23
954#define IFLA_BR_MCAST_QUERY_USE_IFADDR 24
955#define IFLA_BR_MCAST_QUERIER 25
956#define IFLA_BR_MCAST_HASH_ELASTICITY 26
957#define IFLA_BR_MCAST_HASH_MAX 27
958#define IFLA_BR_MCAST_LAST_MEMBER_CNT 28
959#define IFLA_BR_MCAST_STARTUP_QUERY_CNT 29
960#define IFLA_BR_MCAST_LAST_MEMBER_INTVL 30
961#define IFLA_BR_MCAST_MEMBERSHIP_INTVL 31
962#define IFLA_BR_MCAST_QUERIER_INTVL 32
963#define IFLA_BR_MCAST_QUERY_INTVL 33
964#define IFLA_BR_MCAST_QUERY_RESPONSE_INTVL 34
965#define IFLA_BR_MCAST_STARTUP_QUERY_INTVL 35
966#define IFLA_BR_NF_CALL_IPTABLES 36
967#define IFLA_BR_NF_CALL_IP6TABLES 37
968#define IFLA_BR_NF_CALL_ARPTABLES 38
969#define IFLA_BR_VLAN_DEFAULT_PVID 39
970#define __IFLA_BR_MAX 40
c3eae485
SS
971
972#define IFLA_BR_MAX (__IFLA_BR_MAX - 1)
973#endif
974
4b9545f1 975#if !HAVE_IFLA_BRPORT_LEARNING_SYNC
8ecec322
ZJS
976#define IFLA_BRPORT_UNSPEC 0
977#define IFLA_BRPORT_STATE 1
978#define IFLA_BRPORT_PRIORITY 2
979#define IFLA_BRPORT_COST 3
980#define IFLA_BRPORT_MODE 4
981#define IFLA_BRPORT_GUARD 5
982#define IFLA_BRPORT_PROTECT 6
983#define IFLA_BRPORT_FAST_LEAVE 7
984#define IFLA_BRPORT_LEARNING 8
985#define IFLA_BRPORT_UNICAST_FLOOD 9
38a0245f
SS
986#define IFLA_BRPORT_LEARNING_SYNC 11
987#define __IFLA_BRPORT_MAX 12
8ecec322
ZJS
988
989#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
990#endif
991
926062f0 992#if !HAVE_FRA_DPORT_RANGE
bce67bbe
SS
993#define FRA_UNSPEC 0
994#define FRA_DST 1
995#define FRA_SRC 2
996#define FRA_IIFNAME 3
997#define FRA_GOTO 4
998#define FRA_UNUSED2 5
999#define FRA_PRIORITY 6
1000#define FRA_UNUSED3 7
1001#define FRA_UNUSED4 8
1002#define FRA_UNUSED5 9
1003#define FRA_FWMARK 10
1004#define FRA_FLOW 11
1005#define FRA_TUN_ID 12
1006#define FRA_SUPPRESS_IFGROUP 13
1007#define FRA_SUPPRESS_PREFIXLEN 14
1008#define FRA_TABLE 15
1009#define FRA_FWMASK 16
1010#define FRA_OIFNAME 17
1011#define FRA_PAD 18
1012#define FRA_L3MDEV 19
1013#define FRA_UID_RANGE 20
926062f0
SS
1014#define FRA_PROTOCOL 21
1015#define FRA_IP_PROTO 22
1016#define FRA_SPORT_RANGE 23
1017#define FRA_DPORT_RANGE 24
1018#define __FRA_MAX 25
bce67bbe
SS
1019
1020#define FRA_MAX (__FRA_MAX - 1)
1021#endif
1022
4b9545f1 1023#if !HAVE_IFLA_BRPORT_PROXYARP
26c34ab4
DM
1024#define IFLA_BRPORT_PROXYARP 10
1025#endif
1026
4b9545f1 1027#if !HAVE_IFLA_VRF_TABLE
20897a0d
AR
1028#define IFLA_VRF_TABLE 1
1029#endif
1030
d6df583c
SS
1031#if !HAVE_VXCAN_INFO_PEER
1032#define VXCAN_INFO_PEER 1
1033#endif
1034
4b9545f1 1035#if !HAVE_NDA_IFINDEX
cf1755ba
MO
1036#define NDA_UNSPEC 0
1037#define NDA_DST 1
1038#define NDA_LLADDR 2
1039#define NDA_CACHEINFO 3
1040#define NDA_PROBES 4
1041#define NDA_VLAN 5
1042#define NDA_PORT 6
1043#define NDA_VNI 7
1044#define NDA_IFINDEX 8
1045#define __NDA_MAX 9
1046
1047#define NDA_MAX (__NDA_MAX - 1)
1048#endif
1049
b69015ef
TG
1050#ifndef RTA_PREF
1051#define RTA_PREF 20
1052#endif
1053
ec79af69
M
1054#ifndef RTAX_QUICKACK
1055#define RTAX_QUICKACK 15
1056#endif
1057
f02ba163
DD
1058#ifndef RTA_EXPIRES
1059#define RTA_EXPIRES 23
1060#endif
1061
623a4c97
LP
1062#ifndef IPV6_UNICAST_IF
1063#define IPV6_UNICAST_IF 76
1064#endif
ec2c5e43 1065
439689c6
SS
1066#ifndef IPV6_MIN_MTU
1067#define IPV6_MIN_MTU 1280
1068#endif
1069
4d7c3570
LP
1070#ifndef IPV4_MIN_MTU
1071#define IPV4_MIN_MTU 68
1072#endif
1073
04d180c8
TG
1074#ifndef IFF_MULTI_QUEUE
1075#define IFF_MULTI_QUEUE 0x100
1076#endif
1077
ec2c5e43
LP
1078#ifndef IFF_LOWER_UP
1079#define IFF_LOWER_UP 0x10000
1080#endif
1081
1082#ifndef IFF_DORMANT
1083#define IFF_DORMANT 0x20000
1084#endif
91988149
LP
1085
1086#ifndef BOND_XMIT_POLICY_ENCAP23
1087#define BOND_XMIT_POLICY_ENCAP23 3
1088#endif
1089
1090#ifndef BOND_XMIT_POLICY_ENCAP34
1091#define BOND_XMIT_POLICY_ENCAP34 4
1092#endif
04b67d49
TG
1093
1094#ifndef NET_ADDR_RANDOM
1095# define NET_ADDR_RANDOM 1
1096#endif
1097
1cb636d9
CW
1098#ifndef NET_NAME_UNKNOWN
1099# define NET_NAME_UNKNOWN 0
1100#endif
1101
04b67d49
TG
1102#ifndef NET_NAME_ENUM
1103# define NET_NAME_ENUM 1
1104#endif
1105
1106#ifndef NET_NAME_PREDICTABLE
1107# define NET_NAME_PREDICTABLE 2
1108#endif
1109
1110#ifndef NET_NAME_USER
1111# define NET_NAME_USER 3
1112#endif
1113
1114#ifndef NET_NAME_RENAMED
1115# define NET_NAME_RENAMED 4
1116#endif
7965435e
MO
1117
1118#ifndef BPF_XOR
1119# define BPF_XOR 0xa0
1120#endif
a5f03596
LP
1121
1122/* Note that LOOPBACK_IFINDEX is currently not exported by the
1123 * kernel/glibc, but hardcoded internally by the kernel. However, as
1124 * it is exported to userspace indirectly via rtnetlink and the
1125 * ioctls, and made use of widely we define it here too, in a way that
1126 * is compatible with the kernel's internal definition. */
1127#ifndef LOOPBACK_IFINDEX
1128#define LOOPBACK_IFINDEX 1
1129#endif
875c2e22 1130
4b9545f1 1131#if !HAVE_IFA_FLAGS
34f7b9f9
LP
1132#define IFA_FLAGS 8
1133#endif
1134
f217be19
DH
1135#ifndef IFA_F_MANAGETEMPADDR
1136#define IFA_F_MANAGETEMPADDR 0x100
1137#endif
1138
b06ac35c
AS
1139#ifndef IFA_F_NOPREFIXROUTE
1140#define IFA_F_NOPREFIXROUTE 0x200
1141#endif
1142
875c2e22
LP
1143#ifndef MAX_AUDIT_MESSAGE_LENGTH
1144#define MAX_AUDIT_MESSAGE_LENGTH 8970
1145#endif
1146
1147#ifndef AUDIT_NLGRP_MAX
1148#define AUDIT_NLGRP_READLOG 1
1149#endif
2822da4f
LP
1150
1151#ifndef CAP_MAC_OVERRIDE
1152#define CAP_MAC_OVERRIDE 32
1153#endif
1154
1155#ifndef CAP_MAC_ADMIN
1156#define CAP_MAC_ADMIN 33
1157#endif
1158
1159#ifndef CAP_SYSLOG
1160#define CAP_SYSLOG 34
1161#endif
1162
1163#ifndef CAP_WAKE_ALARM
1164#define CAP_WAKE_ALARM 35
1165#endif
1166
1167#ifndef CAP_BLOCK_SUSPEND
1168#define CAP_BLOCK_SUSPEND 36
1169#endif
1170
1171#ifndef CAP_AUDIT_READ
1172#define CAP_AUDIT_READ 37
1173#endif
60e1651a 1174
ebd93cb6
LP
1175#ifndef RENAME_NOREPLACE
1176#define RENAME_NOREPLACE (1 << 0)
1177#endif
f7ad54a3 1178
f7ad54a3
LP
1179#ifndef KCMP_FILE
1180#define KCMP_FILE 0
1181#endif
606df97b
PH
1182
1183#ifndef INPUT_PROP_POINTING_STICK
1184#define INPUT_PROP_POINTING_STICK 0x05
1185#endif
bd1acc9f
HG
1186
1187#ifndef INPUT_PROP_ACCELEROMETER
1188#define INPUT_PROP_ACCELEROMETER 0x06
1189#endif
e287086b 1190
ea7a562a
PH
1191#ifndef BTN_DPAD_UP
1192#define BTN_DPAD_UP 0x220
1193#define BTN_DPAD_RIGHT 0x223
1194#endif
1195
1196#ifndef KEY_ALS_TOGGLE
1197#define KEY_ALS_TOGGLE 0x230
1198#endif
1199
e287086b 1200typedef int32_t key_serial_t;
e287086b 1201
74dd6b51
LP
1202#ifndef KEYCTL_JOIN_SESSION_KEYRING
1203#define KEYCTL_JOIN_SESSION_KEYRING 1
1204#endif
1205
1206#ifndef KEYCTL_CHOWN
1207#define KEYCTL_CHOWN 4
1208#endif
1209
1210#ifndef KEYCTL_SETPERM
1211#define KEYCTL_SETPERM 5
1212#endif
1213
1214#ifndef KEYCTL_DESCRIBE
1215#define KEYCTL_DESCRIBE 6
1216#endif
1217
b1edf445
LP
1218#ifndef KEYCTL_LINK
1219#define KEYCTL_LINK 8
1220#endif
1221
e287086b
LP
1222#ifndef KEYCTL_READ
1223#define KEYCTL_READ 11
1224#endif
1225
1226#ifndef KEYCTL_SET_TIMEOUT
1227#define KEYCTL_SET_TIMEOUT 15
1228#endif
1229
74dd6b51
LP
1230#ifndef KEY_POS_VIEW
1231#define KEY_POS_VIEW 0x01000000
1232#define KEY_POS_READ 0x02000000
1233#define KEY_POS_WRITE 0x04000000
1234#define KEY_POS_SEARCH 0x08000000
1235#define KEY_POS_LINK 0x10000000
1236#define KEY_POS_SETATTR 0x20000000
1237
1238#define KEY_USR_VIEW 0x00010000
1239#define KEY_USR_READ 0x00020000
1240#define KEY_USR_WRITE 0x00040000
1241#define KEY_USR_SEARCH 0x00080000
1242#define KEY_USR_LINK 0x00100000
1243#define KEY_USR_SETATTR 0x00200000
1244
1245#define KEY_GRP_VIEW 0x00000100
1246#define KEY_GRP_READ 0x00000200
1247#define KEY_GRP_WRITE 0x00000400
1248#define KEY_GRP_SEARCH 0x00000800
1249#define KEY_GRP_LINK 0x00001000
1250#define KEY_GRP_SETATTR 0x00002000
1251
1252#define KEY_OTH_VIEW 0x00000001
1253#define KEY_OTH_READ 0x00000002
1254#define KEY_OTH_WRITE 0x00000004
1255#define KEY_OTH_SEARCH 0x00000008
1256#define KEY_OTH_LINK 0x00000010
1257#define KEY_OTH_SETATTR 0x00000020
1258#endif
1259
e287086b
LP
1260#ifndef KEY_SPEC_USER_KEYRING
1261#define KEY_SPEC_USER_KEYRING -4
1262#endif
755d4b67 1263
74dd6b51
LP
1264#ifndef KEY_SPEC_SESSION_KEYRING
1265#define KEY_SPEC_SESSION_KEYRING -3
1266#endif
1267
755d4b67
IP
1268#ifndef PR_CAP_AMBIENT
1269#define PR_CAP_AMBIENT 47
1270#endif
1271
1272#ifndef PR_CAP_AMBIENT_IS_SET
1273#define PR_CAP_AMBIENT_IS_SET 1
1274#endif
1275
1276#ifndef PR_CAP_AMBIENT_RAISE
1277#define PR_CAP_AMBIENT_RAISE 2
1278#endif
1279
1280#ifndef PR_CAP_AMBIENT_CLEAR_ALL
1281#define PR_CAP_AMBIENT_CLEAR_ALL 4
1282#endif
6955a3ba
LP
1283
1284/* The following two defines are actually available in the kernel headers for longer, but we define them here anyway,
1285 * since that makes it easier to use them in conjunction with the glibc net/if.h header which conflicts with
1286 * linux/if.h. */
1287#ifndef IF_OPER_UNKNOWN
1288#define IF_OPER_UNKNOWN 0
1289#endif
1290
1291#ifndef IF_OPER_UP
1292#define IF_OPER_UP 6
c932fb71 1293
349cc4a5 1294#if ! HAVE_CHAR32_T
c932fb71
SL
1295#define char32_t uint32_t
1296#endif
1297
349cc4a5 1298#if ! HAVE_CHAR16_T
c932fb71
SL
1299#define char16_t uint16_t
1300#endif
1301
43a6a52e
LP
1302#ifndef ETHERTYPE_LLDP
1303#define ETHERTYPE_LLDP 0x88cc
1304#endif
1305
e63be084
SS
1306#ifndef IFA_F_MCAUTOJOIN
1307#define IFA_F_MCAUTOJOIN 0x400
1308#endif
1309
349cc4a5 1310#if ! HAVE_STRUCT_FIB_RULE_UID_RANGE
bce67bbe
SS
1311
1312struct fib_rule_uid_range {
1313 __u32 start;
1314 __u32 end;
1315};
1316
1317#endif
1318
926062f0
SS
1319#if ! HAVE_STRUCT_FIB_RULE_PORT_RANGE
1320
1321struct fib_rule_port_range {
1322 __u16 start;
1323 __u16 end;
1324};
1325
1326#endif
1327
6955a3ba 1328#endif
1d4b557d 1329
0fe5f3c5
LP
1330#ifndef SOL_ALG
1331#define SOL_ALG 279
1332#endif
1333
4e0399e6
SH
1334#ifndef AF_VSOCK
1335#define AF_VSOCK 40
1336#endif
1337
80750adb
ZJS
1338#ifndef EXT4_IOC_RESIZE_FS
1339# define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64)
1340#endif
1341
d7bea6b6
DP
1342#ifndef NSFS_MAGIC
1343#define NSFS_MAGIC 0x6e736673
1344#endif
1345
1346#ifndef NS_GET_NSTYPE
1347#define NS_GET_NSTYPE _IO(0xb7, 0x3)
1348#endif
1349
43767d9d
LP
1350#ifndef FALLOC_FL_KEEP_SIZE
1351#define FALLOC_FL_KEEP_SIZE 0x01
1352#endif
1353
1354#ifndef FALLOC_FL_PUNCH_HOLE
1355#define FALLOC_FL_PUNCH_HOLE 0x02
1356#endif
1357
36b5119a
LP
1358#ifndef PF_KTHREAD
1359#define PF_KTHREAD 0x00200000
1360#endif
1361
4c2e1b39
LP
1362#if ! HAVE_STRUCT_STATX
1363struct statx_timestamp {
1364 int64_t tv_sec;
1365 uint32_t tv_nsec;
1366 uint32_t __reserved;
1367};
1368struct statx {
1369 uint32_t stx_mask;
1370 uint32_t stx_blksize;
1371 uint64_t stx_attributes;
1372 uint32_t stx_nlink;
1373 uint32_t stx_uid;
1374 uint32_t stx_gid;
1375 uint16_t stx_mode;
1376 uint16_t __spare0[1];
1377 uint64_t stx_ino;
1378 uint64_t stx_size;
1379 uint64_t stx_blocks;
1380 uint64_t stx_attributes_mask;
1381 struct statx_timestamp stx_atime;
1382 struct statx_timestamp stx_btime;
1383 struct statx_timestamp stx_ctime;
1384 struct statx_timestamp stx_mtime;
1385 uint32_t stx_rdev_major;
1386 uint32_t stx_rdev_minor;
1387 uint32_t stx_dev_major;
1388 uint32_t stx_dev_minor;
1389 uint64_t __spare2[14];
1390};
1391#endif
1392
1393#ifndef STATX_BTIME
1394#define STATX_BTIME 0x00000800U
1395#endif
1396
1397#ifndef AT_STATX_DONT_SYNC
1398#define AT_STATX_DONT_SYNC 0x4000
1399#endif
1400
92f14395
LP
1401/* The maximum thread/process name length including trailing NUL byte. This mimics the kernel definition of the same
1402 * name, which we need in userspace at various places but is not defined in userspace currently, neither under this
1403 * name nor any other. */
1404#ifndef TASK_COMM_LEN
1405#define TASK_COMM_LEN 16
1406#endif
1407
53cb501a
SS
1408#ifndef FOU_GENL_NAME
1409#define FOU_GENL_NAME "fou"
1410#endif
1411
1412#ifndef FOU_GENL_VERSION
1413#define FOU_GENL_VERSION 0x1
1414#endif
1415
80df8f25
YW
1416#if !HAVE_LINUX_FOU_H
1417#define FOU_ATTR_UNSPEC 0
1418#define FOU_ATTR_PORT 1
1419#define FOU_ATTR_AF 2
1420#define FOU_ATTR_IPPROTO 3
1421#define FOU_ATTR_TYPE 4
1422#endif
53cb501a 1423#if !HAVE_FOU_ATTR_REMCSUM_NOPARTIAL
53cb501a 1424#define FOU_ATTR_REMCSUM_NOPARTIAL 5
80df8f25
YW
1425#undef FOU_ATTR_MAX
1426#endif
1427#ifndef FOU_ATTR_MAX
1428#define FOU_ATTR_MAX 5
53cb501a
SS
1429#endif
1430
80df8f25
YW
1431#if !HAVE_LINUX_FOU_H
1432#define FOU_CMD_UNSPEC 0
1433#define FOU_CMD_ADD 1
1434#define FOU_CMD_DEL 2
1435#endif
53cb501a 1436#if !HAVE_FOU_CMD_GET
80df8f25
YW
1437#define FOU_CMD_GET 3
1438#undef FOU_CMD_MAX
1439#endif
1440#ifndef FOU_CMD_MAX
1441#define FOU_CMD_MAX 3
53cb501a
SS
1442#endif
1443
80df8f25
YW
1444#if !HAVE_LINUX_FOU_H
1445#define FOU_ENCAP_UNSPEC 0
1446#define FOU_ENCAP_DIRECT 1
1447#define FOU_ENCAP_GUE 2
1448#define __FOU_ENCAP_MAX 3
53cb501a
SS
1449
1450#define FOU_ENCAP_MAX (__FOU_ENCAP_MAX - 1)
1451#endif
1452
8a716f26 1453#if !HAVE_ETHTOOL_LINK_MODE_10baseT_Half_BIT /* linux@3f1ac7a700d039c61d8d8b99f28d605d489a60cf (4.6) */
59a2a18e
LP
1454
1455#define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */
1456#define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */
1457
8a716f26
YW
1458struct ethtool_link_settings {
1459 __u32 cmd;
1460 __u32 speed;
1461 __u8 duplex;
1462 __u8 port;
1463 __u8 phy_address;
1464 __u8 autoneg;
1465 __u8 mdio_support;
1466 __u8 eth_tp_mdix;
1467 __u8 eth_tp_mdix_ctrl;
1468 __s8 link_mode_masks_nwords;
1469 __u8 transceiver;
1470 __u8 reserved1[3];
1471 __u32 reserved[7];
1472 __u32 link_mode_masks[0];
1473 /* layout of link_mode_masks fields:
1474 * __u32 map_supported[link_mode_masks_nwords];
1475 * __u32 map_advertising[link_mode_masks_nwords];
1476 * __u32 map_lp_advertising[link_mode_masks_nwords];
1477 */
1478};
59a2a18e 1479
8a716f26
YW
1480enum ethtool_link_mode_bit_indices {
1481 ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0,
1482 ETHTOOL_LINK_MODE_10baseT_Full_BIT = 1,
1483 ETHTOOL_LINK_MODE_100baseT_Half_BIT = 2,
1484 ETHTOOL_LINK_MODE_100baseT_Full_BIT = 3,
1485 ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 4,
1486 ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 5,
1487 ETHTOOL_LINK_MODE_Autoneg_BIT = 6,
1488 ETHTOOL_LINK_MODE_TP_BIT = 7,
1489 ETHTOOL_LINK_MODE_AUI_BIT = 8,
1490 ETHTOOL_LINK_MODE_MII_BIT = 9,
1491 ETHTOOL_LINK_MODE_FIBRE_BIT = 10,
1492 ETHTOOL_LINK_MODE_BNC_BIT = 11,
1493 ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 12,
1494 ETHTOOL_LINK_MODE_Pause_BIT = 13,
1495 ETHTOOL_LINK_MODE_Asym_Pause_BIT = 14,
1496 ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 15,
1497 ETHTOOL_LINK_MODE_Backplane_BIT = 16,
1498 ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 17,
1499 ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 18,
1500 ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 19,
1501 ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 20,
1502 ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21,
1503 ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 22,
1504 ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 23,
1505 ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 24,
1506 ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 25,
1507 ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 26,
1508 ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 27,
1509 ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28,
1510 ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29,
1511 ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30,
1512 ETHTOOL_LINK_MODE_25000baseCR_Full_BIT = 31,
1513 ETHTOOL_LINK_MODE_25000baseKR_Full_BIT = 32,
1514 ETHTOOL_LINK_MODE_25000baseSR_Full_BIT = 33,
1515 ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT = 34,
1516 ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT = 35,
1517 ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT = 36,
1518 ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT = 37,
1519 ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT = 38,
1520 ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT = 39,
1521 ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT = 40,
1522 ETHTOOL_LINK_MODE_1000baseX_Full_BIT = 41,
1523 ETHTOOL_LINK_MODE_10000baseCR_Full_BIT = 42,
1524 ETHTOOL_LINK_MODE_10000baseSR_Full_BIT = 43,
1525 ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 44,
1526 ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 45,
1527 ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 46,
1528 ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47,
1529 ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48,
1530
1531 ETHTOOL_LINK_MODE_FEC_NONE_BIT = 49,
1532 ETHTOOL_LINK_MODE_FEC_RS_BIT = 50,
1533 ETHTOOL_LINK_MODE_FEC_BASER_BIT = 51,
1534
1535 /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit
1536 * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_*
1537 * macro for bits > 31. The only way to use indices > 31 is to
1538 * use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API.
1539 */
1540
1541 __ETHTOOL_LINK_MODE_LAST
1542 = ETHTOOL_LINK_MODE_FEC_BASER_BIT,
1543};
1544#else
1545#if !HAVE_ETHTOOL_LINK_MODE_25000baseCR_Full_BIT /* linux@3851112e4737cd52aaeda0ce8d084be9ee128106 (4.7) */
1546#define ETHTOOL_LINK_MODE_25000baseCR_Full_BIT 31
1547#define ETHTOOL_LINK_MODE_25000baseKR_Full_BIT 32
1548#define ETHTOOL_LINK_MODE_25000baseSR_Full_BIT 33
1549#define ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT 34
1550#define ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT 35
1551#define ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT 36
1552#define ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT 37
1553#define ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT 38
1554#define ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT 39
1555#endif
1556#if !HAVE_ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT /* linux@89da45b8b5b2187734a11038b8593714f964ffd1 (4.8) */
1557#define ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT 40
1558#endif
1559#if !HAVE_ETHTOOL_LINK_MODE_1000baseX_Full_BIT /* linux@5711a98221443aec54c4c81ee98c6ae46acccb65 (4.9) */
1560#define ETHTOOL_LINK_MODE_1000baseX_Full_BIT 41
1561#define ETHTOOL_LINK_MODE_10000baseCR_Full_BIT 42
1562#define ETHTOOL_LINK_MODE_10000baseSR_Full_BIT 43
1563#define ETHTOOL_LINK_MODE_10000baseLR_Full_BIT 44
1564#define ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT 45
1565#define ETHTOOL_LINK_MODE_10000baseER_Full_BIT 46
1566#endif
1567#if !HAVE_ETHTOOL_LINK_MODE_2500baseT_Full_BIT /* linux@94842b4fc4d6b1691cfc86c6f5251f299d27f4ba (4.10) */
1568#define ETHTOOL_LINK_MODE_2500baseT_Full_BIT 47
1569#define ETHTOOL_LINK_MODE_5000baseT_Full_BIT 48
1570#endif
1571#if !HAVE_ETHTOOL_LINK_MODE_FEC_NONE_BIT /* linux@1a5f3da20bd966220931239fbd31e6ac6ff42251 (4.14) */
1572#define ETHTOOL_LINK_MODE_FEC_NONE_BIT 49
1573#define ETHTOOL_LINK_MODE_FEC_RS_BIT 50
1574#define ETHTOOL_LINK_MODE_FEC_BASER_BIT 51
1575#endif
1576#endif
1577
2f368e4a 1578#include "missing_syscall.h"