diff --git a/meson.build b/meson.build index fe19dc63e8..1f44c0fe70 100644 --- a/meson.build +++ b/meson.build @@ -663,7 +663,7 @@ if not cc.has_header('sys/capability.h') error('POSIX caps headers not found') endif foreach header : ['crypt.h', - 'linux/btrfs.h', + 'linux/btrfs_tree.h', 'linux/fou.h', 'linux/memfd.h', 'linux/vm_sockets.h', diff --git a/src/analyze/analyze-security.c b/src/analyze/analyze-security.c index f8ba743f73..cdbe2b31c8 100644 --- a/src/analyze/analyze-security.c +++ b/src/analyze/analyze-security.c @@ -12,6 +12,7 @@ #include "in-addr-util.h" #include "locale-util.h" #include "macro.h" +#include "missing.h" #include "parse-util.h" #include "path-util.h" #include "pretty-print.h" diff --git a/src/basic/btrfs-ctree.h b/src/basic/btrfs-ctree.h deleted file mode 100644 index c5a4244e37..0000000000 --- a/src/basic/btrfs-ctree.h +++ /dev/null @@ -1,97 +0,0 @@ -#pragma once - -#include "macro.h" -#include "missing.h" -#include "sparse-endian.h" - -/* Stolen from btrfs' ctree.h */ - -struct btrfs_timespec { - le64_t sec; - le32_t nsec; -} _packed_; - -struct btrfs_disk_key { - le64_t objectid; - uint8_t type; - le64_t offset; -} _packed_; - -struct btrfs_inode_item { - le64_t generation; - le64_t transid; - le64_t size; - le64_t nbytes; - le64_t block_group; - le32_t nlink; - le32_t uid; - le32_t gid; - le32_t mode; - le64_t rdev; - le64_t flags; - le64_t sequence; - le64_t reserved[4]; - struct btrfs_timespec atime; - struct btrfs_timespec ctime; - struct btrfs_timespec mtime; - struct btrfs_timespec otime; -} _packed_; - -struct btrfs_root_item { - struct btrfs_inode_item inode; - le64_t generation; - le64_t root_dirid; - le64_t bytenr; - le64_t byte_limit; - le64_t bytes_used; - le64_t last_snapshot; - le64_t flags; - le32_t refs; - struct btrfs_disk_key drop_progress; - uint8_t drop_level; - uint8_t level; - le64_t generation_v2; - uint8_t uuid[BTRFS_UUID_SIZE]; - uint8_t parent_uuid[BTRFS_UUID_SIZE]; - uint8_t received_uuid[BTRFS_UUID_SIZE]; - le64_t ctransid; - le64_t otransid; - le64_t stransid; - le64_t rtransid; - struct btrfs_timespec ctime; - struct btrfs_timespec otime; - struct btrfs_timespec stime; - struct btrfs_timespec rtime; - le64_t reserved[8]; -} _packed_; - -#define BTRFS_ROOT_SUBVOL_RDONLY (1ULL << 0) - -struct btrfs_qgroup_info_item { - le64_t generation; - le64_t rfer; - le64_t rfer_cmpr; - le64_t excl; - le64_t excl_cmpr; -} _packed_; - -#define BTRFS_QGROUP_LIMIT_MAX_RFER (1ULL << 0) -#define BTRFS_QGROUP_LIMIT_MAX_EXCL (1ULL << 1) -#define BTRFS_QGROUP_LIMIT_RSV_RFER (1ULL << 2) -#define BTRFS_QGROUP_LIMIT_RSV_EXCL (1ULL << 3) -#define BTRFS_QGROUP_LIMIT_RFER_CMPR (1ULL << 4) -#define BTRFS_QGROUP_LIMIT_EXCL_CMPR (1ULL << 5) - -struct btrfs_qgroup_limit_item { - le64_t flags; - le64_t max_rfer; - le64_t max_excl; - le64_t rsv_rfer; - le64_t rsv_excl; -} _packed_; - -struct btrfs_root_ref { - le64_t dirid; - le64_t sequence; - le16_t name_len; -} _packed_; diff --git a/src/basic/btrfs-util.c b/src/basic/btrfs-util.c index cedce84e9c..d08e7546d0 100644 --- a/src/basic/btrfs-util.c +++ b/src/basic/btrfs-util.c @@ -15,13 +15,8 @@ #include #include -#if HAVE_LINUX_BTRFS_H -#include -#endif - #include "alloc-util.h" #include "blockdev-util.h" -#include "btrfs-ctree.h" #include "btrfs-util.h" #include "chattr-util.h" #include "copy.h" diff --git a/src/basic/capability-util.h b/src/basic/capability-util.h index e0e0b1c0fa..02c7d5c3e2 100644 --- a/src/basic/capability-util.h +++ b/src/basic/capability-util.h @@ -7,6 +7,7 @@ #include #include "macro.h" +#include "missing_capability.h" #include "util.h" #define CAP_ALL (uint64_t) -1 diff --git a/src/basic/escape.h b/src/basic/escape.h index 2e07c73b9e..515620993d 100644 --- a/src/basic/escape.h +++ b/src/basic/escape.h @@ -8,7 +8,7 @@ #include #include "string-util.h" -#include "missing.h" +#include "missing_type.h" /* What characters are special in the shell? */ /* must be escaped outside and inside double-quotes */ diff --git a/src/basic/meson.build b/src/basic/meson.build index 880c9b7eb1..153a38f9d0 100644 --- a/src/basic/meson.build +++ b/src/basic/meson.build @@ -17,7 +17,6 @@ basic_sources = files(''' audit-util.h blockdev-util.c blockdev-util.h - btrfs-ctree.h btrfs-util.c btrfs-util.h build.h @@ -92,7 +91,25 @@ basic_sources = files(''' memfd-util.h mempool.c mempool.h + missing_btrfs.h + missing_btrfs_tree.h + missing_capability.h + missing_ethtool.h + missing_fib_rules.h + missing_fou.h + missing_if_bridge.h + missing_if_link.h + missing_if_tunnel.h + missing_input.h + missing_keyctl.h + missing_magic.h + missing_network.h + missing_prctl.h + missing_securebits.h + missing_stat.h missing_syscall.h + missing_type.h + missing_vxcan.h mkdir-label.c mkdir.c mkdir.h @@ -124,7 +141,6 @@ basic_sources = files(''' replace-var.h rm-rf.c rm-rf.h - securebits.h selinux-util.c selinux-util.h set.h diff --git a/src/basic/missing.h b/src/basic/missing.h index 0bdbab1ee4..e3ee46bcce 100644 --- a/src/basic/missing.h +++ b/src/basic/missing.h @@ -7,23 +7,15 @@ #include #include #include -#include #include -#include #include #include #include #include #include -#include #include -#include #include -#if WANT_LINUX_STAT_H -#include -#endif - #if HAVE_AUDIT #include #endif @@ -32,10 +24,6 @@ #include #endif -#if HAVE_LINUX_BTRFS_H -#include -#endif - #if HAVE_LINUX_VM_SOCKETS_H #include #else @@ -148,361 +136,10 @@ struct sockaddr_vm { #define FS_NOCOW_FL 0x00800000 #endif -#ifndef BTRFS_IOCTL_MAGIC -#define BTRFS_IOCTL_MAGIC 0x94 -#endif - -#ifndef BTRFS_PATH_NAME_MAX -#define BTRFS_PATH_NAME_MAX 4087 -#endif - -#ifndef BTRFS_DEVICE_PATH_NAME_MAX -#define BTRFS_DEVICE_PATH_NAME_MAX 1024 -#endif - -#ifndef BTRFS_FSID_SIZE -#define BTRFS_FSID_SIZE 16 -#endif - -#ifndef BTRFS_UUID_SIZE -#define BTRFS_UUID_SIZE 16 -#endif - -#ifndef BTRFS_SUBVOL_RDONLY -#define BTRFS_SUBVOL_RDONLY (1ULL << 1) -#endif - -#ifndef BTRFS_SUBVOL_NAME_MAX -#define BTRFS_SUBVOL_NAME_MAX 4039 -#endif - -#ifndef BTRFS_INO_LOOKUP_PATH_MAX -#define BTRFS_INO_LOOKUP_PATH_MAX 4080 -#endif - -#ifndef BTRFS_SEARCH_ARGS_BUFSIZE -#define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key)) -#endif - -#ifndef BTRFS_QGROUP_LEVEL_SHIFT -#define BTRFS_QGROUP_LEVEL_SHIFT 48 -#endif - -#if !HAVE_LINUX_BTRFS_H -#define BTRFS_IOC_QGROUP_ASSIGN _IOW(BTRFS_IOCTL_MAGIC, 41, \ - struct btrfs_ioctl_qgroup_assign_args) -#define BTRFS_IOC_QGROUP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 42, \ - struct btrfs_ioctl_qgroup_create_args) -#define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \ - struct btrfs_ioctl_quota_rescan_args) -#define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \ - struct btrfs_ioctl_quota_rescan_args) - -struct btrfs_ioctl_quota_rescan_args { - __u64 flags; - __u64 progress; - __u64 reserved[6]; -}; - -struct btrfs_ioctl_qgroup_assign_args { - __u64 assign; - __u64 src; - __u64 dst; -}; - -struct btrfs_ioctl_qgroup_create_args { - __u64 create; - __u64 qgroupid; -}; - -struct btrfs_ioctl_vol_args { - int64_t fd; - char name[BTRFS_PATH_NAME_MAX + 1]; -}; - -struct btrfs_qgroup_limit { - __u64 flags; - __u64 max_rfer; - __u64 max_excl; - __u64 rsv_rfer; - __u64 rsv_excl; -}; - -struct btrfs_qgroup_inherit { - __u64 flags; - __u64 num_qgroups; - __u64 num_ref_copies; - __u64 num_excl_copies; - struct btrfs_qgroup_limit lim; - __u64 qgroups[0]; -}; - -struct btrfs_ioctl_qgroup_limit_args { - __u64 qgroupid; - struct btrfs_qgroup_limit lim; -}; - -struct btrfs_ioctl_vol_args_v2 { - __s64 fd; - __u64 transid; - __u64 flags; - union { - struct { - __u64 size; - struct btrfs_qgroup_inherit *qgroup_inherit; - }; - __u64 unused[4]; - }; - char name[BTRFS_SUBVOL_NAME_MAX + 1]; -}; - -struct btrfs_ioctl_dev_info_args { - uint64_t devid; /* in/out */ - uint8_t uuid[BTRFS_UUID_SIZE]; /* in/out */ - uint64_t bytes_used; /* out */ - uint64_t total_bytes; /* out */ - uint64_t unused[379]; /* pad to 4k */ - char path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */ -}; - -struct btrfs_ioctl_fs_info_args { - uint64_t max_id; /* out */ - uint64_t num_devices; /* out */ - uint8_t fsid[BTRFS_FSID_SIZE]; /* out */ - uint64_t reserved[124]; /* pad to 1k */ -}; - -struct btrfs_ioctl_ino_lookup_args { - __u64 treeid; - __u64 objectid; - char name[BTRFS_INO_LOOKUP_PATH_MAX]; -}; - -struct btrfs_ioctl_search_key { - /* which root are we searching. 0 is the tree of tree roots */ - __u64 tree_id; - - /* keys returned will be >= min and <= max */ - __u64 min_objectid; - __u64 max_objectid; - - /* keys returned will be >= min and <= max */ - __u64 min_offset; - __u64 max_offset; - - /* max and min transids to search for */ - __u64 min_transid; - __u64 max_transid; - - /* keys returned will be >= min and <= max */ - __u32 min_type; - __u32 max_type; - - /* - * how many items did userland ask for, and how many are we - * returning - */ - __u32 nr_items; - - /* align to 64 bits */ - __u32 unused; - - /* some extra for later */ - __u64 unused1; - __u64 unused2; - __u64 unused3; - __u64 unused4; -}; - -struct btrfs_ioctl_search_header { - __u64 transid; - __u64 objectid; - __u64 offset; - __u32 type; - __u32 len; -}; - -struct btrfs_ioctl_search_args { - struct btrfs_ioctl_search_key key; - char buf[BTRFS_SEARCH_ARGS_BUFSIZE]; -}; - -struct btrfs_ioctl_clone_range_args { - __s64 src_fd; - __u64 src_offset, src_length; - __u64 dest_offset; -}; - -#define BTRFS_QUOTA_CTL_ENABLE 1 -#define BTRFS_QUOTA_CTL_DISABLE 2 -#define BTRFS_QUOTA_CTL_RESCAN__NOTUSED 3 -struct btrfs_ioctl_quota_ctl_args { - __u64 cmd; - __u64 status; -}; -#endif /* !HAVE_LINUX_BTRFS_H */ - -#ifndef BTRFS_IOC_DEFRAG -#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \ - struct btrfs_ioctl_vol_args) -#endif - -#ifndef BTRFS_IOC_RESIZE -#define BTRFS_IOC_RESIZE _IOW(BTRFS_IOCTL_MAGIC, 3, \ - struct btrfs_ioctl_vol_args) -#endif - -#ifndef BTRFS_IOC_CLONE -#define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int) -#endif - -#ifndef BTRFS_IOC_CLONE_RANGE -#define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \ - struct btrfs_ioctl_clone_range_args) -#endif - -#ifndef BTRFS_IOC_SUBVOL_CREATE -#define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, \ - struct btrfs_ioctl_vol_args) -#endif - -#ifndef BTRFS_IOC_SNAP_DESTROY -#define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \ - struct btrfs_ioctl_vol_args) -#endif - -#ifndef BTRFS_IOC_TREE_SEARCH -#define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \ - struct btrfs_ioctl_search_args) -#endif - -#ifndef BTRFS_IOC_INO_LOOKUP -#define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \ - struct btrfs_ioctl_ino_lookup_args) -#endif - -#ifndef BTRFS_IOC_SNAP_CREATE_V2 -#define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \ - struct btrfs_ioctl_vol_args_v2) -#endif - -#ifndef BTRFS_IOC_SUBVOL_GETFLAGS -#define BTRFS_IOC_SUBVOL_GETFLAGS _IOR(BTRFS_IOCTL_MAGIC, 25, __u64) -#endif - -#ifndef BTRFS_IOC_SUBVOL_SETFLAGS -#define BTRFS_IOC_SUBVOL_SETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 26, __u64) -#endif - -#ifndef BTRFS_IOC_DEV_INFO -#define BTRFS_IOC_DEV_INFO _IOWR(BTRFS_IOCTL_MAGIC, 30, \ - struct btrfs_ioctl_dev_info_args) -#endif - -#ifndef BTRFS_IOC_FS_INFO -#define BTRFS_IOC_FS_INFO _IOR(BTRFS_IOCTL_MAGIC, 31, \ - struct btrfs_ioctl_fs_info_args) -#endif - -#ifndef BTRFS_IOC_DEVICES_READY -#define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, \ - struct btrfs_ioctl_vol_args) -#endif - -#ifndef BTRFS_IOC_QUOTA_CTL -#define BTRFS_IOC_QUOTA_CTL _IOWR(BTRFS_IOCTL_MAGIC, 40, \ - struct btrfs_ioctl_quota_ctl_args) -#endif - -#ifndef BTRFS_IOC_QGROUP_LIMIT -#define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, \ - struct btrfs_ioctl_qgroup_limit_args) -#endif - -#ifndef BTRFS_IOC_QUOTA_RESCAN_WAIT -#define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46) -#endif - -#ifndef BTRFS_FIRST_FREE_OBJECTID -#define BTRFS_FIRST_FREE_OBJECTID 256 -#endif - -#ifndef BTRFS_LAST_FREE_OBJECTID -#define BTRFS_LAST_FREE_OBJECTID -256ULL -#endif - -#ifndef BTRFS_ROOT_TREE_OBJECTID -#define BTRFS_ROOT_TREE_OBJECTID 1 -#endif - -#ifndef BTRFS_QUOTA_TREE_OBJECTID -#define BTRFS_QUOTA_TREE_OBJECTID 8ULL -#endif - -#ifndef BTRFS_ROOT_ITEM_KEY -#define BTRFS_ROOT_ITEM_KEY 132 -#endif - -#ifndef BTRFS_QGROUP_STATUS_KEY -#define BTRFS_QGROUP_STATUS_KEY 240 -#endif - -#ifndef BTRFS_QGROUP_INFO_KEY -#define BTRFS_QGROUP_INFO_KEY 242 -#endif - -#ifndef BTRFS_QGROUP_LIMIT_KEY -#define BTRFS_QGROUP_LIMIT_KEY 244 -#endif - -#ifndef BTRFS_QGROUP_RELATION_KEY -#define BTRFS_QGROUP_RELATION_KEY 246 -#endif - -#ifndef BTRFS_ROOT_BACKREF_KEY -#define BTRFS_ROOT_BACKREF_KEY 144 -#endif - -#ifndef BTRFS_SUPER_MAGIC -#define BTRFS_SUPER_MAGIC 0x9123683E -#endif - -#ifndef CGROUP_SUPER_MAGIC -#define CGROUP_SUPER_MAGIC 0x27e0eb -#endif - -#ifndef CGROUP2_SUPER_MAGIC -#define CGROUP2_SUPER_MAGIC 0x63677270 -#endif - #ifndef CLONE_NEWCGROUP #define CLONE_NEWCGROUP 0x02000000 #endif -#ifndef TMPFS_MAGIC -#define TMPFS_MAGIC 0x01021994 -#endif - -#ifndef MQUEUE_MAGIC -#define MQUEUE_MAGIC 0x19800202 -#endif - -#ifndef SECURITYFS_MAGIC -#define SECURITYFS_MAGIC 0x73636673 -#endif - -#ifndef TRACEFS_MAGIC -#define TRACEFS_MAGIC 0x74726163 -#endif - -#ifndef BPF_FS_MAGIC -#define BPF_FS_MAGIC 0xcafe4a11 -#endif - -#ifndef OCFS2_SUPER_MAGIC -#define OCFS2_SUPER_MAGIC 0x7461636f -#endif - #ifndef MS_MOVE #define MS_MOVE 8192 #endif @@ -547,38 +184,6 @@ struct btrfs_ioctl_quota_ctl_args { #define SCM_SECURITY 0x03 #endif -#ifndef PR_SET_NO_NEW_PRIVS -#define PR_SET_NO_NEW_PRIVS 38 -#endif - -#ifndef PR_SET_CHILD_SUBREAPER -#define PR_SET_CHILD_SUBREAPER 36 -#endif - -#ifndef PR_SET_MM_ARG_START -#define PR_SET_MM_ARG_START 8 -#endif - -#ifndef PR_SET_MM_ARG_END -#define PR_SET_MM_ARG_END 9 -#endif - -#ifndef PR_SET_MM_ENV_START -#define PR_SET_MM_ENV_START 10 -#endif - -#ifndef PR_SET_MM_ENV_END -#define PR_SET_MM_ENV_END 11 -#endif - -#ifndef EFIVARFS_MAGIC -#define EFIVARFS_MAGIC 0xde5e81e4 -#endif - -#ifndef SMACK_MAGIC -#define SMACK_MAGIC 0x43415d53 -#endif - #ifndef DM_DEFERRED_REMOVE #define DM_DEFERRED_REMOVE (1 << 17) #endif @@ -611,21 +216,6 @@ struct btrfs_ioctl_quota_ctl_args { # define SO_PEERGROUPS 59 #endif -#ifndef EVIOCREVOKE -# define EVIOCREVOKE _IOW('E', 0x91, int) -#endif - -#ifndef EVIOCSMASK - -struct input_mask { - uint32_t type; - uint32_t codes_size; - uint64_t codes_ptr; -}; - -#define EVIOCSMASK _IOW('E', 0x93, struct input_mask) -#endif - #ifndef DRM_IOCTL_SET_MASTER # define DRM_IOCTL_SET_MASTER _IO('d', 0x1e) #endif @@ -679,30 +269,6 @@ struct input_mask { #define AUDIT_NLGRP_READLOG 1 #endif -#ifndef CAP_MAC_OVERRIDE -#define CAP_MAC_OVERRIDE 32 -#endif - -#ifndef CAP_MAC_ADMIN -#define CAP_MAC_ADMIN 33 -#endif - -#ifndef CAP_SYSLOG -#define CAP_SYSLOG 34 -#endif - -#ifndef CAP_WAKE_ALARM -#define CAP_WAKE_ALARM 35 -#endif - -#ifndef CAP_BLOCK_SUSPEND -#define CAP_BLOCK_SUSPEND 36 -#endif - -#ifndef CAP_AUDIT_READ -#define CAP_AUDIT_READ 37 -#endif - #ifndef RENAME_NOREPLACE #define RENAME_NOREPLACE (1 << 0) #endif @@ -711,115 +277,6 @@ struct input_mask { #define KCMP_FILE 0 #endif -#ifndef INPUT_PROP_POINTING_STICK -#define INPUT_PROP_POINTING_STICK 0x05 -#endif - -#ifndef INPUT_PROP_ACCELEROMETER -#define INPUT_PROP_ACCELEROMETER 0x06 -#endif - -#ifndef BTN_DPAD_UP -#define BTN_DPAD_UP 0x220 -#define BTN_DPAD_RIGHT 0x223 -#endif - -#ifndef KEY_ALS_TOGGLE -#define KEY_ALS_TOGGLE 0x230 -#endif - -typedef int32_t key_serial_t; - -#ifndef KEYCTL_JOIN_SESSION_KEYRING -#define KEYCTL_JOIN_SESSION_KEYRING 1 -#endif - -#ifndef KEYCTL_CHOWN -#define KEYCTL_CHOWN 4 -#endif - -#ifndef KEYCTL_SETPERM -#define KEYCTL_SETPERM 5 -#endif - -#ifndef KEYCTL_DESCRIBE -#define KEYCTL_DESCRIBE 6 -#endif - -#ifndef KEYCTL_LINK -#define KEYCTL_LINK 8 -#endif - -#ifndef KEYCTL_READ -#define KEYCTL_READ 11 -#endif - -#ifndef KEYCTL_SET_TIMEOUT -#define KEYCTL_SET_TIMEOUT 15 -#endif - -#ifndef KEY_POS_VIEW -#define KEY_POS_VIEW 0x01000000 -#define KEY_POS_READ 0x02000000 -#define KEY_POS_WRITE 0x04000000 -#define KEY_POS_SEARCH 0x08000000 -#define KEY_POS_LINK 0x10000000 -#define KEY_POS_SETATTR 0x20000000 - -#define KEY_USR_VIEW 0x00010000 -#define KEY_USR_READ 0x00020000 -#define KEY_USR_WRITE 0x00040000 -#define KEY_USR_SEARCH 0x00080000 -#define KEY_USR_LINK 0x00100000 -#define KEY_USR_SETATTR 0x00200000 - -#define KEY_GRP_VIEW 0x00000100 -#define KEY_GRP_READ 0x00000200 -#define KEY_GRP_WRITE 0x00000400 -#define KEY_GRP_SEARCH 0x00000800 -#define KEY_GRP_LINK 0x00001000 -#define KEY_GRP_SETATTR 0x00002000 - -#define KEY_OTH_VIEW 0x00000001 -#define KEY_OTH_READ 0x00000002 -#define KEY_OTH_WRITE 0x00000004 -#define KEY_OTH_SEARCH 0x00000008 -#define KEY_OTH_LINK 0x00000010 -#define KEY_OTH_SETATTR 0x00000020 -#endif - -#ifndef KEY_SPEC_USER_KEYRING -#define KEY_SPEC_USER_KEYRING -4 -#endif - -#ifndef KEY_SPEC_SESSION_KEYRING -#define KEY_SPEC_SESSION_KEYRING -3 -#endif - -#ifndef PR_CAP_AMBIENT -#define PR_CAP_AMBIENT 47 -#endif - -#ifndef PR_CAP_AMBIENT_IS_SET -#define PR_CAP_AMBIENT_IS_SET 1 -#endif - -#ifndef PR_CAP_AMBIENT_RAISE -#define PR_CAP_AMBIENT_RAISE 2 -#endif - -#ifndef PR_CAP_AMBIENT_CLEAR_ALL -#define PR_CAP_AMBIENT_CLEAR_ALL 4 -#endif - -#if !HAVE_CHAR32_T -#define char32_t uint32_t -#endif - -#if !HAVE_CHAR16_T -#define char16_t uint16_t -#endif - #ifndef ETHERTYPE_LLDP #define ETHERTYPE_LLDP 0x88cc #endif @@ -836,10 +293,6 @@ typedef int32_t key_serial_t; # define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64) #endif -#ifndef NSFS_MAGIC -#define NSFS_MAGIC 0x6e736673 -#endif - #ifndef NS_GET_NSTYPE #define NS_GET_NSTYPE _IO(0xb7, 0x3) #endif @@ -856,45 +309,6 @@ typedef int32_t key_serial_t; #define PF_KTHREAD 0x00200000 #endif -#if ! HAVE_STRUCT_STATX -struct statx_timestamp { - int64_t tv_sec; - uint32_t tv_nsec; - uint32_t __reserved; -}; -struct statx { - uint32_t stx_mask; - uint32_t stx_blksize; - uint64_t stx_attributes; - uint32_t stx_nlink; - uint32_t stx_uid; - uint32_t stx_gid; - uint16_t stx_mode; - uint16_t __spare0[1]; - uint64_t stx_ino; - uint64_t stx_size; - uint64_t stx_blocks; - uint64_t stx_attributes_mask; - struct statx_timestamp stx_atime; - struct statx_timestamp stx_btime; - struct statx_timestamp stx_ctime; - struct statx_timestamp stx_mtime; - uint32_t stx_rdev_major; - uint32_t stx_rdev_minor; - uint32_t stx_dev_major; - uint32_t stx_dev_minor; - uint64_t __spare2[14]; -}; -#endif - -#ifndef STATX_BTIME -#define STATX_BTIME 0x00000800U -#endif - -#ifndef AT_STATX_DONT_SYNC -#define AT_STATX_DONT_SYNC 0x4000 -#endif - /* The maximum thread/process name length including trailing NUL byte. This mimics the kernel definition of the same * name, which we need in userspace at various places but is not defined in userspace currently, neither under this * name nor any other. */ @@ -902,5 +316,12 @@ struct statx { #define TASK_COMM_LEN 16 #endif +#include "missing_btrfs_tree.h" +#include "missing_capability.h" +#include "missing_input.h" +#include "missing_magic.h" #include "missing_network.h" +#include "missing_prctl.h" +#include "missing_type.h" + #include "missing_syscall.h" diff --git a/src/basic/missing_btrfs.h b/src/basic/missing_btrfs.h new file mode 100644 index 0000000000..34c382ff0b --- /dev/null +++ b/src/basic/missing_btrfs.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ +#pragma once + +/* Old btrfs.h requires stddef.h to be included before btrfs.h */ +#include + +#include + +/* linux@57254b6ebce4ceca02d9c8b615f6059c56c19238 (3.11) */ +#ifndef BTRFS_IOC_QUOTA_RESCAN_WAIT +#define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46) +#endif + +/* linux@83288b60bf6668933689078973136e0c9d387b38 (4.7) */ +#ifndef BTRFS_QGROUP_LIMIT_MAX_RFER +#define BTRFS_QGROUP_LIMIT_MAX_RFER (1ULL << 0) +#define BTRFS_QGROUP_LIMIT_MAX_EXCL (1ULL << 1) +#define BTRFS_QGROUP_LIMIT_RSV_RFER (1ULL << 2) +#define BTRFS_QGROUP_LIMIT_RSV_EXCL (1ULL << 3) +#define BTRFS_QGROUP_LIMIT_RFER_CMPR (1ULL << 4) +#define BTRFS_QGROUP_LIMIT_EXCL_CMPR (1ULL << 5) +#endif diff --git a/src/basic/missing_btrfs_tree.h b/src/basic/missing_btrfs_tree.h new file mode 100644 index 0000000000..555f90fe1b --- /dev/null +++ b/src/basic/missing_btrfs_tree.h @@ -0,0 +1,109 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ +#pragma once + +#include + +#include "missing_btrfs.h" + +/* linux@db6711600e27c885aed89751f04e727f3af26715 (4.7) */ +#if HAVE_LINUX_BTRFS_TREE_H +#include +#else +#define BTRFS_ROOT_TREE_OBJECTID 1 +#define BTRFS_QUOTA_TREE_OBJECTID 8 +#define BTRFS_FIRST_FREE_OBJECTID 256 +#define BTRFS_LAST_FREE_OBJECTID -256ULL + +#define BTRFS_ROOT_ITEM_KEY 132 +#define BTRFS_ROOT_BACKREF_KEY 144 +#define BTRFS_QGROUP_STATUS_KEY 240 +#define BTRFS_QGROUP_INFO_KEY 242 +#define BTRFS_QGROUP_LIMIT_KEY 244 +#define BTRFS_QGROUP_RELATION_KEY 246 + +struct btrfs_disk_key { + __le64 objectid; + __u8 type; + __le64 offset; +} __attribute__ ((__packed__)); + +struct btrfs_timespec { + __le64 sec; + __le32 nsec; +} __attribute__ ((__packed__)); + +struct btrfs_inode_item { + __le64 generation; + __le64 transid; + __le64 size; + __le64 nbytes; + __le64 block_group; + __le32 nlink; + __le32 uid; + __le32 gid; + __le32 mode; + __le64 rdev; + __le64 flags; + __le64 sequence; + __le64 reserved[4]; + struct btrfs_timespec atime; + struct btrfs_timespec ctime; + struct btrfs_timespec mtime; + struct btrfs_timespec otime; +} __attribute__ ((__packed__)); + +#define BTRFS_ROOT_SUBVOL_RDONLY (1ULL << 0) + +struct btrfs_root_item { + struct btrfs_inode_item inode; + __le64 generation; + __le64 root_dirid; + __le64 bytenr; + __le64 byte_limit; + __le64 bytes_used; + __le64 last_snapshot; + __le64 flags; + __le32 refs; + struct btrfs_disk_key drop_progress; + __u8 drop_level; + __u8 level; + + __le64 generation_v2; + __u8 uuid[BTRFS_UUID_SIZE]; + __u8 parent_uuid[BTRFS_UUID_SIZE]; + __u8 received_uuid[BTRFS_UUID_SIZE]; + __le64 ctransid; /* updated when an inode changes */ + __le64 otransid; /* trans when created */ + __le64 stransid; /* trans when sent. non-zero for received subvol */ + __le64 rtransid; /* trans when received. non-zero for received subvol */ + struct btrfs_timespec ctime; + struct btrfs_timespec otime; + struct btrfs_timespec stime; + struct btrfs_timespec rtime; + __le64 reserved[8]; /* for future */ +} __attribute__ ((__packed__)); + +struct btrfs_root_ref { + __le64 dirid; + __le64 sequence; + __le16 name_len; +} __attribute__ ((__packed__)); + +#define BTRFS_QGROUP_LEVEL_SHIFT 48 + +struct btrfs_qgroup_info_item { + __le64 generation; + __le64 rfer; + __le64 rfer_cmpr; + __le64 excl; + __le64 excl_cmpr; +} __attribute__ ((__packed__)); + +struct btrfs_qgroup_limit_item { + __le64 flags; + __le64 max_rfer; + __le64 max_excl; + __le64 rsv_rfer; + __le64 rsv_excl; +} __attribute__ ((__packed__)); +#endif diff --git a/src/basic/missing_capability.h b/src/basic/missing_capability.h new file mode 100644 index 0000000000..1308a3d636 --- /dev/null +++ b/src/basic/missing_capability.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ +#pragma once + +#include + +/* 3a101b8de0d39403b2c7e5c23fd0b005668acf48 (3.16) */ +#ifndef CAP_AUDIT_READ +#define CAP_AUDIT_READ 37 + +#undef CAP_LAST_CAP +#define CAP_LAST_CAP CAP_AUDIT_READ +#endif diff --git a/src/basic/missing_input.h b/src/basic/missing_input.h new file mode 100644 index 0000000000..93cdf9a310 --- /dev/null +++ b/src/basic/missing_input.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ +#pragma once + +#include + +/* linux@c7dc65737c9a607d3e6f8478659876074ad129b8 (3.12) */ +#ifndef EVIOCREVOKE +#define EVIOCREVOKE _IOW('E', 0x91, int) +#endif + +/* linux@06a16293f71927f756dcf37558a79c0b05a91641 (4.4) */ +#ifndef EVIOCSMASK +struct input_mask { + uint32_t type; + uint32_t codes_size; + uint64_t codes_ptr; +}; + +#define EVIOCGMASK _IOR('E', 0x92, struct input_mask) +#define EVIOCSMASK _IOW('E', 0x93, struct input_mask) +#endif + +/* linux@7611392fe8ff95ecae528b01a815ae3d72ca6b95 (3.17) */ +#ifndef INPUT_PROP_POINTING_STICK +#define INPUT_PROP_POINTING_STICK 0x05 +#endif + +/* linux@500d4160abe9a2e88b12e319c13ae3ebd1e18108 (4.0) */ +#ifndef INPUT_PROP_ACCELEROMETER +#define INPUT_PROP_ACCELEROMETER 0x06 +#endif + +/* linux@d09bbfd2a8408a995419dff0d2ba906013cf4cc9 (3.11) */ +#ifndef BTN_DPAD_UP +#define BTN_DPAD_UP 0x220 +#define BTN_DPAD_DOWN 0x221 +#define BTN_DPAD_LEFT 0x222 +#define BTN_DPAD_RIGHT 0x223 +#endif + +/* linux@358f24704f2f016af7d504b357cdf32606091d07 (3.13) */ +#ifndef KEY_ALS_TOGGLE +#define KEY_ALS_TOGGLE 0x230 +#endif diff --git a/src/basic/missing_keyctl.h b/src/basic/missing_keyctl.h new file mode 100644 index 0000000000..7eb709586c --- /dev/null +++ b/src/basic/missing_keyctl.h @@ -0,0 +1,78 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ +#pragma once + +#include + +#ifndef KEYCTL_JOIN_SESSION_KEYRING +#define KEYCTL_JOIN_SESSION_KEYRING 1 +#endif + +#ifndef KEYCTL_CHOWN +#define KEYCTL_CHOWN 4 +#endif + +#ifndef KEYCTL_SETPERM +#define KEYCTL_SETPERM 5 +#endif + +#ifndef KEYCTL_DESCRIBE +#define KEYCTL_DESCRIBE 6 +#endif + +#ifndef KEYCTL_LINK +#define KEYCTL_LINK 8 +#endif + +#ifndef KEYCTL_READ +#define KEYCTL_READ 11 +#endif + +#ifndef KEYCTL_SET_TIMEOUT +#define KEYCTL_SET_TIMEOUT 15 +#endif + +#ifndef KEY_SPEC_USER_KEYRING +#define KEY_SPEC_USER_KEYRING -4 +#endif + +#ifndef KEY_SPEC_SESSION_KEYRING +#define KEY_SPEC_SESSION_KEYRING -3 +#endif + +/* From linux/key.h */ +#ifndef KEY_POS_VIEW + +typedef int32_t key_serial_t; + +#define KEY_POS_VIEW 0x01000000 +#define KEY_POS_READ 0x02000000 +#define KEY_POS_WRITE 0x04000000 +#define KEY_POS_SEARCH 0x08000000 +#define KEY_POS_LINK 0x10000000 +#define KEY_POS_SETATTR 0x20000000 +#define KEY_POS_ALL 0x3f000000 + +#define KEY_USR_VIEW 0x00010000 +#define KEY_USR_READ 0x00020000 +#define KEY_USR_WRITE 0x00040000 +#define KEY_USR_SEARCH 0x00080000 +#define KEY_USR_LINK 0x00100000 +#define KEY_USR_SETATTR 0x00200000 +#define KEY_USR_ALL 0x003f0000 + +#define KEY_GRP_VIEW 0x00000100 +#define KEY_GRP_READ 0x00000200 +#define KEY_GRP_WRITE 0x00000400 +#define KEY_GRP_SEARCH 0x00000800 +#define KEY_GRP_LINK 0x00001000 +#define KEY_GRP_SETATTR 0x00002000 +#define KEY_GRP_ALL 0x00003f00 + +#define KEY_OTH_VIEW 0x00000001 +#define KEY_OTH_READ 0x00000002 +#define KEY_OTH_WRITE 0x00000004 +#define KEY_OTH_SEARCH 0x00000008 +#define KEY_OTH_LINK 0x00000010 +#define KEY_OTH_SETATTR 0x00000020 +#define KEY_OTH_ALL 0x0000003f +#endif diff --git a/src/basic/missing_magic.h b/src/basic/missing_magic.h new file mode 100644 index 0000000000..4910cd368f --- /dev/null +++ b/src/basic/missing_magic.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ +#pragma once + +#include + +/* 62aa81d7c4c24b90fdb61da70ac0dbbc414f9939 (4.13) */ +#ifndef OCFS2_SUPER_MAGIC +#define OCFS2_SUPER_MAGIC 0x7461636f +#endif + +/* 67e9c74b8a873408c27ac9a8e4c1d1c8d72c93ff (4.5) */ +#ifndef CGROUP2_SUPER_MAGIC +#define CGROUP2_SUPER_MAGIC 0x63677270 +#endif + +/* 4282d60689d4f21b40692029080440cc58e8a17d (4.1) */ +#ifndef TRACEFS_MAGIC +#define TRACEFS_MAGIC 0x74726163 +#endif + +/* e149ed2b805fefdccf7ccdfc19eca22fdd4514ac (3.19) */ +#ifndef NSFS_MAGIC +#define NSFS_MAGIC 0x6e736673 +#endif + +/* b2197755b2633e164a439682fb05a9b5ea48f706 (4.4) */ +#ifndef BPF_FS_MAGIC +#define BPF_FS_MAGIC 0xcafe4a11 +#endif + +/* Not exposed yet (4.20). Defined at ipc/mqueue.c */ +#ifndef MQUEUE_MAGIC +#define MQUEUE_MAGIC 0x19800202 +#endif diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h new file mode 100644 index 0000000000..f80cd17f34 --- /dev/null +++ b/src/basic/missing_prctl.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ +#pragma once + +#include + +/* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */ +#ifndef PR_CAP_AMBIENT +#define PR_CAP_AMBIENT 47 + +#define PR_CAP_AMBIENT_IS_SET 1 +#define PR_CAP_AMBIENT_RAISE 2 +#define PR_CAP_AMBIENT_LOWER 3 +#define PR_CAP_AMBIENT_CLEAR_ALL 4 +#endif diff --git a/src/basic/missing_securebits.h b/src/basic/missing_securebits.h new file mode 100644 index 0000000000..40d6ec9d71 --- /dev/null +++ b/src/basic/missing_securebits.h @@ -0,0 +1,17 @@ +#pragma once + +#include + +/* 746bf6d64275be0c65b0631d8a72b16f1454cfa1 (4.3) */ +#ifndef SECURE_NO_CAP_AMBIENT_RAISE +#define SECURE_NO_CAP_AMBIENT_RAISE 6 +#define SECURE_NO_CAP_AMBIENT_RAISE_LOCKED 7 /* make bit-6 immutable */ +#define SECBIT_NO_CAP_AMBIENT_RAISE (issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE)) +#define SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED (issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE_LOCKED)) + +#undef SECURE_ALL_BITS +#define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \ + issecure_mask(SECURE_NO_SETUID_FIXUP) | \ + issecure_mask(SECURE_KEEP_CAPS) | \ + issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE)) +#endif diff --git a/src/basic/missing_stat.h b/src/basic/missing_stat.h new file mode 100644 index 0000000000..85f98e2690 --- /dev/null +++ b/src/basic/missing_stat.h @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ +#pragma once + +#include +#include + +#if WANT_LINUX_STAT_H +#include +#endif + +/* a528d35e8bfcc521d7cb70aaf03e1bd296c8493f (4.11) */ +#if !HAVE_STRUCT_STATX +struct statx_timestamp { + int64_t tv_sec; + uint32_t tv_nsec; + uint32_t __reserved; +}; +struct statx { + uint32_t stx_mask; + uint32_t stx_blksize; + uint64_t stx_attributes; + uint32_t stx_nlink; + uint32_t stx_uid; + uint32_t stx_gid; + uint16_t stx_mode; + uint16_t __spare0[1]; + uint64_t stx_ino; + uint64_t stx_size; + uint64_t stx_blocks; + uint64_t stx_attributes_mask; + struct statx_timestamp stx_atime; + struct statx_timestamp stx_btime; + struct statx_timestamp stx_ctime; + struct statx_timestamp stx_mtime; + uint32_t stx_rdev_major; + uint32_t stx_rdev_minor; + uint32_t stx_dev_major; + uint32_t stx_dev_minor; + uint64_t __spare2[14]; +}; +#endif + +/* a528d35e8bfcc521d7cb70aaf03e1bd296c8493f (4.11) */ +#ifndef STATX_BTIME +#define STATX_BTIME 0x00000800U +#endif + +/* a528d35e8bfcc521d7cb70aaf03e1bd296c8493f (4.11) */ +#ifndef AT_STATX_DONT_SYNC +#define AT_STATX_DONT_SYNC 0x4000 +#endif diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h index 93c60458bf..b009ea5bfa 100644 --- a/src/basic/missing_syscall.h +++ b/src/basic/missing_syscall.h @@ -3,8 +3,13 @@ /* Missing glibc definitions to access certain kernel APIs */ +#include +#include #include +#include "missing_keyctl.h" +#include "missing_stat.h" + #if !HAVE_PIVOT_ROOT static inline int missing_pivot_root(const char *new_root, const char *put_old) { return syscall(__NR_pivot_root, new_root, put_old); diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h new file mode 100644 index 0000000000..bf8a6caa1b --- /dev/null +++ b/src/basic/missing_type.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ +#pragma once + +#include + +#if !HAVE_CHAR32_T +#define char32_t uint32_t +#endif + +#if !HAVE_CHAR16_T +#define char16_t uint16_t +#endif diff --git a/src/basic/securebits.h b/src/basic/securebits.h deleted file mode 100644 index e3b7538b0c..0000000000 --- a/src/basic/securebits.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -/* This is minimal version of Linux' linux/securebits.h header file, - * which is licensed GPL2 */ - -#define SECUREBITS_DEFAULT 0x00000000 - -/* When set UID 0 has no special privileges. When unset, we support - inheritance of root-permissions and suid-root executable under - compatibility mode. We raise the effective and inheritable bitmasks - *of the executable file* if the effective uid of the new process is - 0. If the real uid is 0, we raise the effective (legacy) bit of the - executable file. */ -#define SECURE_NOROOT 0 -#define SECURE_NOROOT_LOCKED 1 /* make bit-0 immutable */ - -/* When set, setuid to/from uid 0 does not trigger capability-"fixup". - When unset, to provide compatibility with old programs relying on - set*uid to gain/lose privilege, transitions to/from uid 0 cause - capabilities to be gained/lost. */ -#define SECURE_NO_SETUID_FIXUP 2 -#define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */ - -/* When set, a process can retain its capabilities even after - transitioning to a non-root user (the set-uid fixup suppressed by - bit 2). Bit-4 is cleared when a process calls exec(); setting both - bit 4 and 5 will create a barrier through exec that no exec()'d - child can use this feature again. */ -#define SECURE_KEEP_CAPS 4 -#define SECURE_KEEP_CAPS_LOCKED 5 /* make bit-4 immutable */ - -/* Each securesetting is implemented using two bits. One bit specifies - whether the setting is on or off. The other bit specify whether the - setting is locked or not. A setting which is locked cannot be - changed from user-level. */ -#define issecure_mask(X) (1 << (X)) -#define issecure(X) (issecure_mask(X) & current_cred_xxx(securebits)) - -#define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \ - issecure_mask(SECURE_NO_SETUID_FIXUP) | \ - issecure_mask(SECURE_KEEP_CAPS)) -#define SECURE_ALL_LOCKS (SECURE_ALL_BITS << 1) diff --git a/src/basic/time-util.c b/src/basic/time-util.c index f1f52f1beb..12c1fc71df 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -20,6 +20,7 @@ #include "io-util.h" #include "log.h" #include "macro.h" +#include "missing.h" #include "parse-util.h" #include "path-util.h" #include "process-util.h" diff --git a/src/basic/utf8.h b/src/basic/utf8.h index 3de798050d..628456936e 100644 --- a/src/basic/utf8.h +++ b/src/basic/utf8.h @@ -7,7 +7,7 @@ #include #include "macro.h" -#include "missing.h" +#include "missing_type.h" #define UTF8_REPLACEMENT_CHARACTER "\xef\xbf\xbd" #define UTF8_BYTE_ORDER_MARK "\xef\xbb\xbf" diff --git a/src/basic/util.h b/src/basic/util.h index 43f4081190..01118bb895 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -25,7 +25,6 @@ #include "format-util.h" #include "macro.h" -#include "missing.h" #include "time-util.h" size_t page_size(void) _pure_; diff --git a/src/core/execute.c b/src/core/execute.c index 6136d700a3..e966f9cfe8 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -76,7 +76,6 @@ #if HAVE_SECCOMP #include "seccomp-util.h" #endif -#include "securebits.h" #include "securebits-util.h" #include "selinux-util.h" #include "signal-util.h" diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 041b622314..36e874de29 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -46,7 +46,6 @@ #if HAVE_SECCOMP #include "seccomp-util.h" #endif -#include "securebits.h" #include "securebits-util.h" #include "signal-util.h" #include "stat-util.h" diff --git a/src/fuzz/fuzz-journald-stream.c b/src/fuzz/fuzz-journald-stream.c index 247c0889bc..5d6c8eb8ca 100644 --- a/src/fuzz/fuzz-journald-stream.c +++ b/src/fuzz/fuzz-journald-stream.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ #include +#include #include "fd-util.h" #include "fuzz.h" diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index 3992b0e744..c1f9e27523 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -17,6 +17,7 @@ #include "hostname-util.h" #include "id128-util.h" #include "main-func.h" +#include "missing_capability.h" #include "os-util.h" #include "parse-util.h" #include "path-util.h" diff --git a/src/libsystemd-network/lldp-neighbor.c b/src/libsystemd-network/lldp-neighbor.c index 83b98ba492..952197e714 100644 --- a/src/libsystemd-network/lldp-neighbor.c +++ b/src/libsystemd-network/lldp-neighbor.c @@ -7,6 +7,7 @@ #include "in-addr-util.h" #include "lldp-internal.h" #include "lldp-neighbor.h" +#include "missing.h" #include "unaligned.h" static void lldp_neighbor_id_hash_func(const LLDPNeighborID *id, struct siphash *state) { diff --git a/src/libsystemd-network/lldp-network.c b/src/libsystemd-network/lldp-network.c index a4020d1e19..870584c0db 100644 --- a/src/libsystemd-network/lldp-network.c +++ b/src/libsystemd-network/lldp-network.c @@ -5,6 +5,7 @@ #include "fd-util.h" #include "lldp-network.h" +#include "missing.h" #include "socket-util.h" int lldp_network_bind_raw_socket(int ifindex) { diff --git a/src/locale/localed.c b/src/locale/localed.c index 79a6d3e4d0..f851d35a08 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -20,6 +20,7 @@ #include "locale-util.h" #include "macro.h" #include "main-func.h" +#include "missing_capability.h" #include "path-util.h" #include "selinux-util.h" #include "signal-util.h" diff --git a/src/login/logind-button.c b/src/login/logind-button.c index 7c9cf05dd7..daffbf0668 100644 --- a/src/login/logind-button.c +++ b/src/login/logind-button.c @@ -12,6 +12,7 @@ #include "alloc-util.h" #include "fd-util.h" #include "logind-button.h" +#include "missing_input.h" #include "string-util.h" #include "util.h" diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 0e441b5631..766a9236be 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -25,6 +25,7 @@ #include "format-util.h" #include "fs-util.h" #include "logind.h" +#include "missing_capability.h" #include "mkdir.h" #include "path-util.h" #include "process-util.h" diff --git a/src/login/logind-seat-dbus.c b/src/login/logind-seat-dbus.c index 8002901cf7..6ee5a1c95d 100644 --- a/src/login/logind-seat-dbus.c +++ b/src/login/logind-seat-dbus.c @@ -9,6 +9,7 @@ #include "bus-util.h" #include "logind-seat.h" #include "logind.h" +#include "missing_capability.h" #include "strv.h" #include "user-util.h" #include "util.h" diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c index 4eae281bd8..df5bfba982 100644 --- a/src/login/logind-session-dbus.c +++ b/src/login/logind-session-dbus.c @@ -11,6 +11,7 @@ #include "logind-session-device.h" #include "logind-session.h" #include "logind.h" +#include "missing_capability.h" #include "signal-util.h" #include "stat-util.h" #include "strv.h" diff --git a/src/login/logind-user-dbus.c b/src/login/logind-user-dbus.c index 9620fb0cfc..fcaeba13f6 100644 --- a/src/login/logind-user-dbus.c +++ b/src/login/logind-user-dbus.c @@ -8,6 +8,7 @@ #include "format-util.h" #include "logind-user.h" #include "logind.h" +#include "missing_capability.h" #include "signal-util.h" #include "strv.h" #include "user-util.h" diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 2be63f502e..0225f72bdb 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -10,6 +10,7 @@ #include "fd-util.h" #include "hostname-util.h" #include "in-addr-util.h" +#include "missing_network.h" #include "network-internal.h" #include "networkd-manager.h" #include "networkd-network.h" diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index a99eae86bf..5553a7e3bd 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -5,6 +5,7 @@ #include "alloc-util.h" #include "conf-parser.h" #include "in-addr-util.h" +#include "missing_network.h" #include "netlink-util.h" #include "networkd-manager.h" #include "networkd-route.h" diff --git a/src/network/networkd-routing-policy-rule.h b/src/network/networkd-routing-policy-rule.h index 2114eb4c3d..0e4215bffd 100644 --- a/src/network/networkd-routing-policy-rule.h +++ b/src/network/networkd-routing-policy-rule.h @@ -7,6 +7,7 @@ #include "in-addr-util.h" #include "conf-parser.h" +#include "missing_fib_rules.h" typedef struct RoutingPolicyRule RoutingPolicyRule; diff --git a/src/nspawn/nspawn-settings.h b/src/nspawn/nspawn-settings.h index ba83826bbb..cb082d1635 100644 --- a/src/nspawn/nspawn-settings.h +++ b/src/nspawn/nspawn-settings.h @@ -8,6 +8,7 @@ #include "conf-parser.h" #include "macro.h" +#include "missing.h" #include "nspawn-expose-ports.h" #include "nspawn-mount.h" diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c index 5f42c6d021..1e3fabc450 100644 --- a/src/resolve/resolvectl.c +++ b/src/resolve/resolvectl.c @@ -16,6 +16,7 @@ #include "gcrypt-util.h" #include "in-addr-util.h" #include "main-func.h" +#include "missing.h" #include "netlink-util.h" #include "pager.h" #include "parse-util.h" diff --git a/src/shared/securebits-util.c b/src/shared/securebits-util.c index ad091f6d95..6d31dfeff0 100644 --- a/src/shared/securebits-util.c +++ b/src/shared/securebits-util.c @@ -5,7 +5,6 @@ #include "alloc-util.h" #include "extract-word.h" -#include "securebits.h" #include "securebits-util.h" #include "string-util.h" diff --git a/src/shared/securebits-util.h b/src/shared/securebits-util.h index 3cb3cb3d08..b5ec6ee0e6 100644 --- a/src/shared/securebits-util.h +++ b/src/shared/securebits-util.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ #pragma once -#include "securebits.h" +#include "missing_securebits.h" int secure_bits_to_string_alloc(int i, char **s); int secure_bits_from_string(const char *s); diff --git a/src/shared/serialize.c b/src/shared/serialize.c index 20d2e9fb04..0333f87b7b 100644 --- a/src/shared/serialize.c +++ b/src/shared/serialize.c @@ -6,6 +6,7 @@ #include "env-util.h" #include "escape.h" #include "fileio.h" +#include "missing.h" #include "parse-util.h" #include "process-util.h" #include "serialize.h" diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index 9ea88a37b4..1c94714f8a 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c index ae0f1a564d..5c87db08f5 100644 --- a/src/test/test-process-util.c +++ b/src/test/test-process-util.c @@ -17,6 +17,7 @@ #include "fd-util.h" #include "log.h" #include "macro.h" +#include "missing.h" #include "parse-util.h" #include "process-util.h" #include "signal-util.h" diff --git a/src/test/test-rlimit-util.c b/src/test/test-rlimit-util.c index 15701b2712..771719a267 100644 --- a/src/test/test-rlimit-util.c +++ b/src/test/test-rlimit-util.c @@ -5,6 +5,7 @@ #include "alloc-util.h" #include "capability-util.h" #include "macro.h" +#include "missing.h" #include "rlimit-util.h" #include "string-util.h" #include "util.h" diff --git a/src/test/test-util.c b/src/test/test-util.c index eeee09a7d2..3c1b5f9b41 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -8,6 +8,7 @@ #include "def.h" #include "fileio.h" #include "fs-util.h" +#include "missing_syscall.h" #include "parse-util.h" #include "process-util.h" #include "raw-clone.h" diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c index e634481524..5a432fea24 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c @@ -20,6 +20,7 @@ #include "hashmap.h" #include "list.h" #include "main-func.h" +#include "missing_capability.h" #include "path-util.h" #include "selinux-util.h" #include "signal-util.h" diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 6703a9d7a3..ac66ffd047 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -13,7 +13,7 @@ #include "fd-util.h" #include "link-config.h" #include "log.h" -#include "missing.h" +#include "missing_network.h" #include "netlink-util.h" #include "network-internal.h" #include "parse-util.h" diff --git a/src/udev/udev-builtin-btrfs.c b/src/udev/udev-builtin-btrfs.c index 69bd54244f..85dba3d099 100644 --- a/src/udev/udev-builtin-btrfs.c +++ b/src/udev/udev-builtin-btrfs.c @@ -4,10 +4,6 @@ #include #include -#if HAVE_LINUX_BTRFS_H -#include -#endif - #include "device-util.h" #include "fd-util.h" #include "missing.h"