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