[systemd-devel] Removing unnecessary includes

Thomas H.P. Andersen phomes at gmail.com
Sun Feb 15 14:53:44 PST 2015


On Tue, Feb 10, 2015 at 10:05 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Sat, 07.02.15 10:29, Thomas H.P. Andersen (phomes at gmail.com) wrote:
>
>> Hi,
>>
>> I am looking at ways to automatically trim the unnecessary includes.
>> One way to do it is a script[1] which simply tests if the compile
>> still works after removing each include one at a time. It does this in
>> reverse order for all includes in the .c files. Using -Werror we catch
>> any new warnings too.
>
> I think this is quite useful, but I'd also be really careful with
> this. glibc versions sometimes require different headers to be
> included to get some functionality, thus automatic removal of headers
> that are unnecessary on one system doesn't mean this is universally
> the case... Moreover depdending on compile-time options you might
> different headers...

I have used IWYU to only drop headers that we do not use any symbols
from. There are no automatically added headers nor includes replaced
by forward declarations.I have manually checked all removals from
files that contain a #ifdef or #if defined() to catch issues from
various compile-time option combinations. No includes of "missing.h"
were removed and I tried to be careful with endianness.

Are there specific headers I should be extra careful with or ignore completely?

For info I am attaching a diff with the changes so far: 1309 includes
removed out of the current 7707. It is only compile and "make
check"-tested. I am only looking for comments (and perhaps compile
testing on an AppArmor system as I do not have a system with that).

Here is a list the headers removed and number of times removed:
74 <sys/types.h>
69 <unistd.h>
65 <string.h>
63 <assert.h>
53 "util.h"
45 <fcntl.h>
42 <stdlib.h>
38 <inttypes.h>
29 <errno.h>
28 <sys/stat.h>
21 "strv.h"
19 "label.h"
17 <sys/socket.h>
16 "path-util.h"
16 "fileio.h"
16 "def.h"
15 <stdio.h>
15 <dirent.h>
15 <arpa/inet.h>
14 "unit.h"
14 "mkdir.h"
14 "log.h"
14 <ctype.h>
13 <sys/un.h>
13 "dbus-unit.h"
12 <stdarg.h>
12 "set.h"
12 <poll.h>
12 <netinet/ether.h>
11 <limits.h>
11 "bus-message.h"
10 <stdbool.h>
10 <signal.h>
 9 <time.h>
 9 <sys/wait.h>
 9 "socket-util.h"
 9 "sd-bus.h"
 9 <pwd.h>
 9 "network-internal.h"
 9 "list.h"
 8 <sys/ioctl.h>
 8 "sd-id128.h"
 8 <net/if.h>
 8 "load-fragment.h"
 8 <getopt.h>
 7 <sys/param.h>
 7 "macro.h"
 7 "hashmap.h"
 7 "event-util.h"
 7 "bus-error.h"
 6 "utf8.h"
 6 <sys/time.h>
 6 <sys/prctl.h>
 6 <grp.h>
 6 "conf-parser.h"
 6 "capability.h"
 6 "bus-util.h"
 6 "build.h"
 5 "udev-util.h"
 5 <sys/timex.h>
 5 <sys/timerfd.h>
 5 <sys/syscall.h>
 5 <sys/epoll.h>
 5 "load-dropin.h"
 4 "virt.h"
 4 <termios.h>
 4 <sys/signalfd.h>
 4 <sys/mount.h>
 4 <stddef.h>
 4 "sd-messages.h"
 4 "resolved-manager.h"
 4 <netinet/in.h>
 4 "manager.h"
 4 "logind-seat.h"
 4 <linux/vt.h>
 4 <libudev.h>
 4 "exit-status.h"
 4 "execute.h"
 4 "conf-files.h"
 4 "cgroup-util.h"
 4 <byteswap.h>
 4 "bus-control.h"
 4 "bus-common-errors.h"
 4 "audit.h"
 3 "time-util.h"
 3 <sys/utsname.h>
 3 <sys/resource.h>
 3 <stdint.h>
 3 "special.h"
 3 "smack-util.h"
 3 "resolved-dns-scope.h"
 3 <net/ethernet.h>
 3 "logind-session.h"
 3 "logind.h"
 3 "libudev.h"
 3 "in-addr-util.h"
 3 <endian.h>
 2 <wchar.h>
 2 "unit-name.h"
 2 <sys/xattr.h>
 2 <systemd/sd-login.h>
 2 "systemd/sd-journal.h"
 2 <sys/statvfs.h>
 2 <sys/mman.h>
 2 "synthesize.h"
 2 "siphash24.h"
 2 "sd-rtnl.h"
 2 "sd-event.h"
 2 "sd-dhcp-client.h"
 2 "sd-bus-protocol.h"
 2 "rtnl-util.h"
 2 "rtnl-internal.h"
 2 "resolved-dns-stream.h"
 2 "resolved-dns-server.h"
 2 "resolved-dns-rr.h"
 2 "network-util.h"
 2 <netinet/if_ether.h>
 2 "mount-setup.h"
 2 "mount.h"
 2 "logind-device.h"
 2 <linux/types.h>
 2 <linux/limits.h>
 2 <linux/ioctl.h>
 2 <linux/fs.h>
 2 "libudev-private.h"
 2 "journal-authenticate.h"
 2 "install.h"
 2 "fsprg.h"
 2 <fnmatch.h>
 2 "failure-action.h"
 2 "driver.h"
 2 "dhcp-lease-internal.h"
 2 "dbus-kill.h"
 2 "clock-util.h"
 2 "cgroup.h"
 2 "bus-label.h"
 2 <asm/types.h>
 2 <arpa/nameser.h>
 1 "xml.h"
 1 <xkbcommon/xkbcommon.h>
 1 "unaligned.h"
 1 "target.h"
 1 <sys/vfs.h>
 1 <sys/uio.h>
 1 <sys/swap.h>
 1 <sys/select.h>
 1 <sys/inotify.h>
 1 <sys/file.h>
 1 <sys/eventfd.h>
 1 "strxcpyx.h"
 1 "specifier.h"
 1 "service.h"
 1 "sd-lldp.h"
 1 "sd-dhcp-lease.h"
 1 "sd-daemon.h"
 1 "resolved-dns-transaction.h"
 1 "resolved-dns-query.h"
 1 "resolved-dns-domain.h"
 1 <pthread.h>
 1 "path-lookup.h"
 1 "networkd-netdev.h"
 1 "networkd-link.h"
 1 <mntent.h>
 1 "machine.h"
 1 "logind-user.h"
 1 "logind-session-device.h"
 1 "logind-inhibit.h"
 1 <locale.h>
 1 <linux/veth.h>
 1 <linux/sched.h>
 1 <linux/ppp_defs.h>
 1 <linux/oom.h>
 1 <linux/netlink.h>
 1 <linux/input.h>
 1 <linux/in6.h>
 1 <linux/if_link.h>
 1 <linux/if.h>
 1 <linux/if_ether.h>
 1 <linux/capability.h>
 1 "keyboard-keys-to-name.h"
 1 "kdbus.h"
 1 "journal-internal.h"
 1 "journald-console.h"
 1 "grdev-internal.h"
 1 "fileio-label.h"
 1 "ether-addr-util.h"
 1 "errno-list.h"
 1 "env-util.h"
 1 <drm_fourcc.h>
 1 <dlfcn.h>
 1 "dhcp-internal.h"
 1 "dbus-manager.h"
 1 "copy.h"
 1 "bus-xml-policy.h"
 1 "bus-signature.h"
 1 "bus-kernel.h"
 1 "bus-introspect.h"
 1 "bus-internal.h"
 1 "boot.h"
 1 "architecture.h"
 1 "af-list.h"
 1 "acpi-fpdt.h"
-------------- next part --------------
diff --git a/src/activate/activate.c b/src/activate/activate.c
index 2689934..d345e28 100644
--- a/src/activate/activate.c
+++ b/src/activate/activate.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <unistd.h>
-#include <fcntl.h>
 #include <sys/epoll.h>
 #include <sys/prctl.h>
 #include <sys/socket.h>
diff --git a/src/analyze/analyze-verify.c b/src/analyze/analyze-verify.c
index f569109..bfc71e3 100644
--- a/src/analyze/analyze-verify.c
+++ b/src/analyze/analyze-verify.c
@@ -20,13 +20,11 @@
 ***/
 
 #include <stdlib.h>
-#include <getopt.h>
 
 #include "manager.h"
 #include "bus-util.h"
 #include "log.h"
 #include "strv.h"
-#include "build.h"
 #include "pager.h"
 #include "analyze-verify.h"
 
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 46a97eb..e7cce79 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -24,18 +24,15 @@
 #include <stdlib.h>
 #include <getopt.h>
 #include <locale.h>
-#include <sys/utsname.h>
 #include <fnmatch.h>
 
 #include "sd-bus.h"
 #include "bus-util.h"
 #include "bus-error.h"
-#include "install.h"
 #include "log.h"
 #include "build.h"
 #include "util.h"
 #include "strxcpyx.h"
-#include "fileio.h"
 #include "strv.h"
 #include "unit-name.h"
 #include "special.h"
diff --git a/src/ask-password/ask-password.c b/src/ask-password/ask-password.c
index ad8ad65..2cbed29 100644
--- a/src/ask-password/ask-password.c
+++ b/src/ask-password/ask-password.c
@@ -19,25 +19,13 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/socket.h>
-#include <poll.h>
-#include <sys/types.h>
-#include <assert.h>
-#include <string.h>
 #include <errno.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <sys/un.h>
-#include <sys/stat.h>
-#include <sys/signalfd.h>
 #include <getopt.h>
-#include <termios.h>
-#include <limits.h>
 #include <stddef.h>
 
 #include "log.h"
 #include "macro.h"
-#include "util.h"
 #include "strv.h"
 #include "ask-password-api.h"
 #include "def.h"
diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
index 089b775..6028ed6 100644
--- a/src/binfmt/binfmt.c
+++ b/src/binfmt/binfmt.c
@@ -25,11 +25,9 @@
 #include <string.h>
 #include <stdio.h>
 #include <limits.h>
-#include <stdarg.h>
 #include <getopt.h>
 
 #include "log.h"
-#include "hashmap.h"
 #include "strv.h"
 #include "util.h"
 #include "conf-files.h"
diff --git a/src/boot/boot-efi.c b/src/boot/boot-efi.c
index bd0c59b..9e86245 100644
--- a/src/boot/boot-efi.c
+++ b/src/boot/boot-efi.c
@@ -20,22 +20,13 @@
 ***/
 
 #include <stdlib.h>
-#include <stdbool.h>
-#include <unistd.h>
-#include <getopt.h>
 #include <locale.h>
 #include <string.h>
-#include <fnmatch.h>
-#include <fcntl.h>
-#include <sys/timex.h>
 
 #include "boot.h"
 #include "boot-loader.h"
-#include "build.h"
 #include "util.h"
-#include "strv.h"
 #include "efivars.h"
-#include "conf-files.h"
 
 static char *tilt_slashes(char *s) {
         char *p;
diff --git a/src/boot/boot-loader.c b/src/boot/boot-loader.c
index d44fdb3..b0a5a01 100644
--- a/src/boot/boot-loader.c
+++ b/src/boot/boot-loader.c
@@ -20,17 +20,12 @@
 ***/
 
 #include <stdlib.h>
-#include <stdbool.h>
-#include <unistd.h>
-#include <getopt.h>
 #include <locale.h>
 #include <string.h>
 #include <ctype.h>
-#include <sys/timex.h>
 
 #include "boot.h"
 #include "boot-loader.h"
-#include "build.h"
 #include "util.h"
 #include "strv.h"
 #include "conf-files.h"
diff --git a/src/boot/boot-loader.h b/src/boot/boot-loader.h
index b3fcdee..6080c2b 100644
--- a/src/boot/boot-loader.h
+++ b/src/boot/boot-loader.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "boot.h"
 
 int boot_loader_read_entries(struct boot_info *info);
 int boot_loader_find_active_entry(struct boot_info *info, const char *loader_active);
diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c
index 51b51c4..d5f3935 100644
--- a/src/boot/bootctl.c
+++ b/src/boot/bootctl.c
@@ -20,17 +20,12 @@
 ***/
 
 #include <stdlib.h>
-#include <stdbool.h>
-#include <unistd.h>
 #include <getopt.h>
 #include <locale.h>
-#include <string.h>
-#include <sys/timex.h>
 
 #include "boot.h"
 #include "build.h"
 #include "util.h"
-#include "utf8.h"
 
 static void help(void) {
         printf("%s [OPTIONS...] COMMAND ...\n\n"
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
index 64a384b..2fac300 100644
--- a/src/bootchart/bootchart.c
+++ b/src/bootchart/bootchart.c
@@ -33,10 +33,7 @@
 
  ***/
 
-#include <sys/time.h>
-#include <sys/types.h>
 #include <sys/resource.h>
-#include <sys/stat.h>
 #include <stdio.h>
 #include <signal.h>
 #include <stdlib.h>
diff --git a/src/bootchart/bootchart.h b/src/bootchart/bootchart.h
index 26de0dd..e4dbdd9 100644
--- a/src/bootchart/bootchart.h
+++ b/src/bootchart/bootchart.h
@@ -24,7 +24,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <dirent.h>
 #include <stdbool.h>
 #include "list.h"
 
diff --git a/src/bootchart/store.c b/src/bootchart/store.c
index a66387c..607cc5e 100644
--- a/src/bootchart/store.c
+++ b/src/bootchart/store.c
@@ -25,8 +25,6 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <limits.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <stdio.h>
 #include <string.h>
 #include <dirent.h>
diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c
index e111fa9..93b4764 100644
--- a/src/bootchart/svg.c
+++ b/src/bootchart/svg.c
@@ -23,14 +23,11 @@
  ***/
 
 #include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <limits.h>
 #include <unistd.h>
 #include <sys/utsname.h>
-#include <sys/stat.h>
 #include <fcntl.h>
 
 #include "util.h"
diff --git a/src/bus-proxyd/bus-proxyd.c b/src/bus-proxyd/bus-proxyd.c
index b6b0056..9645c50 100644
--- a/src/bus-proxyd/bus-proxyd.c
+++ b/src/bus-proxyd/bus-proxyd.c
@@ -23,13 +23,9 @@
 ***/
 
 #include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/types.h>
-#include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
-#include <poll.h>
 #include <sys/prctl.h>
 #include <stddef.h>
 #include <getopt.h>
@@ -37,24 +33,14 @@
 
 #include "log.h"
 #include "util.h"
-#include "hashmap.h"
-#include "socket-util.h"
 #include "sd-daemon.h"
-#include "sd-bus.h"
 #include "bus-internal.h"
-#include "bus-message.h"
-#include "bus-util.h"
 #include "build.h"
 #include "strv.h"
 #include "def.h"
 #include "capability.h"
-#include "bus-control.h"
-#include "smack-util.h"
-#include "set.h"
 #include "bus-xml-policy.h"
-#include "driver.h"
 #include "proxy.h"
-#include "synthesize.h"
 
 static char *arg_address = NULL;
 static char **arg_configuration = NULL;
diff --git a/src/bus-proxyd/bus-xml-policy.c b/src/bus-proxyd/bus-xml-policy.c
index f6ac0c0..497bce7 100644
--- a/src/bus-proxyd/bus-xml-policy.c
+++ b/src/bus-proxyd/bus-xml-policy.c
@@ -25,7 +25,6 @@
 #include "set.h"
 #include "conf-files.h"
 #include "bus-internal.h"
-#include "bus-message.h"
 #include "bus-xml-policy.h"
 #include "sd-login.h"
 
diff --git a/src/bus-proxyd/bus-xml-policy.h b/src/bus-proxyd/bus-xml-policy.h
index f2ec1bb..8f0ab8f 100644
--- a/src/bus-proxyd/bus-xml-policy.h
+++ b/src/bus-proxyd/bus-xml-policy.h
@@ -21,12 +21,10 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
 #include <pthread.h>
 
 #include "list.h"
 #include "hashmap.h"
-#include "set.h"
 
 typedef enum PolicyItemType {
         _POLICY_ITEM_TYPE_UNSET = 0,
diff --git a/src/bus-proxyd/driver.c b/src/bus-proxyd/driver.c
index bc2c0c8..3c613e4 100644
--- a/src/bus-proxyd/driver.c
+++ b/src/bus-proxyd/driver.c
@@ -21,23 +21,16 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
-#include <unistd.h>
 #include <string.h>
 #include <errno.h>
 #include <stddef.h>
 
-#include "log.h"
 #include "util.h"
 #include "sd-bus.h"
 #include "bus-internal.h"
 #include "bus-message.h"
 #include "bus-util.h"
-#include "build.h"
 #include "strv.h"
-#include "def.h"
-#include "capability.h"
-#include "bus-control.h"
 #include "set.h"
 #include "driver.h"
 #include "synthesize.h"
diff --git a/src/bus-proxyd/proxy.c b/src/bus-proxyd/proxy.c
index 3dea908..0c851f9 100644
--- a/src/bus-proxyd/proxy.c
+++ b/src/bus-proxyd/proxy.c
@@ -23,30 +23,20 @@
 ***/
 
 #include <sys/socket.h>
-#include <sys/un.h>
 #include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
 #include <string.h>
 #include <errno.h>
 #include <poll.h>
-#include <stddef.h>
-#include <getopt.h>
 
 #include "log.h"
 #include "util.h"
-#include "socket-util.h"
 #include "sd-daemon.h"
 #include "sd-bus.h"
 #include "bus-internal.h"
 #include "bus-message.h"
 #include "bus-util.h"
-#include "build.h"
 #include "strv.h"
-#include "def.h"
-#include "capability.h"
 #include "bus-control.h"
-#include "smack-util.h"
 #include "set.h"
 #include "bus-xml-policy.h"
 #include "driver.h"
diff --git a/src/bus-proxyd/proxy.h b/src/bus-proxyd/proxy.h
index 913d470..172bc7f 100644
--- a/src/bus-proxyd/proxy.h
+++ b/src/bus-proxyd/proxy.h
@@ -21,10 +21,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdlib.h>
 #include "sd-bus.h"
 #include "bus-xml-policy.h"
-#include "util.h"
 
 typedef struct Proxy Proxy;
 
diff --git a/src/bus-proxyd/stdio-bridge.c b/src/bus-proxyd/stdio-bridge.c
index 9fb3e9f..35e69a5 100644
--- a/src/bus-proxyd/stdio-bridge.c
+++ b/src/bus-proxyd/stdio-bridge.c
@@ -21,36 +21,22 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/types.h>
-#include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
-#include <poll.h>
 #include <stddef.h>
 #include <getopt.h>
 
 #include "log.h"
 #include "util.h"
-#include "socket-util.h"
 #include "sd-daemon.h"
 #include "sd-bus.h"
 #include "bus-internal.h"
-#include "bus-message.h"
 #include "bus-util.h"
 #include "build.h"
 #include "strv.h"
 #include "def.h"
-#include "capability.h"
-#include "bus-control.h"
-#include "smack-util.h"
-#include "set.h"
-#include "bus-xml-policy.h"
-#include "driver.h"
 #include "proxy.h"
-#include "synthesize.h"
 
 static char *arg_address = NULL;
 static char *arg_command_line_buffer = NULL;
diff --git a/src/bus-proxyd/synthesize.c b/src/bus-proxyd/synthesize.c
index e1b0fd3..542166f 100644
--- a/src/bus-proxyd/synthesize.c
+++ b/src/bus-proxyd/synthesize.c
@@ -21,21 +21,13 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
 #include <stddef.h>
 
-#include "log.h"
 #include "util.h"
 #include "sd-bus.h"
 #include "bus-internal.h"
 #include "bus-message.h"
 #include "bus-util.h"
-#include "strv.h"
-#include "def.h"
-#include "bus-control.h"
 #include "synthesize.h"
 
 static int synthetic_driver_send(sd_bus *b, sd_bus_message *m) {
diff --git a/src/bus-proxyd/test-bus-xml-policy.c b/src/bus-proxyd/test-bus-xml-policy.c
index 421487e..d19d0e1 100644
--- a/src/bus-proxyd/test-bus-xml-policy.c
+++ b/src/bus-proxyd/test-bus-xml-policy.c
@@ -19,27 +19,14 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/types.h>
-#include <fcntl.h>
 #include <unistd.h>
-#include <string.h>
 #include <errno.h>
-#include <poll.h>
 #include <stddef.h>
-#include <getopt.h>
 
 #include "log.h"
 #include "util.h"
 #include "sd-bus.h"
-#include "bus-internal.h"
-#include "bus-message.h"
-#include "bus-util.h"
-#include "build.h"
 #include "strv.h"
-#include "def.h"
-#include "capability.h"
 #include "bus-xml-policy.h"
 
 static int test_policy_load(Policy *p, const char *name) {
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c
index 579e06d..c6f5485 100644
--- a/src/cgls/cgls.c
+++ b/src/cgls/cgls.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <limits.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <errno.h>
diff --git a/src/console/consoled-display.c b/src/console/consoled-display.c
index a30a2f1..569c011 100644
--- a/src/console/consoled-display.c
+++ b/src/console/consoled-display.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <errno.h>
-#include <inttypes.h>
 #include <stdlib.h>
 #include "consoled.h"
 #include "grdev.h"
diff --git a/src/console/consoled-manager.c b/src/console/consoled-manager.c
index 9dd62f0..f82f211 100644
--- a/src/console/consoled-manager.c
+++ b/src/console/consoled-manager.c
@@ -20,15 +20,12 @@
 ***/
 
 #include <errno.h>
-#include <libudev.h>
 #include <stdlib.h>
-#include <string.h>
 #include "consoled.h"
 #include "grdev.h"
 #include "idev.h"
 #include "log.h"
 #include "sd-bus.h"
-#include "sd-daemon.h"
 #include "sd-event.h"
 #include "sd-login.h"
 #include "sysview.h"
diff --git a/src/console/consoled-session.c b/src/console/consoled-session.c
index 927965e..264a4d0 100644
--- a/src/console/consoled-session.c
+++ b/src/console/consoled-session.c
@@ -20,16 +20,12 @@
 ***/
 
 #include <errno.h>
-#include <inttypes.h>
-#include <libudev.h>
 #include <stdlib.h>
 #include "consoled.h"
 #include "grdev.h"
-#include "hashmap.h"
 #include "idev.h"
 #include "list.h"
 #include "macro.h"
-#include "sd-bus.h"
 #include "sd-event.h"
 #include "sysview.h"
 #include "util.h"
diff --git a/src/console/consoled-terminal.c b/src/console/consoled-terminal.c
index 19d1401..3657dca 100644
--- a/src/console/consoled-terminal.c
+++ b/src/console/consoled-terminal.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <errno.h>
-#include <inttypes.h>
 #include <stdlib.h>
 #include "consoled.h"
 #include "list.h"
diff --git a/src/console/consoled-workspace.c b/src/console/consoled-workspace.c
index 56344ef..5e9e5c7 100644
--- a/src/console/consoled-workspace.c
+++ b/src/console/consoled-workspace.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <errno.h>
-#include <inttypes.h>
 #include <stdlib.h>
 #include "consoled.h"
 #include "grdev.h"
diff --git a/src/console/consoled.c b/src/console/consoled.c
index 6f65dcd..26dd068 100644
--- a/src/console/consoled.c
+++ b/src/console/consoled.c
@@ -21,11 +21,9 @@
 
 #include <errno.h>
 #include <stdlib.h>
-#include <string.h>
 #include "consoled.h"
 #include "log.h"
 #include "sd-daemon.h"
-#include "util.h"
 
 int main(int argc, char *argv[]) {
         _cleanup_(manager_freep) Manager *m = NULL;
diff --git a/src/console/consoled.h b/src/console/consoled.h
index b0db610..f85c1a0 100644
--- a/src/console/consoled.h
+++ b/src/console/consoled.h
@@ -21,10 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <errno.h>
-#include <inttypes.h>
-#include <libudev.h>
-#include <stdlib.h>
 #include "grdev.h"
 #include "idev.h"
 #include "list.h"
diff --git a/src/core/automount.c b/src/core/automount.c
index 9f6bd84..4a509ef 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -32,8 +32,6 @@
 #include "unit.h"
 #include "automount.h"
 #include "mount.h"
-#include "load-fragment.h"
-#include "load-dropin.h"
 #include "unit-name.h"
 #include "special.h"
 #include "label.h"
diff --git a/src/core/busname.h b/src/core/busname.h
index 775822d..69528a2 100644
--- a/src/core/busname.h
+++ b/src/core/busname.h
@@ -24,7 +24,6 @@
 typedef struct BusName BusName;
 typedef struct BusNamePolicy BusNamePolicy;
 
-#include "unit.h"
 
 typedef enum BusNameState {
         BUSNAME_DEAD,
diff --git a/src/core/cgroup.h b/src/core/cgroup.h
index 8fa851d..993aa9d 100644
--- a/src/core/cgroup.h
+++ b/src/core/cgroup.h
@@ -91,7 +91,6 @@ struct CGroupContext {
 };
 
 #include "unit.h"
-#include "manager.h"
 #include "cgroup-util.h"
 
 void cgroup_context_init(CGroupContext *c);
diff --git a/src/core/dbus-automount.c b/src/core/dbus-automount.c
index b2a510a..38acbd0 100644
--- a/src/core/dbus-automount.c
+++ b/src/core/dbus-automount.c
@@ -19,9 +19,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "unit.h"
 #include "automount.h"
-#include "dbus-unit.h"
 #include "dbus-automount.h"
 #include "bus-util.h"
 
diff --git a/src/core/dbus-automount.h b/src/core/dbus-automount.h
index 1bec953..a2b124d 100644
--- a/src/core/dbus-automount.h
+++ b/src/core/dbus-automount.h
@@ -21,6 +21,5 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "sd-bus.h"
 
 extern const sd_bus_vtable bus_automount_vtable[];
diff --git a/src/core/dbus-busname.c b/src/core/dbus-busname.c
index 28f1924..b1ceb05 100644
--- a/src/core/dbus-busname.c
+++ b/src/core/dbus-busname.c
@@ -21,7 +21,6 @@
 
 #include "unit.h"
 #include "busname.h"
-#include "dbus-unit.h"
 #include "dbus-busname.h"
 #include "bus-util.h"
 
diff --git a/src/core/dbus-busname.h b/src/core/dbus-busname.h
index b5eed37..ea55b6c 100644
--- a/src/core/dbus-busname.h
+++ b/src/core/dbus-busname.h
@@ -21,7 +21,5 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "sd-bus.h"
-#include "unit.h"
 
 extern const sd_bus_vtable bus_busname_vtable[];
diff --git a/src/core/dbus-device.c b/src/core/dbus-device.c
index f556536..cb156fd 100644
--- a/src/core/dbus-device.c
+++ b/src/core/dbus-device.c
@@ -21,7 +21,6 @@
 
 #include "unit.h"
 #include "device.h"
-#include "dbus-unit.h"
 #include "dbus-device.h"
 
 const sd_bus_vtable bus_device_vtable[] = {
diff --git a/src/core/dbus-device.h b/src/core/dbus-device.h
index 4aff226..10e945e 100644
--- a/src/core/dbus-device.h
+++ b/src/core/dbus-device.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "sd-bus.h"
 #include "unit.h"
 
 extern const sd_bus_vtable bus_device_vtable[];
diff --git a/src/core/dbus-manager.h b/src/core/dbus-manager.h
index e1903fa..3730deb 100644
--- a/src/core/dbus-manager.h
+++ b/src/core/dbus-manager.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "sd-bus.h"
 #include "manager.h"
 
 extern const sd_bus_vtable bus_manager_vtable[];
diff --git a/src/core/dbus-mount.c b/src/core/dbus-mount.c
index 53fe4ed..24813c6 100644
--- a/src/core/dbus-mount.c
+++ b/src/core/dbus-mount.c
@@ -21,7 +21,6 @@
 
 #include "unit.h"
 #include "mount.h"
-#include "dbus-unit.h"
 #include "dbus-execute.h"
 #include "dbus-kill.h"
 #include "dbus-cgroup.h"
diff --git a/src/core/dbus-path.c b/src/core/dbus-path.c
index b5e8941..6835619 100644
--- a/src/core/dbus-path.c
+++ b/src/core/dbus-path.c
@@ -21,7 +21,6 @@
 
 #include "unit.h"
 #include "path.h"
-#include "dbus-unit.h"
 #include "dbus-path.h"
 #include "bus-util.h"
 
diff --git a/src/core/dbus-path.h b/src/core/dbus-path.h
index 667da05..389b0d7 100644
--- a/src/core/dbus-path.h
+++ b/src/core/dbus-path.h
@@ -22,6 +22,5 @@
 ***/
 
 
-#include "sd-bus.h"
 
 extern const sd_bus_vtable bus_path_vtable[];
diff --git a/src/core/dbus-scope.c b/src/core/dbus-scope.c
index 60215a1..7087c63 100644
--- a/src/core/dbus-scope.c
+++ b/src/core/dbus-scope.c
@@ -21,7 +21,6 @@
 
 #include "unit.h"
 #include "scope.h"
-#include "dbus-unit.h"
 #include "dbus-cgroup.h"
 #include "dbus-kill.h"
 #include "dbus-scope.h"
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c
index 6d4713b..e1f3d56 100644
--- a/src/core/dbus-service.c
+++ b/src/core/dbus-service.c
@@ -23,7 +23,6 @@
 #include "path-util.h"
 #include "unit.h"
 #include "service.h"
-#include "dbus-unit.h"
 #include "dbus-execute.h"
 #include "dbus-kill.h"
 #include "dbus-cgroup.h"
diff --git a/src/core/dbus-slice.c b/src/core/dbus-slice.c
index 8bc90b1..09e78d1 100644
--- a/src/core/dbus-slice.c
+++ b/src/core/dbus-slice.c
@@ -21,7 +21,6 @@
 
 #include "unit.h"
 #include "slice.h"
-#include "dbus-unit.h"
 #include "dbus-cgroup.h"
 #include "dbus-slice.h"
 
diff --git a/src/core/dbus-snapshot.c b/src/core/dbus-snapshot.c
index 06a58e4..352e788 100644
--- a/src/core/dbus-snapshot.c
+++ b/src/core/dbus-snapshot.c
@@ -22,7 +22,6 @@
 #include "selinux-access.h"
 #include "unit.h"
 #include "snapshot.h"
-#include "dbus-unit.h"
 #include "dbus-snapshot.h"
 
 int bus_snapshot_method_remove(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c
index 50b1674..02599a9 100644
--- a/src/core/dbus-socket.c
+++ b/src/core/dbus-socket.c
@@ -21,9 +21,7 @@
 
 #include "unit.h"
 #include "socket.h"
-#include "dbus-unit.h"
 #include "dbus-execute.h"
-#include "dbus-kill.h"
 #include "dbus-cgroup.h"
 #include "dbus-socket.h"
 #include "bus-util.h"
diff --git a/src/core/dbus-swap.c b/src/core/dbus-swap.c
index 1e7f66d..0093371 100644
--- a/src/core/dbus-swap.c
+++ b/src/core/dbus-swap.c
@@ -22,9 +22,7 @@
 
 #include "unit.h"
 #include "swap.h"
-#include "dbus-unit.h"
 #include "dbus-execute.h"
-#include "dbus-kill.h"
 #include "dbus-cgroup.h"
 #include "dbus-swap.h"
 #include "bus-util.h"
diff --git a/src/core/dbus-target.c b/src/core/dbus-target.c
index 205d1c4..350f5c3 100644
--- a/src/core/dbus-target.c
+++ b/src/core/dbus-target.c
@@ -20,8 +20,6 @@
 ***/
 
 #include "unit.h"
-#include "target.h"
-#include "dbus-unit.h"
 #include "dbus-target.h"
 
 const sd_bus_vtable bus_target_vtable[] = {
diff --git a/src/core/dbus-target.h b/src/core/dbus-target.h
index 6be9c9f..4c4297b 100644
--- a/src/core/dbus-target.h
+++ b/src/core/dbus-target.h
@@ -21,6 +21,5 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "sd-bus.h"
 
 extern const sd_bus_vtable bus_target_vtable[];
diff --git a/src/core/dbus-timer.c b/src/core/dbus-timer.c
index 43e7852..74a9914 100644
--- a/src/core/dbus-timer.c
+++ b/src/core/dbus-timer.c
@@ -21,10 +21,8 @@
 
 #include "unit.h"
 #include "timer.h"
-#include "dbus-unit.h"
 #include "dbus-timer.h"
 #include "bus-util.h"
-#include "errno-list.h"
 #include "strv.h"
 
 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, timer_result, TimerResult);
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index 625d21a..d3e2d8a 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -24,11 +24,8 @@
 #include "selinux-access.h"
 #include "cgroup-util.h"
 #include "strv.h"
-#include "path-util.h"
-#include "fileio.h"
 #include "bus-common-errors.h"
 #include "dbus.h"
-#include "dbus-manager.h"
 #include "dbus-unit.h"
 
 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_load_state, unit_load_state, UnitLoadState);
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 260775c..89a0436 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <sys/epoll.h>
-#include <sys/timerfd.h>
 #include <errno.h>
 #include <unistd.h>
 
diff --git a/src/core/device.c b/src/core/device.c
index d3deac3..2d983cc 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -23,11 +23,9 @@
 #include <sys/epoll.h>
 #include <libudev.h>
 
-#include "strv.h"
 #include "log.h"
 #include "unit-name.h"
 #include "dbus-device.h"
-#include "def.h"
 #include "path-util.h"
 #include "udev-util.h"
 #include "unit.h"
diff --git a/src/core/device.h b/src/core/device.h
index bb7ae07..9065085 100644
--- a/src/core/device.h
+++ b/src/core/device.h
@@ -23,7 +23,6 @@
 
 typedef struct Device Device;
 
-#include "unit.h"
 
 /* We simply watch devices, we cannot plug/unplug them. That
  * simplifies the state engine greatly */
diff --git a/src/core/execute.c b/src/core/execute.c
index 1815e3d..39ec5ad 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -19,8 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
-#include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <unistd.h>
@@ -29,14 +27,8 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/prctl.h>
-#include <linux/sched.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <grp.h>
-#include <pwd.h>
-#include <sys/mount.h>
-#include <linux/fs.h>
-#include <linux/oom.h>
 #include <poll.h>
 #include <glob.h>
 #include <sys/personality.h>
@@ -80,12 +72,14 @@
 #include "errno-list.h"
 #include "af-list.h"
 #include "mkdir.h"
-#include "apparmor-util.h"
 #include "smack-util.h"
 #include "bus-endpoint.h"
-#include "label.h"
 #include "cap-list.h"
 
+#ifdef HAVE_APPARMOR
+#include "apparmor-util.h"
+#endif
+
 #ifdef HAVE_SECCOMP
 #include "seccomp-util.h"
 #endif
diff --git a/src/core/execute.h b/src/core/execute.h
index 6e0c9fa..1a43ac7 100644
--- a/src/core/execute.h
+++ b/src/core/execute.h
@@ -27,17 +27,12 @@ typedef struct ExecContext ExecContext;
 typedef struct ExecRuntime ExecRuntime;
 typedef struct ExecParameters ExecParameters;
 
-#include <linux/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
 #include <sys/capability.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <sched.h>
 
 #include "list.h"
-#include "util.h"
-#include "set.h"
 #include "fdset.h"
 #include "missing.h"
 #include "namespace.h"
diff --git a/src/core/failure-action.c b/src/core/failure-action.c
index ce522a4..ffeb5cd 100644
--- a/src/core/failure-action.c
+++ b/src/core/failure-action.c
@@ -22,7 +22,6 @@
 
 #include <sys/reboot.h>
 #include <linux/reboot.h>
-#include <sys/syscall.h>
 
 #include "bus-util.h"
 #include "bus-error.h"
diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c
index 6664e89..03b0ce3 100644
--- a/src/core/hostname-setup.c
+++ b/src/core/hostname-setup.c
@@ -19,10 +19,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <unistd.h>
 #include <stdio.h>
 #include <errno.h>
-#include <string.h>
 #include <stdlib.h>
 
 #include "hostname-setup.h"
diff --git a/src/core/ima-setup.c b/src/core/ima-setup.c
index 0e0d16a..7721b3e 100644
--- a/src/core/ima-setup.c
+++ b/src/core/ima-setup.c
@@ -22,10 +22,7 @@
 ***/
 
 #include <unistd.h>
-#include <stdio.h>
 #include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <fcntl.h>
 
 #include "ima-setup.h"
diff --git a/src/core/job.c b/src/core/job.c
index 4740ff1..db7ebae 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -19,10 +19,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <errno.h>
-#include <sys/timerfd.h>
-#include <sys/epoll.h>
 
 #include "sd-id128.h"
 #include "sd-messages.h"
@@ -30,8 +27,6 @@
 #include "unit.h"
 #include "macro.h"
 #include "strv.h"
-#include "load-fragment.h"
-#include "load-dropin.h"
 #include "log.h"
 #include "dbus-job.h"
 #include "special.h"
diff --git a/src/core/job.h b/src/core/job.h
index d967b68..9119e48 100644
--- a/src/core/job.h
+++ b/src/core/job.h
@@ -22,8 +22,6 @@
 ***/
 
 #include <stdbool.h>
-#include <inttypes.h>
-#include <errno.h>
 
 typedef struct Job Job;
 typedef struct JobDependency JobDependency;
@@ -108,9 +106,7 @@ enum JobResult {
 };
 
 #include "sd-event.h"
-#include "manager.h"
 #include "unit.h"
-#include "hashmap.h"
 #include "list.h"
 
 struct JobDependency {
diff --git a/src/core/kill.c b/src/core/kill.c
index 4271346..60a510e 100644
--- a/src/core/kill.c
+++ b/src/core/kill.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <string.h>
 
 #include "kill.h"
 #include "util.h"
diff --git a/src/core/killall.c b/src/core/killall.c
index 5a50ae6..c6f1ddf 100644
--- a/src/core/killall.c
+++ b/src/core/killall.c
@@ -25,7 +25,6 @@
 #include <unistd.h>
 
 #include "util.h"
-#include "def.h"
 #include "killall.h"
 #include "set.h"
 
diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
index c0a05b9..efbdf31 100644
--- a/src/core/kmod-setup.c
+++ b/src/core/kmod-setup.c
@@ -19,17 +19,14 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/wait.h>
 #include <unistd.h>
 #include <string.h>
-#include <errno.h>
 
 #ifdef HAVE_KMOD
 #include <libkmod.h>
 #endif
 
 #include "macro.h"
-#include "execute.h"
 #include "capability.h"
 #include "kmod-setup.h"
 
diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c
index 8be1900..11566af 100644
--- a/src/core/load-dropin.c
+++ b/src/core/load-dropin.c
@@ -19,8 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <dirent.h>
-#include <errno.h>
 
 #include "unit.h"
 #include "load-dropin.h"
@@ -29,7 +27,6 @@
 #include "unit-name.h"
 #include "conf-parser.h"
 #include "load-fragment.h"
-#include "conf-files.h"
 
 static int add_dependency_consumer(
                 UnitDependency dependency,
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 90bf563..6d0192f 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -21,26 +21,18 @@
 ***/
 
 #include <linux/oom.h>
-#include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <unistd.h>
 #include <fcntl.h>
 #include <sched.h>
-#include <sys/prctl.h>
-#include <sys/mount.h>
 #include <linux/fs.h>
 #include <sys/stat.h>
-#include <sys/time.h>
 #include <sys/resource.h>
-#include <sys/types.h>
-#include <grp.h>
 
 #ifdef HAVE_SECCOMP
 #include <seccomp.h>
 #endif
 
-#include "sd-messages.h"
 #include "unit.h"
 #include "strv.h"
 #include "conf-parser.h"
diff --git a/src/core/locale-setup.c b/src/core/locale-setup.c
index e993c57..108072c 100644
--- a/src/core/locale-setup.c
+++ b/src/core/locale-setup.c
@@ -19,13 +19,11 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <string.h>
 #include <stdlib.h>
 #include <errno.h>
 
 #include "locale-setup.h"
 #include "util.h"
-#include "macro.h"
 #include "virt.h"
 #include "fileio.h"
 #include "strv.h"
diff --git a/src/core/loopback-setup.c b/src/core/loopback-setup.c
index 67ce160..63b15c1 100644
--- a/src/core/loopback-setup.c
+++ b/src/core/loopback-setup.c
@@ -19,18 +19,10 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/socket.h>
 #include <net/if.h>
-#include <asm/types.h>
-#include <netinet/in.h>
-#include <string.h>
 #include <stdlib.h>
-#include <unistd.h>
 
 #include "sd-rtnl.h"
-#include "util.h"
-#include "macro.h"
-#include "socket-util.h"
 #include "rtnl-util.h"
 #include "missing.h"
 #include "loopback-setup.h"
diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c
index d00a532..063f705 100644
--- a/src/core/machine-id-setup.c
+++ b/src/core/machine-id-setup.c
@@ -23,7 +23,6 @@
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
-#include <stdlib.h>
 #include <fcntl.h>
 #include <sys/mount.h>
 
diff --git a/src/core/main.c b/src/core/main.c
index ba2de85..bc6f149 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -23,11 +23,9 @@
 #include <errno.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <getopt.h>
 #include <signal.h>
-#include <sys/wait.h>
 #include <fcntl.h>
 #include <sys/prctl.h>
 #include <sys/mount.h>
@@ -40,14 +38,12 @@
 #endif
 
 #include "sd-daemon.h"
-#include "sd-messages.h"
 #include "sd-bus.h"
 #include "log.h"
 #include "fdset.h"
 #include "special.h"
 #include "conf-parser.h"
 #include "missing.h"
-#include "label.h"
 #include "pager.h"
 #include "build.h"
 #include "strv.h"
@@ -55,7 +51,6 @@
 #include "virt.h"
 #include "architecture.h"
 #include "watchdog.h"
-#include "path-util.h"
 #include "switch-root.h"
 #include "capability.h"
 #include "killall.h"
diff --git a/src/core/manager.c b/src/core/manager.c
index 4775219..79a9d54 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <errno.h>
 #include <string.h>
 #include <signal.h>
@@ -27,14 +26,10 @@
 #include <unistd.h>
 #include <sys/inotify.h>
 #include <sys/epoll.h>
-#include <poll.h>
 #include <sys/reboot.h>
 #include <sys/ioctl.h>
 #include <linux/kd.h>
-#include <termios.h>
 #include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <dirent.h>
 #include <sys/timerfd.h>
 
@@ -43,7 +38,6 @@
 #endif
 
 #include "sd-daemon.h"
-#include "sd-id128.h"
 #include "sd-messages.h"
 
 #include "manager.h"
@@ -56,7 +50,6 @@
 #include "mkdir.h"
 #include "ratelimit.h"
 #include "locale-setup.h"
-#include "mount-setup.h"
 #include "unit-name.h"
 #include "missing.h"
 #include "path-lookup.h"
@@ -64,7 +57,6 @@
 #include "exit-status.h"
 #include "virt.h"
 #include "watchdog.h"
-#include "cgroup-util.h"
 #include "path-util.h"
 #include "audit-fd.h"
 #include "boot-timestamps.h"
diff --git a/src/core/manager.h b/src/core/manager.h
index d3971f1..4e33ba6 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -22,7 +22,6 @@
 ***/
 
 #include <stdbool.h>
-#include <inttypes.h>
 #include <stdio.h>
 
 #include "sd-bus.h"
@@ -31,7 +30,6 @@
 #include "cgroup-util.h"
 #include "hashmap.h"
 #include "list.h"
-#include "set.h"
 #include "ratelimit.h"
 
 /* Enforce upper limit how many names we allow */
@@ -70,14 +68,11 @@ typedef enum StatusType {
         STATUS_TYPE_EMERGENCY,
 } StatusType;
 
-#include "unit.h"
 #include "job.h"
 #include "path-lookup.h"
 #include "execute.h"
 #include "unit-name.h"
-#include "exit-status.h"
 #include "show-status.h"
-#include "failure-action.h"
 
 struct Manager {
         /* Note that the set of units we know of is allowed to be
diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
index 521545e..343ff06 100644
--- a/src/core/mount-setup.c
+++ b/src/core/mount-setup.c
@@ -21,10 +21,7 @@
 
 #include <sys/mount.h>
 #include <errno.h>
-#include <sys/stat.h>
 #include <stdlib.h>
-#include <string.h>
-#include <assert.h>
 #include <unistd.h>
 #include <ftw.h>
 
@@ -42,7 +39,6 @@
 #include "virt.h"
 #include "efivars.h"
 #include "smack-util.h"
-#include "def.h"
 #include "cgroup-util.h"
 
 typedef enum MountMode {
diff --git a/src/core/mount.c b/src/core/mount.c
index f3977e6..40037e7 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -21,7 +21,6 @@
 
 #include <errno.h>
 #include <stdio.h>
-#include <mntent.h>
 #include <sys/epoll.h>
 #include <signal.h>
 #include <libmount.h>
@@ -30,8 +29,6 @@
 #include "manager.h"
 #include "unit.h"
 #include "mount.h"
-#include "load-fragment.h"
-#include "load-dropin.h"
 #include "log.h"
 #include "sd-messages.h"
 #include "strv.h"
@@ -41,9 +38,7 @@
 #include "unit-name.h"
 #include "dbus-mount.h"
 #include "special.h"
-#include "bus-common-errors.h"
 #include "exit-status.h"
-#include "def.h"
 #include "fstab-util.h"
 
 #define RETRY_UMOUNT_MAX 32
diff --git a/src/core/mount.h b/src/core/mount.h
index d6987e6..76771ab 100644
--- a/src/core/mount.h
+++ b/src/core/mount.h
@@ -23,10 +23,8 @@
 
 typedef struct Mount Mount;
 
-#include "unit.h"
 #include "kill.h"
 #include "execute.h"
-#include "cgroup.h"
 
 typedef enum MountState {
         MOUNT_DEAD,
diff --git a/src/core/namespace.c b/src/core/namespace.c
index 4fecd32..6a6d119 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -25,23 +25,15 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 #include <sched.h>
-#include <sys/syscall.h>
-#include <limits.h>
 #include <linux/fs.h>
-#include <sys/file.h>
 
 #include "strv.h"
 #include "util.h"
 #include "path-util.h"
 #include "missing.h"
-#include "execute.h"
 #include "loopback-setup.h"
-#include "mkdir.h"
 #include "dev-setup.h"
-#include "def.h"
-#include "label.h"
 #include "selinux-util.h"
 #include "namespace.h"
 
diff --git a/src/core/path.c b/src/core/path.c
index e5ea79f..fbb695d 100644
--- a/src/core/path.c
+++ b/src/core/path.c
@@ -21,7 +21,6 @@
 
 #include <sys/inotify.h>
 #include <sys/epoll.h>
-#include <sys/ioctl.h>
 #include <errno.h>
 #include <unistd.h>
 
@@ -31,7 +30,6 @@
 #include "mkdir.h"
 #include "dbus-path.h"
 #include "special.h"
-#include "path-util.h"
 #include "macro.h"
 #include "bus-util.h"
 #include "bus-error.h"
diff --git a/src/core/path.h b/src/core/path.h
index 0d36aab..dec3933 100644
--- a/src/core/path.h
+++ b/src/core/path.h
@@ -25,7 +25,6 @@ typedef struct Path Path;
 typedef struct PathSpec PathSpec;
 
 #include "unit.h"
-#include "mount.h"
 
 typedef enum PathState {
         PATH_DEAD,
diff --git a/src/core/scope.c b/src/core/scope.c
index b41db78..a0e4732 100644
--- a/src/core/scope.c
+++ b/src/core/scope.c
@@ -20,12 +20,10 @@
 ***/
 
 #include <errno.h>
-#include <signal.h>
 #include <unistd.h>
 
 #include "unit.h"
 #include "scope.h"
-#include "load-fragment.h"
 #include "log.h"
 #include "dbus-scope.h"
 #include "special.h"
diff --git a/src/core/scope.h b/src/core/scope.h
index 6c59126..4452fe2 100644
--- a/src/core/scope.h
+++ b/src/core/scope.h
@@ -23,7 +23,6 @@
 
 typedef struct Scope Scope;
 
-#include "unit.h"
 #include "kill.h"
 
 typedef enum ScopeState {
diff --git a/src/core/selinux-access.c b/src/core/selinux-access.c
index 1888874..a8c9a4b 100644
--- a/src/core/selinux-access.c
+++ b/src/core/selinux-access.c
@@ -24,12 +24,9 @@
 #ifdef HAVE_SELINUX
 
 #include <stdio.h>
-#include <string.h>
 #include <errno.h>
-#include <limits.h>
 #include <selinux/selinux.h>
 #include <selinux/avc.h>
-#include <sys/socket.h>
 #ifdef HAVE_AUDIT
 #include <libaudit.h>
 #endif
@@ -38,7 +35,6 @@
 #include "bus-util.h"
 #include "util.h"
 #include "log.h"
-#include "audit.h"
 #include "selinux-util.h"
 #include "audit-fd.h"
 #include "strv.h"
diff --git a/src/core/selinux-access.h b/src/core/selinux-access.h
index dd1e8bb..b5758e2 100644
--- a/src/core/selinux-access.h
+++ b/src/core/selinux-access.h
@@ -22,7 +22,6 @@
 ***/
 
 #include "sd-bus.h"
-#include "bus-error.h"
 #include "bus-util.h"
 #include "manager.h"
 
diff --git a/src/core/selinux-setup.c b/src/core/selinux-setup.c
index fba915d..a467850 100644
--- a/src/core/selinux-setup.c
+++ b/src/core/selinux-setup.c
@@ -22,8 +22,6 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <errno.h>
-#include <string.h>
-#include <stdlib.h>
 
 #ifdef HAVE_SELINUX
 #include <selinux/selinux.h>
@@ -31,8 +29,6 @@
 
 #include "selinux-setup.h"
 #include "selinux-util.h"
-#include "label.h"
-#include "mount-setup.h"
 #include "macro.h"
 #include "util.h"
 #include "log.h"
diff --git a/src/core/service.c b/src/core/service.c
index 15e29be..c7b3505 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -21,7 +21,6 @@
 
 #include <errno.h>
 #include <signal.h>
-#include <dirent.h>
 #include <unistd.h>
 
 #include "async.h"
diff --git a/src/core/service.h b/src/core/service.h
index dfeee6a..fe5afef 100644
--- a/src/core/service.h
+++ b/src/core/service.h
@@ -24,12 +24,10 @@
 typedef struct Service Service;
 typedef struct ServiceFDStore ServiceFDStore;
 
-#include "unit.h"
 #include "path.h"
 #include "ratelimit.h"
 #include "kill.h"
 #include "exit-status.h"
-#include "failure-action.h"
 
 typedef enum ServiceState {
         SERVICE_DEAD,
diff --git a/src/core/shutdown.c b/src/core/shutdown.c
index 71f001a..70a461e 100644
--- a/src/core/shutdown.c
+++ b/src/core/shutdown.c
@@ -20,21 +20,15 @@
 ***/
 
 #include <sys/mman.h>
-#include <sys/types.h>
 #include <sys/reboot.h>
 #include <linux/reboot.h>
-#include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/mount.h>
-#include <sys/syscall.h>
-#include <fcntl.h>
-#include <dirent.h>
 #include <errno.h>
 #include <unistd.h>
 #include <signal.h>
 #include <stdbool.h>
 #include <stdlib.h>
-#include <string.h>
 #include <getopt.h>
 
 #include "missing.h"
@@ -42,14 +36,12 @@
 #include "fileio.h"
 #include "umount.h"
 #include "util.h"
-#include "mkdir.h"
 #include "virt.h"
 #include "watchdog.h"
 #include "killall.h"
 #include "cgroup-util.h"
 #include "def.h"
 #include "switch-root.h"
-#include "strv.h"
 
 #define FINALIZE_ATTEMPTS 50
 
diff --git a/src/core/slice.c b/src/core/slice.c
index ae9819d..4d2eaf7 100644
--- a/src/core/slice.c
+++ b/src/core/slice.c
@@ -20,12 +20,9 @@
 ***/
 
 #include <errno.h>
-#include <signal.h>
-#include <unistd.h>
 
 #include "unit.h"
 #include "slice.h"
-#include "load-fragment.h"
 #include "log.h"
 #include "dbus-slice.h"
 #include "special.h"
diff --git a/src/core/slice.h b/src/core/slice.h
index ad0c639..ac648e5 100644
--- a/src/core/slice.h
+++ b/src/core/slice.h
@@ -23,7 +23,6 @@
 
 typedef struct Slice Slice;
 
-#include "unit.h"
 
 typedef enum SliceState {
         SLICE_DEAD,
diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
index 59f6832..ff2a020 100644
--- a/src/core/smack-setup.c
+++ b/src/core/smack-setup.c
@@ -24,21 +24,15 @@
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
-#include <unistd.h>
 #include <stdlib.h>
-#include <sys/vfs.h>
 #include <fcntl.h>
-#include <sys/types.h>
 #include <dirent.h>
-#include <sys/mount.h>
-#include <stdint.h>
 
 #include "macro.h"
 #include "smack-setup.h"
 #include "util.h"
 #include "fileio.h"
 #include "log.h"
-#include "label.h"
 
 #define SMACK_CONFIG "/etc/smack/accesses.d/"
 #define CIPSO_CONFIG "/etc/smack/cipso.d/"
diff --git a/src/core/snapshot.h b/src/core/snapshot.h
index e6dc661..f2451b1 100644
--- a/src/core/snapshot.h
+++ b/src/core/snapshot.h
@@ -23,7 +23,6 @@
 
 typedef struct Snapshot Snapshot;
 
-#include "unit.h"
 
 typedef enum SnapshotState {
         SNAPSHOT_DEAD,
diff --git a/src/core/socket.c b/src/core/socket.c
index 48c43a2..b7daabf 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <errno.h>
@@ -29,15 +28,11 @@
 #include <arpa/inet.h>
 #include <netinet/tcp.h>
 #include <mqueue.h>
-#include <sys/xattr.h>
 
 #include "sd-event.h"
 #include "log.h"
-#include "load-dropin.h"
-#include "load-fragment.h"
 #include "strv.h"
 #include "mkdir.h"
-#include "path-util.h"
 #include "unit-name.h"
 #include "unit-printf.h"
 #include "missing.h"
diff --git a/src/core/socket.h b/src/core/socket.h
index a2e0899..5acf214 100644
--- a/src/core/socket.h
+++ b/src/core/socket.h
@@ -23,8 +23,6 @@
 
 typedef struct Socket Socket;
 
-#include "manager.h"
-#include "unit.h"
 #include "socket-util.h"
 #include "mount.h"
 #include "service.h"
diff --git a/src/core/swap.c b/src/core/swap.c
index 6997921..f73a8e6 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -20,24 +20,17 @@
 ***/
 
 #include <errno.h>
-#include <limits.h>
 #include <unistd.h>
-#include <fcntl.h>
 #include <sys/epoll.h>
 #include <sys/stat.h>
-#include <sys/swap.h>
 #include <libudev.h>
 
 #include "unit.h"
 #include "swap.h"
-#include "load-fragment.h"
-#include "load-dropin.h"
 #include "unit-name.h"
 #include "dbus-swap.h"
 #include "special.h"
-#include "bus-common-errors.h"
 #include "exit-status.h"
-#include "def.h"
 #include "path-util.h"
 #include "virt.h"
 #include "udev-util.h"
diff --git a/src/core/swap.h b/src/core/swap.h
index 73e64d8..c36c6f2 100644
--- a/src/core/swap.h
+++ b/src/core/swap.h
@@ -26,7 +26,6 @@
 
 typedef struct Swap Swap;
 
-#include "unit.h"
 
 typedef enum SwapState {
         SWAP_DEAD,
diff --git a/src/core/target.c b/src/core/target.c
index 33fb66b..8817ef2 100644
--- a/src/core/target.c
+++ b/src/core/target.c
@@ -19,13 +19,9 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
 
 #include "unit.h"
 #include "target.h"
-#include "load-fragment.h"
 #include "log.h"
 #include "dbus-target.h"
 #include "special.h"
diff --git a/src/core/target.h b/src/core/target.h
index a5398d9..0a25ef4 100644
--- a/src/core/target.h
+++ b/src/core/target.h
@@ -23,7 +23,6 @@
 
 typedef struct Target Target;
 
-#include "unit.h"
 
 typedef enum TargetState {
         TARGET_DEAD,
diff --git a/src/core/timer.c b/src/core/timer.c
index 45744c7..9405501 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -28,7 +28,6 @@
 #include "special.h"
 #include "bus-util.h"
 #include "bus-error.h"
-#include "mkdir.h"
 
 static const UnitActiveState state_translation_table[_TIMER_STATE_MAX] = {
         [TIMER_DEAD] = UNIT_INACTIVE,
diff --git a/src/core/timer.h b/src/core/timer.h
index de412a0..9d919e4 100644
--- a/src/core/timer.h
+++ b/src/core/timer.h
@@ -23,7 +23,6 @@
 
 typedef struct Timer Timer;
 
-#include "unit.h"
 #include "calendarspec.h"
 
 typedef enum TimerState {
diff --git a/src/core/transaction.c b/src/core/transaction.c
index b0b3d6b..64c2af5 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -23,7 +23,6 @@
 #include <fcntl.h>
 
 #include "bus-common-errors.h"
-#include "bus-util.h"
 #include "bus-error.h"
 #include "transaction.h"
 
diff --git a/src/core/umount.c b/src/core/umount.c
index dd7df19..ceee70f 100644
--- a/src/core/umount.c
+++ b/src/core/umount.c
@@ -24,7 +24,6 @@
 #include <string.h>
 #include <sys/mount.h>
 #include <sys/swap.h>
-#include <unistd.h>
 #include <linux/loop.h>
 #include <linux/dm-ioctl.h>
 
diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c
index 97135db..7736899 100644
--- a/src/core/unit-printf.c
+++ b/src/core/unit-printf.c
@@ -19,16 +19,13 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "sd-id128.h"
 #include "unit.h"
 #include "specifier.h"
-#include "path-util.h"
 #include "strv.h"
 #include "unit-name.h"
 #include "unit-printf.h"
 #include "macro.h"
 #include "cgroup-util.h"
-#include "special.h"
 
 static int specifier_prefix_and_instance(char specifier, void *data, void *userdata, char **ret) {
         Unit *u = userdata;
diff --git a/src/core/unit.c b/src/core/unit.c
index ee8e607..ad5348b 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -19,12 +19,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <sys/epoll.h>
-#include <sys/timerfd.h>
-#include <poll.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/stat.h>
@@ -45,12 +41,10 @@
 #include "cgroup-util.h"
 #include "missing.h"
 #include "mkdir.h"
-#include "label.h"
 #include "fileio-label.h"
 #include "bus-common-errors.h"
 #include "dbus.h"
 #include "execute.h"
-#include "virt.h"
 #include "dropin.h"
 
 const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX] = {
diff --git a/src/core/unit.h b/src/core/unit.h
index 291bc77..b3775d4 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -31,13 +31,7 @@ typedef enum UnitActiveState UnitActiveState;
 typedef struct UnitRef UnitRef;
 typedef struct UnitStatusMessageFormats UnitStatusMessageFormats;
 
-#include "sd-event.h"
-#include "set.h"
-#include "util.h"
 #include "list.h"
-#include "socket-util.h"
-#include "execute.h"
-#include "cgroup.h"
 #include "condition.h"
 #include "install.h"
 #include "unit-name.h"
@@ -76,7 +70,6 @@ static inline bool UNIT_IS_INACTIVE_OR_FAILED(UnitActiveState t) {
         return t == UNIT_INACTIVE || t == UNIT_FAILED;
 }
 
-#include "manager.h"
 #include "job.h"
 
 struct UnitRef {
@@ -249,13 +242,11 @@ typedef enum UnitSetPropertiesMode {
         UNIT_PERSISTENT = 2,
 } UnitSetPropertiesMode;
 
-#include "service.h"
 #include "socket.h"
 #include "busname.h"
 #include "target.h"
 #include "snapshot.h"
 #include "device.h"
-#include "mount.h"
 #include "automount.h"
 #include "swap.h"
 #include "timer.h"
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 05061c0..5a0611a 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -20,11 +20,8 @@
 ***/
 
 #include <errno.h>
-#include <string.h>
-#include <unistd.h>
 
 #include "dropin.h"
-#include "fileio.h"
 #include "generator.h"
 #include "hashmap.h"
 #include "log.h"
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 3f613d9..9e0fef7 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -32,7 +32,6 @@
 #include "path-util.h"
 #include "strv.h"
 #include "ask-password-api.h"
-#include "def.h"
 #include "libudev.h"
 #include "udev-util.h"
 
diff --git a/src/delta/delta.c b/src/delta/delta.c
index de963f7..9f1f8f3 100644
--- a/src/delta/delta.c
+++ b/src/delta/delta.c
@@ -21,7 +21,6 @@
 ***/
 
 #include <errno.h>
-#include <assert.h>
 #include <string.h>
 #include <unistd.h>
 #include <getopt.h>
diff --git a/src/detect-virt/detect-virt.c b/src/detect-virt/detect-virt.c
index 9a92411..606d073 100644
--- a/src/detect-virt/detect-virt.c
+++ b/src/detect-virt/detect-virt.c
@@ -22,7 +22,6 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <errno.h>
-#include <string.h>
 #include <getopt.h>
 
 #include "util.h"
diff --git a/src/efi-boot-generator/efi-boot-generator.c b/src/efi-boot-generator/efi-boot-generator.c
index b3ff3a8..58c4cc2 100644
--- a/src/efi-boot-generator/efi-boot-generator.c
+++ b/src/efi-boot-generator/efi-boot-generator.c
@@ -26,7 +26,6 @@
 #include "path-util.h"
 #include "util.h"
 #include "mkdir.h"
-#include "unit-name.h"
 #include "virt.h"
 #include "generator.h"
 #include "special.h"
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index 78ceeb6..842ed55 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -22,7 +22,6 @@
 
 #include <stdio.h>
 #include <stdbool.h>
-#include <string.h>
 #include <errno.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -36,7 +35,6 @@
 #include "bus-util.h"
 #include "bus-error.h"
 #include "bus-common-errors.h"
-#include "fileio.h"
 #include "udev-util.h"
 #include "path-util.h"
 
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 5662b5f..ccc7c6e 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -33,7 +33,6 @@
 #include "mount-setup.h"
 #include "special.h"
 #include "mkdir.h"
-#include "fileio.h"
 #include "generator.h"
 #include "strv.h"
 #include "virt.h"
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index 5c58b58..07ee2cc 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -21,8 +21,6 @@
 
 #include <unistd.h>
 #include <stdlib.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
 #include <sys/statfs.h>
 #include <blkid/blkid.h>
 
diff --git a/src/gudev/gudevclient.c b/src/gudev/gudevclient.c
index 1eec758..8b9516c 100644
--- a/src/gudev/gudevclient.c
+++ b/src/gudev/gudevclient.c
@@ -23,6 +23,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <sys/stat.h>
 
 #include "gudevclient.h"
 #include "gudevdevice.h"
diff --git a/src/gudev/gudevdevice.c b/src/gudev/gudevdevice.c
index 7106719..5530d2c 100644
--- a/src/gudev/gudevdevice.c
+++ b/src/gudev/gudevdevice.c
@@ -23,6 +23,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <sys/stat.h>
 
 #include "gudevdevice.h"
 #include "gudevprivate.h"
diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
index f28eabb..43aac61 100644
--- a/src/hibernate-resume/hibernate-resume.c
+++ b/src/hibernate-resume/hibernate-resume.c
@@ -21,9 +21,7 @@
 
 #include <stdio.h>
 #include <errno.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 
 #include "log.h"
 #include "util.h"
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index de4ce7e..766679c 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -21,12 +21,9 @@
 
 #include <stdlib.h>
 #include <stdbool.h>
-#include <unistd.h>
 #include <getopt.h>
 #include <locale.h>
 #include <string.h>
-#include <sys/timex.h>
-#include <sys/utsname.h>
 
 #include "sd-bus.h"
 
@@ -35,12 +32,7 @@
 #include "util.h"
 #include "spawn-polkit-agent.h"
 #include "build.h"
-#include "clock-util.h"
-#include "strv.h"
 #include "sd-id128.h"
-#include "virt.h"
-#include "architecture.h"
-#include "fileio.h"
 
 static bool arg_ask_password = true;
 static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 7cd4a1d..b265a88 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -30,7 +30,6 @@
 #include "virt.h"
 #include "env-util.h"
 #include "fileio-label.h"
-#include "label.h"
 #include "bus-util.h"
 #include "event-util.h"
 #include "selinux-util.h"
diff --git a/src/hwdb/hwdb.c b/src/hwdb/hwdb.c
index 4539673..446de3a 100644
--- a/src/hwdb/hwdb.c
+++ b/src/hwdb/hwdb.c
@@ -18,7 +18,6 @@
 ***/
 
 #include <stdlib.h>
-#include <unistd.h>
 #include <getopt.h>
 #include <string.h>
 #include <ctype.h>
@@ -28,7 +27,6 @@
 #include "conf-files.h"
 #include "strv.h"
 #include "mkdir.h"
-#include "fileio.h"
 #include "verbs.h"
 #include "build.h"
 
diff --git a/src/initctl/initctl.c b/src/initctl/initctl.c
index 7a6a383..f21d665 100644
--- a/src/initctl/initctl.c
+++ b/src/initctl/initctl.c
@@ -19,18 +19,10 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <assert.h>
-#include <time.h>
-#include <string.h>
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
-#include <poll.h>
 #include <sys/epoll.h>
-#include <sys/un.h>
-#include <fcntl.h>
 #include <ctype.h>
 
 #include "sd-daemon.h"
diff --git a/src/journal-remote/journal-remote-write.h b/src/journal-remote/journal-remote-write.h
index aa381c6..7f47f8b 100644
--- a/src/journal-remote/journal-remote-write.h
+++ b/src/journal-remote/journal-remote-write.h
@@ -21,7 +21,6 @@
 
 #pragma once
 
-#include <stdlib.h>
 
 #include "journal-file.h"
 
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
index 8f32a9a..ba811e0 100644
--- a/src/journal-remote/journal-remote.c
+++ b/src/journal-remote/journal-remote.c
@@ -26,8 +26,6 @@
 #include <string.h>
 #include <sys/prctl.h>
 #include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 #include <unistd.h>
 #include <getopt.h>
 
@@ -35,13 +33,11 @@
 #include "journal-file.h"
 #include "journald-native.h"
 #include "socket-util.h"
-#include "mkdir.h"
 #include "build.h"
 #include "macro.h"
 #include "strv.h"
 #include "fileio.h"
 #include "conf-parser.h"
-#include "siphash24.h"
 
 #ifdef HAVE_GNUTLS
 #include <gnutls/gnutls.h>
diff --git a/src/journal-remote/journal-remote.h b/src/journal-remote/journal-remote.h
index 1cf22f6..6c2ccb9 100644
--- a/src/journal-remote/journal-remote.h
+++ b/src/journal-remote/journal-remote.h
@@ -21,7 +21,6 @@
 
 #pragma once
 
-#include <inttypes.h>
 
 #include "sd-event.h"
 #include "hashmap.h"
diff --git a/src/journal/cat.c b/src/journal/cat.c
index 79706b6..2e236f0 100644
--- a/src/journal/cat.c
+++ b/src/journal/cat.c
@@ -21,7 +21,6 @@
 
 #include <stdio.h>
 #include <getopt.h>
-#include <assert.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <errno.h>
diff --git a/src/journal/catalog.c b/src/journal/catalog.c
index f170232..e505a05 100644
--- a/src/journal/catalog.c
+++ b/src/journal/catalog.c
@@ -34,7 +34,6 @@
 #include "hashmap.h"
 #include "strv.h"
 #include "strbuf.h"
-#include "strxcpyx.h"
 #include "conf-files.h"
 #include "mkdir.h"
 #include "catalog.h"
diff --git a/src/journal/compress.c b/src/journal/compress.c
index 6923753..4232206 100644
--- a/src/journal/compress.c
+++ b/src/journal/compress.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
diff --git a/src/journal/compress.h b/src/journal/compress.h
index 136dda6..6294f16 100644
--- a/src/journal/compress.h
+++ b/src/journal/compress.h
@@ -21,8 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
-#include <stdbool.h>
 #include <unistd.h>
 
 #include "journal-def.h"
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index f7ba019..6357d3e 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -23,7 +23,6 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <sys/prctl.h>
-#include <sys/types.h>
 #include <sys/xattr.h>
 
 #ifdef HAVE_ELFUTILS
@@ -44,7 +43,6 @@
 #include "conf-parser.h"
 #include "copy.h"
 #include "stacktrace.h"
-#include "path-util.h"
 #include "compress.h"
 #include "acl-util.h"
 #include "capability.h"
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index afb39ad..62983a7 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -35,7 +35,6 @@
 #include "pager.h"
 #include "macro.h"
 #include "journal-internal.h"
-#include "copy.h"
 #include "compress.h"
 #include "sigbus.h"
 
diff --git a/src/journal/fsprg.c b/src/journal/fsprg.c
index 5c8d6d6..a9f564c 100644
--- a/src/journal/fsprg.c
+++ b/src/journal/fsprg.c
@@ -30,7 +30,6 @@
 
 #include <gcrypt.h>
 #include <string.h>
-#include <assert.h>
 
 #include "fsprg.h"
 
diff --git a/src/journal/journal-authenticate.h b/src/journal/journal-authenticate.h
index 565fe84..118bb13 100644
--- a/src/journal/journal-authenticate.h
+++ b/src/journal/journal-authenticate.h
@@ -22,7 +22,6 @@
 ***/
 
 #include <stdbool.h>
-#include <inttypes.h>
 
 #include "journal-file.h"
 
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 2845e05..9b4967f 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -34,7 +34,6 @@
 #include "journal-authenticate.h"
 #include "lookup3.h"
 #include "compress.h"
-#include "fsprg.h"
 
 #define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem))
 #define DEFAULT_FIELD_HASH_TABLE_SIZE (333ULL*sizeof(HashItem))
diff --git a/src/journal/journal-qrcode.h b/src/journal/journal-qrcode.h
index c527e65..3ff6a3a 100644
--- a/src/journal/journal-qrcode.h
+++ b/src/journal/journal-qrcode.h
@@ -21,8 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
-#include <sys/types.h>
 #include <stdio.h>
 
 #include "systemd/sd-id128.h"
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index 832c327..a367dc1 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -19,12 +19,9 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <sys/statvfs.h>
 #include <unistd.h>
-#include <sys/xattr.h>
 
 #include "journal-def.h"
 #include "journal-file.h"
diff --git a/src/journal/journal-vacuum.h b/src/journal/journal-vacuum.h
index a7fb6f0..c45cc31 100644
--- a/src/journal/journal-vacuum.h
+++ b/src/journal/journal-vacuum.h
@@ -21,6 +21,5 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
 
 int journal_directory_vacuum(const char *directory, uint64_t max_use, usec_t max_retention_usec, usec_t *oldest_usec, bool vacuum);
diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c
index b03335e..35c270c 100644
--- a/src/journal/journal-verify.c
+++ b/src/journal/journal-verify.c
@@ -32,7 +32,6 @@
 #include "journal-verify.h"
 #include "lookup3.h"
 #include "compress.h"
-#include "fsprg.h"
 
 static void draw_progress(uint64_t p, usec_t *last_usec) {
         unsigned n, i, j, k;
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 55c7786..56435ff 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -28,12 +28,10 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include <time.h>
 #include <getopt.h>
 #include <signal.h>
 #include <poll.h>
 #include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/inotify.h>
 #include <linux/fs.h>
 
@@ -54,7 +52,6 @@
 #include "journal-internal.h"
 #include "journal-def.h"
 #include "journal-verify.h"
-#include "journal-authenticate.h"
 #include "journal-qrcode.h"
 #include "journal-vacuum.h"
 #include "fsprg.h"
diff --git a/src/journal/journald-console.c b/src/journal/journald-console.c
index 5363aaa..f7ea779 100644
--- a/src/journal/journald-console.c
+++ b/src/journal/journald-console.c
@@ -21,7 +21,6 @@
 
 #include <time.h>
 #include <fcntl.h>
-#include <unistd.h>
 #include <sys/socket.h>
 
 #include "fileio.h"
diff --git a/src/journal/journald-rate-limit.h b/src/journal/journald-rate-limit.h
index 648ab22..466239d 100644
--- a/src/journal/journald-rate-limit.h
+++ b/src/journal/journald-rate-limit.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "macro.h"
 #include "util.h"
 
 typedef struct JournalRateLimit JournalRateLimit;
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 7ee8174..2488884 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -24,20 +24,17 @@
 #include <linux/sockios.h>
 #include <sys/statvfs.h>
 #include <sys/mman.h>
-#include <sys/timerfd.h>
 
 #include <libudev.h>
 
 #include "sd-journal.h"
 #include "sd-messages.h"
 #include "sd-daemon.h"
-#include "fileio.h"
 #include "mkdir.h"
 #include "hashmap.h"
 #include "journal-file.h"
 #include "socket-util.h"
 #include "cgroup-util.h"
-#include "list.h"
 #include "missing.h"
 #include "conf-parser.h"
 #include "selinux-util.h"
@@ -48,7 +45,6 @@
 #include "journald-kmsg.h"
 #include "journald-syslog.h"
 #include "journald-stream.h"
-#include "journald-console.h"
 #include "journald-native.h"
 #include "journald-audit.h"
 #include "journald-server.h"
diff --git a/src/journal/journald-server.h b/src/journal/journald-server.h
index c96877c..559d100 100644
--- a/src/journal/journald-server.h
+++ b/src/journal/journald-server.h
@@ -21,16 +21,12 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
 #include <stdbool.h>
-#include <sys/epoll.h>
 #include <sys/types.h>
-#include <sys/socket.h>
 
 #include "sd-event.h"
 #include "journal-file.h"
 #include "hashmap.h"
-#include "util.h"
 #include "audit.h"
 #include "journald-rate-limit.h"
 #include "list.h"
diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
index 942a857..bc5b26d 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <fcntl.h>
 #include <unistd.h>
 #include <stddef.h>
 
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 80f4634..28a4233 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -19,12 +19,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/epoll.h>
-#include <sys/socket.h>
-#include <errno.h>
 #include <unistd.h>
 
-#include "systemd/sd-journal.h"
 #include "systemd/sd-messages.h"
 #include "systemd/sd-daemon.h"
 
diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c
index ab21cdc..22f7554 100644
--- a/src/journal/mmap-cache.c
+++ b/src/journal/mmap-cache.c
@@ -22,7 +22,6 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <sys/mman.h>
-#include <string.h>
 
 #include "hashmap.h"
 #include "list.h"
diff --git a/src/journal/mmap-cache.h b/src/journal/mmap-cache.h
index a85c2b6..37ea7b4 100644
--- a/src/journal/mmap-cache.h
+++ b/src/journal/mmap-cache.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
 #include <stdbool.h>
 #include <sys/stat.h>
 
diff --git a/src/journal/test-catalog.c b/src/journal/test-catalog.c
index c605ee0..dbfdea6 100644
--- a/src/journal/test-catalog.c
+++ b/src/journal/test-catalog.c
@@ -21,7 +21,6 @@
 ***/
 
 #include <locale.h>
-#include <stdlib.h>
 #include <unistd.h>
 #include <errno.h>
 #include <fcntl.h>
diff --git a/src/journal/test-journal-enum.c b/src/journal/test-journal-enum.c
index 980244e..cde2025 100644
--- a/src/journal/test-journal-enum.c
+++ b/src/journal/test-journal-enum.c
@@ -24,7 +24,6 @@
 #include "log.h"
 #include "sd-journal.h"
 #include "macro.h"
-#include "util.h"
 #include "journal-internal.h"
 
 int main(int argc, char *argv[]) {
diff --git a/src/journal/test-journal-interleaving.c b/src/journal/test-journal-interleaving.c
index 3c70601..3e61417 100644
--- a/src/journal/test-journal-interleaving.c
+++ b/src/journal/test-journal-interleaving.c
@@ -26,7 +26,6 @@
 #include "systemd/sd-journal.h"
 
 #include "journal-file.h"
-#include "journal-internal.h"
 #include "journal-vacuum.h"
 #include "util.h"
 #include "log.h"
diff --git a/src/journal/test-journal-verify.c b/src/journal/test-journal-verify.c
index 9da120c..de9cd9c 100644
--- a/src/journal/test-journal-verify.c
+++ b/src/journal/test-journal-verify.c
@@ -27,7 +27,6 @@
 #include "log.h"
 #include "journal-file.h"
 #include "journal-verify.h"
-#include "journal-authenticate.h"
 
 #define N_ENTRIES 6000
 #define RANDOM_RANGE 77
diff --git a/src/journal/test-journal.c b/src/journal/test-journal.c
index 230d265..f7cc75b 100644
--- a/src/journal/test-journal.c
+++ b/src/journal/test-journal.c
@@ -22,7 +22,6 @@
 #include <fcntl.h>
 #include <unistd.h>
 
-#include "systemd/sd-journal.h"
 
 #include "log.h"
 #include "journal-file.h"
diff --git a/src/journal/test-mmap-cache.c b/src/journal/test-mmap-cache.c
index 3fcd774..3258b22 100644
--- a/src/journal/test-mmap-cache.c
+++ b/src/journal/test-mmap-cache.c
@@ -24,7 +24,6 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-#include "log.h"
 #include "macro.h"
 #include "util.h"
 #include "mmap-cache.h"
diff --git a/src/libsystemd-network/dhcp-identifier.c b/src/libsystemd-network/dhcp-identifier.c
index 419a450..f7a1492 100644
--- a/src/libsystemd-network/dhcp-identifier.c
+++ b/src/libsystemd-network/dhcp-identifier.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <net/ethernet.h>
 
 #include "sd-id128.h"
 #include "libudev.h"
@@ -28,7 +27,6 @@
 #include "virt.h"
 #include "sparse-endian.h"
 #include "siphash24.h"
-#include "util.h"
 
 #include "dhcp6-protocol.h"
 #include "dhcp-identifier.h"
diff --git a/src/libsystemd-network/dhcp-identifier.h b/src/libsystemd-network/dhcp-identifier.h
index 7f44d25..643d497 100644
--- a/src/libsystemd-network/dhcp-identifier.h
+++ b/src/libsystemd-network/dhcp-identifier.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <net/ethernet.h>
 
 #include "macro.h"
 #include "sparse-endian.h"
diff --git a/src/libsystemd-network/dhcp-network.c b/src/libsystemd-network/dhcp-network.c
index 5f2d2cf..7f10838 100644
--- a/src/libsystemd-network/dhcp-network.c
+++ b/src/libsystemd-network/dhcp-network.c
@@ -18,7 +18,6 @@
 ***/
 
 #include <errno.h>
-#include <sys/types.h>
 #include <sys/socket.h>
 #include <string.h>
 #include <linux/if_packet.h>
@@ -26,7 +25,6 @@
 #include <net/ethernet.h>
 #include <net/if_arp.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <linux/filter.h>
 
 #include "socket-util.h"
diff --git a/src/libsystemd-network/dhcp-packet.c b/src/libsystemd-network/dhcp-packet.c
index 7581dae..cd7f509 100644
--- a/src/libsystemd-network/dhcp-packet.c
+++ b/src/libsystemd-network/dhcp-packet.c
@@ -18,22 +18,14 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdlib.h>
 #include <errno.h>
 #include <string.h>
-#include <stdio.h>
 #include <net/ethernet.h>
 #include <net/if_arp.h>
-#include <sys/param.h>
 
-#include "util.h"
-#include "list.h"
 
 #include "dhcp-protocol.h"
-#include "dhcp-lease-internal.h"
 #include "dhcp-internal.h"
-#include "sd-dhcp-lease.h"
-#include "sd-dhcp-client.h"
 
 #define DHCP_CLIENT_MIN_OPTIONS_SIZE            312
 
diff --git a/src/libsystemd-network/lldp-network.c b/src/libsystemd-network/lldp-network.c
index a2bc7d5..664d2f7 100644
--- a/src/libsystemd-network/lldp-network.c
+++ b/src/libsystemd-network/lldp-network.c
@@ -27,7 +27,6 @@
 #include "lldp-tlv.h"
 #include "lldp-network.h"
 #include "lldp-internal.h"
-#include "sd-lldp.h"
 
 int lldp_network_bind_raw_socket(int ifindex) {
         typedef struct LLDPFrame {
diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c
index 41f43d3..5bf4d0f 100644
--- a/src/libsystemd-network/network-internal.c
+++ b/src/libsystemd-network/network-internal.c
@@ -26,7 +26,6 @@
 
 #include "strv.h"
 #include "siphash24.h"
-#include "libudev-private.h"
 #include "dhcp-lease-internal.h"
 #include "log.h"
 #include "utf8.h"
diff --git a/src/libsystemd-network/network-internal.h b/src/libsystemd-network/network-internal.h
index e51717e..06aba89 100644
--- a/src/libsystemd-network/network-internal.h
+++ b/src/libsystemd-network/network-internal.h
@@ -21,8 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <netinet/ether.h>
-#include <netinet/in.h>
 #include <stdbool.h>
 
 #include "udev.h"
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index 5f90617..4224e01 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -24,12 +24,9 @@
 #include <net/ethernet.h>
 #include <net/if_arp.h>
 #include <linux/if_infiniband.h>
-#include <netinet/ether.h>
-#include <sys/param.h>
 #include <sys/ioctl.h>
 
 #include "util.h"
-#include "list.h"
 #include "refcnt.h"
 #include "async.h"
 
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index 34aa36c..fa1fa11 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -22,22 +22,15 @@
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
-#include <net/ethernet.h>
 #include <arpa/inet.h>
-#include <sys/param.h>
 
-#include "util.h"
-#include "list.h"
-#include "mkdir.h"
 #include "fileio.h"
 #include "unaligned.h"
 #include "in-addr-util.h"
 
 #include "dhcp-protocol.h"
-#include "dhcp-internal.h"
 #include "dhcp-lease-internal.h"
 #include "sd-dhcp-lease.h"
-#include "sd-dhcp-client.h"
 #include "network-internal.h"
 
 int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr) {
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
index 3f89f34..2634a73 100644
--- a/src/libsystemd-network/sd-dhcp-server.c
+++ b/src/libsystemd-network/sd-dhcp-server.c
@@ -21,7 +21,6 @@
 ***/
 
 #include <sys/ioctl.h>
-#include <netinet/if_ether.h>
 
 #include "siphash24.h"
 
diff --git a/src/libsystemd-network/sd-lldp.c b/src/libsystemd-network/sd-lldp.c
index 19ef2cc..0821730 100644
--- a/src/libsystemd-network/sd-lldp.c
+++ b/src/libsystemd-network/sd-lldp.c
@@ -24,16 +24,13 @@
 
 #include "siphash24.h"
 #include "hashmap.h"
-#include "event-util.h"
 
 #include "lldp-tlv.h"
 #include "lldp-port.h"
 #include "sd-lldp.h"
 #include "prioq.h"
-#include "strv.h"
 #include "lldp-internal.h"
 #include "lldp-util.h"
-#include "ether-addr-util.h"
 
 typedef enum LLDPAgentRXState {
         LLDP_AGENT_RX_WAIT_PORT_OPERATIONAL = 4,
diff --git a/src/libsystemd-network/sd-pppoe.c b/src/libsystemd-network/sd-pppoe.c
index 4f49b79..67a2cc6 100644
--- a/src/libsystemd-network/sd-pppoe.c
+++ b/src/libsystemd-network/sd-pppoe.c
@@ -22,7 +22,6 @@
 /* See RFC 2516 */
 
 #include <sys/ioctl.h>
-#include <linux/ppp_defs.h>
 #include <linux/ppp-ioctl.h>
 #include <net/if.h>
 #include <netinet/in.h>
@@ -36,7 +35,6 @@
 #include "socket-util.h"
 #include "async.h"
 #include "refcnt.h"
-#include "unaligned.h"
 #include "utf8.h"
 
 #define PPPOE_MAX_PACKET_SIZE 1484
diff --git a/src/libsystemd-network/test-dhcp-client.c b/src/libsystemd-network/test-dhcp-client.c
index 8e88641..d341210 100644
--- a/src/libsystemd-network/test-dhcp-client.c
+++ b/src/libsystemd-network/test-dhcp-client.c
@@ -19,16 +19,12 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdlib.h>
-#include <assert.h>
 #include <errno.h>
 #include <stdio.h>
-#include <sys/types.h>
 #include <sys/socket.h>
 #include <unistd.h>
 
 #include "util.h"
-#include "socket-util.h"
 #include "sd-event.h"
 #include "event-util.h"
 
diff --git a/src/libsystemd-network/test-dhcp-option.c b/src/libsystemd-network/test-dhcp-option.c
index 46c8c27..6062a37 100644
--- a/src/libsystemd-network/test-dhcp-option.c
+++ b/src/libsystemd-network/test-dhcp-option.c
@@ -3,7 +3,6 @@
 #include <stdbool.h>
 #include <errno.h>
 #include <string.h>
-#include <assert.h>
 
 #include "util.h"
 #include "macro.h"
diff --git a/src/libsystemd-network/test-dhcp-server.c b/src/libsystemd-network/test-dhcp-server.c
index 3e68f31..9f60ab7 100644
--- a/src/libsystemd-network/test-dhcp-server.c
+++ b/src/libsystemd-network/test-dhcp-server.c
@@ -20,8 +20,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <netinet/if_ether.h>
-#include <assert.h>
 #include <errno.h>
 
 #include "sd-event.h"
diff --git a/src/libsystemd-network/test-lldp.c b/src/libsystemd-network/test-lldp.c
index ee74ebd..06545ae 100644
--- a/src/libsystemd-network/test-lldp.c
+++ b/src/libsystemd-network/test-lldp.c
@@ -21,13 +21,8 @@
 ***/
 
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <sys/socket.h>
-#include <linux/if.h>
-#include <linux/if_ether.h>
 #include <net/ethernet.h>
-#include <sys/types.h>
 #include <arpa/inet.h>
 
 #include "macro.h"
diff --git a/src/libsystemd-network/test-pppoe.c b/src/libsystemd-network/test-pppoe.c
index dff83ea..40d04fd 100644
--- a/src/libsystemd-network/test-pppoe.c
+++ b/src/libsystemd-network/test-pppoe.c
@@ -20,22 +20,16 @@
 ***/
 
 #include <stdlib.h>
-#include <assert.h>
 #include <errno.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
 #include <unistd.h>
 
 #include <linux/veth.h>
 #include <net/if.h>
 
 #include "util.h"
-#include "socket-util.h"
 #include "sd-event.h"
 #include "event-util.h"
 #include "sd-rtnl.h"
-#include "rtnl-util.h"
 #include "sd-pppoe.h"
 
 static void pppoe_handler(sd_pppoe *ppp, int event, void *userdata) {
diff --git a/src/libsystemd-terminal/evcat.c b/src/libsystemd-terminal/evcat.c
index f4c25b5..d274225 100644
--- a/src/libsystemd-terminal/evcat.c
+++ b/src/libsystemd-terminal/evcat.c
@@ -26,17 +26,13 @@
  * problems.
  */
 
-#include <assert.h>
 #include <errno.h>
 #include <getopt.h>
 #include <libevdev/libevdev.h>
 #include <linux/kd.h>
-#include <linux/vt.h>
-#include <stdarg.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <systemd/sd-bus.h>
@@ -46,7 +42,6 @@
 #include <unistd.h>
 #include <xkbcommon/xkbcommon.h>
 #include "build.h"
-#include "bus-util.h"
 #include "event-util.h"
 #include "idev.h"
 #include "macro.h"
diff --git a/src/libsystemd-terminal/grdev-drm.c b/src/libsystemd-terminal/grdev-drm.c
index bc4d4c9..066a4d8 100644
--- a/src/libsystemd-terminal/grdev-drm.c
+++ b/src/libsystemd-terminal/grdev-drm.c
@@ -42,7 +42,6 @@
 #include "grdev.h"
 #include "grdev-internal.h"
 #include "macro.h"
-#include "udev-util.h"
 #include "util.h"
 
 #define GRDRM_MAX_TRIES (16)
diff --git a/src/libsystemd-terminal/grdev.c b/src/libsystemd-terminal/grdev.c
index 3b3cf27..feed579 100644
--- a/src/libsystemd-terminal/grdev.c
+++ b/src/libsystemd-terminal/grdev.c
@@ -19,19 +19,16 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
 #include <libudev.h>
 #include <stdbool.h>
 #include <stdlib.h>
 #include <systemd/sd-bus.h>
 #include <systemd/sd-event.h>
-#include <systemd/sd-login.h>
 #include "grdev.h"
 #include "grdev-internal.h"
 #include "hashmap.h"
 #include "login-shared.h"
 #include "macro.h"
-#include "udev-util.h"
 #include "util.h"
 
 static void pipe_enable(grdev_pipe *pipe);
diff --git a/src/libsystemd-terminal/grdev.h b/src/libsystemd-terminal/grdev.h
index 35d6eb2..db2a508 100644
--- a/src/libsystemd-terminal/grdev.h
+++ b/src/libsystemd-terminal/grdev.h
@@ -53,8 +53,6 @@
 
 #pragma once
 
-#include <drm_fourcc.h>
-#include <inttypes.h>
 #include <libudev.h>
 #include <stdbool.h>
 #include <stdlib.h>
diff --git a/src/libsystemd-terminal/idev-evdev.c b/src/libsystemd-terminal/idev-evdev.c
index dfbb2d1..91ae507 100644
--- a/src/libsystemd-terminal/idev-evdev.c
+++ b/src/libsystemd-terminal/idev-evdev.c
@@ -20,20 +20,16 @@
 ***/
 
 #include <fcntl.h>
-#include <inttypes.h>
 #include <libevdev/libevdev.h>
 #include <libudev.h>
 #include <stdbool.h>
 #include <stdlib.h>
 #include <systemd/sd-bus.h>
 #include <systemd/sd-event.h>
-#include <unistd.h>
 #include "bus-util.h"
-#include "hashmap.h"
 #include "idev.h"
 #include "idev-internal.h"
 #include "macro.h"
-#include "udev-util.h"
 #include "util.h"
 
 typedef struct idev_evdev idev_evdev;
diff --git a/src/libsystemd-terminal/idev-keyboard.c b/src/libsystemd-terminal/idev-keyboard.c
index 6ee3d81..1ee13ff 100644
--- a/src/libsystemd-terminal/idev-keyboard.c
+++ b/src/libsystemd-terminal/idev-keyboard.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
 #include <stdbool.h>
 #include <stdlib.h>
 #include <systemd/sd-bus.h>
diff --git a/src/libsystemd-terminal/idev.c b/src/libsystemd-terminal/idev.c
index 989683f..44be7c3 100644
--- a/src/libsystemd-terminal/idev.c
+++ b/src/libsystemd-terminal/idev.c
@@ -19,21 +19,16 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
 #include <libudev.h>
-#include <linux/input.h>
 #include <stdbool.h>
 #include <stdlib.h>
 #include <systemd/sd-bus.h>
 #include <systemd/sd-event.h>
-#include <systemd/sd-login.h>
-#include <xkbcommon/xkbcommon.h>
 #include "hashmap.h"
 #include "idev.h"
 #include "idev-internal.h"
 #include "login-shared.h"
 #include "macro.h"
-#include "udev-util.h"
 #include "util.h"
 
 static void element_open(idev_element *e);
diff --git a/src/libsystemd-terminal/idev.h b/src/libsystemd-terminal/idev.h
index c8c03f3..fa04815 100644
--- a/src/libsystemd-terminal/idev.h
+++ b/src/libsystemd-terminal/idev.h
@@ -25,15 +25,12 @@
 
 #pragma once
 
-#include <inttypes.h>
 #include <libudev.h>
 #include <linux/input.h>
 #include <stdbool.h>
-#include <stdlib.h>
 #include <systemd/sd-bus.h>
 #include <systemd/sd-event.h>
 #include <xkbcommon/xkbcommon.h>
-#include "util.h"
 
 typedef struct idev_data                idev_data;
 typedef struct idev_data_evdev          idev_data_evdev;
@@ -70,7 +67,7 @@ struct idev_data_evdev {
  * Keyboard Devices
  */
 
-struct xkb_state;
+//struct xkb_state;
 
 enum {
         IDEV_KBDMOD_IDX_SHIFT,
diff --git a/src/libsystemd-terminal/modeset.c b/src/libsystemd-terminal/modeset.c
index 6e13432..cccaaba 100644
--- a/src/libsystemd-terminal/modeset.c
+++ b/src/libsystemd-terminal/modeset.c
@@ -30,11 +30,9 @@
 #include <errno.h>
 #include <getopt.h>
 #include <linux/kd.h>
-#include <linux/vt.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <systemd/sd-bus.h>
@@ -43,10 +41,7 @@
 #include <termios.h>
 #include <unistd.h>
 #include "build.h"
-#include "bus-util.h"
-#include "event-util.h"
 #include "grdev.h"
-#include "grdev-internal.h"
 #include "macro.h"
 #include "sysview.h"
 #include "util.h"
diff --git a/src/libsystemd-terminal/subterm.c b/src/libsystemd-terminal/subterm.c
index 63cd2a5..983a2a1 100644
--- a/src/libsystemd-terminal/subterm.c
+++ b/src/libsystemd-terminal/subterm.c
@@ -26,7 +26,6 @@
  * parent TTY. Think of this like what "GNU-screen" does.
  */
 
-#include <assert.h>
 #include <errno.h>
 #include <stdarg.h>
 #include <stdbool.h>
diff --git a/src/libsystemd-terminal/sysview.c b/src/libsystemd-terminal/sysview.c
index 9ee32db..cd61ea4 100644
--- a/src/libsystemd-terminal/sysview.c
+++ b/src/libsystemd-terminal/sysview.c
@@ -27,9 +27,7 @@
 #include <systemd/sd-event.h>
 #include <systemd/sd-login.h>
 #include "bus-util.h"
-#include "event-util.h"
 #include "macro.h"
-#include "set.h"
 #include "sysview.h"
 #include "sysview-internal.h"
 #include "udev-util.h"
diff --git a/src/libsystemd-terminal/sysview.h b/src/libsystemd-terminal/sysview.h
index cad603d..aa5527f 100644
--- a/src/libsystemd-terminal/sysview.h
+++ b/src/libsystemd-terminal/sysview.h
@@ -36,13 +36,9 @@
 
 #pragma once
 
-#include <inttypes.h>
-#include <libudev.h>
 #include <stdbool.h>
-#include <stdlib.h>
 #include <systemd/sd-bus.h>
 #include <systemd/sd-event.h>
-#include "util.h"
 
 typedef struct sysview_event            sysview_event;
 typedef struct sysview_device           sysview_device;
diff --git a/src/libsystemd-terminal/term-charset.c b/src/libsystemd-terminal/term-charset.c
index a00a191..9db1788 100644
--- a/src/libsystemd-terminal/term-charset.c
+++ b/src/libsystemd-terminal/term-charset.c
@@ -60,9 +60,6 @@
  * include them. The mapper has to take care not to use them in GL.
  */
 
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
 #include "term-internal.h"
 
 /*
diff --git a/src/libsystemd-terminal/term-page.c b/src/libsystemd-terminal/term-page.c
index ae73cdf..cbd8006 100644
--- a/src/libsystemd-terminal/term-page.c
+++ b/src/libsystemd-terminal/term-page.c
@@ -75,7 +75,6 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdlib.h>
-#include <wchar.h>
 #include "macro.h"
 #include "term-internal.h"
 #include "util.h"
diff --git a/src/libsystemd-terminal/term-wcwidth.c b/src/libsystemd-terminal/term-wcwidth.c
index df20a40..833a099 100644
--- a/src/libsystemd-terminal/term-wcwidth.c
+++ b/src/libsystemd-terminal/term-wcwidth.c
@@ -62,7 +62,6 @@
  * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
  */
 
-#include <wchar.h>
 #include "term-internal.h"
 
 struct interval {
diff --git a/src/libsystemd-terminal/test-term-page.c b/src/libsystemd-terminal/test-term-page.c
index 9e33877..d59139b 100644
--- a/src/libsystemd-terminal/test-term-page.c
+++ b/src/libsystemd-terminal/test-term-page.c
@@ -25,14 +25,10 @@
  * those internals are changed. They should be fairly obvious, though.
  */
 
-#include <assert.h>
-#include <errno.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 #include "macro.h"
 #include "term-internal.h"
-#include "util.h"
 
 #define MY_ASSERT_VALS __FILE__, __LINE__, __PRETTY_FUNCTION__
 #define MY_ASSERT_FORW _FILE, _LINE, _FUNC
diff --git a/src/libsystemd-terminal/test-term-parser.c b/src/libsystemd-terminal/test-term-parser.c
index e22614d..e40b267 100644
--- a/src/libsystemd-terminal/test-term-parser.c
+++ b/src/libsystemd-terminal/test-term-parser.c
@@ -22,14 +22,10 @@
  * Terminal Parser Tests
  */
 
-#include <assert.h>
-#include <errno.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 #include "macro.h"
 #include "term-internal.h"
-#include "util.h"
 #include "utf8.h"
 
 static void test_term_utf8_invalid(void) {
diff --git a/src/libsystemd-terminal/test-unifont.c b/src/libsystemd-terminal/test-unifont.c
index cfeef61..2366d38 100644
--- a/src/libsystemd-terminal/test-unifont.c
+++ b/src/libsystemd-terminal/test-unifont.c
@@ -24,14 +24,11 @@
  * The glyphs are then compared to hard-coded glyphs.
  */
 
-#include <errno.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 #include "macro.h"
 #include "unifont-def.h"
 #include "unifont.h"
-#include "util.h"
 
 static void render(char *w, const unifont_glyph *g) {
         unsigned int i, j;
diff --git a/src/libsystemd-terminal/unifont.c b/src/libsystemd-terminal/unifont.c
index 2acfa98..9b4bfba 100644
--- a/src/libsystemd-terminal/unifont.c
+++ b/src/libsystemd-terminal/unifont.c
@@ -26,15 +26,11 @@
  * stay as fast as possible.
  */
 
-#include <endian.h>
 #include <fcntl.h>
-#include <stdbool.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
 #include "macro.h"
 #include "unifont-def.h"
 #include "unifont.h"
diff --git a/src/libsystemd-terminal/unifont.h b/src/libsystemd-terminal/unifont.h
index 30527cb..74ee5ec 100644
--- a/src/libsystemd-terminal/unifont.h
+++ b/src/libsystemd-terminal/unifont.h
@@ -21,10 +21,7 @@
 
 #pragma once
 
-#include <stdbool.h>
 #include <stdint.h>
-#include <stdlib.h>
-#include "util.h"
 
 typedef struct unifont unifont;
 typedef struct unifont_glyph unifont_glyph;
diff --git a/src/libsystemd/sd-bus/bus-bloom.h b/src/libsystemd/sd-bus/bus-bloom.h
index 96c82d7..a9350d7 100644
--- a/src/libsystemd/sd-bus/bus-bloom.h
+++ b/src/libsystemd/sd-bus/bus-bloom.h
@@ -23,7 +23,6 @@
 
 #include <stdbool.h>
 #include <stdint.h>
-#include <sys/types.h>
 
 /*
  * Our default bloom filter has the following parameters:
diff --git a/src/libsystemd/sd-bus/bus-common-errors.h b/src/libsystemd/sd-bus/bus-common-errors.h
index e935833..b17b62a 100644
--- a/src/libsystemd/sd-bus/bus-common-errors.h
+++ b/src/libsystemd/sd-bus/bus-common-errors.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "sd-bus.h"
 #include "bus-error.h"
 
 #define BUS_ERROR_NO_SUCH_UNIT "org.freedesktop.systemd1.NoSuchUnit"
diff --git a/src/libsystemd/sd-bus/bus-container.c b/src/libsystemd/sd-bus/bus-container.c
index d29b98a..3b3a5d3 100644
--- a/src/libsystemd/sd-bus/bus-container.c
+++ b/src/libsystemd/sd-bus/bus-container.c
@@ -23,7 +23,6 @@
 #include <fcntl.h>
 
 #include "util.h"
-#include "fileio.h"
 #include "bus-internal.h"
 #include "bus-socket.h"
 #include "bus-container.h"
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index 06e5b4f..25a73f2 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -34,7 +34,6 @@
 #include "bus-bloom.h"
 #include "bus-util.h"
 #include "capability.h"
-#include "cgroup-util.h"
 
 _public_ int sd_bus_get_unique_name(sd_bus *bus, const char **unique) {
         int r;
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c
index ea8a619..a08391b 100644
--- a/src/libsystemd/sd-bus/bus-creds.c
+++ b/src/libsystemd/sd-bus/bus-creds.c
@@ -29,7 +29,6 @@
 #include "audit.h"
 #include "bus-message.h"
 #include "bus-util.h"
-#include "time-util.h"
 #include "strv.h"
 #include "bus-creds.h"
 #include "bus-label.h"
diff --git a/src/libsystemd/sd-bus/bus-creds.h b/src/libsystemd/sd-bus/bus-creds.h
index 3b337ef..5430e53 100644
--- a/src/libsystemd/sd-bus/bus-creds.h
+++ b/src/libsystemd/sd-bus/bus-creds.h
@@ -24,7 +24,6 @@
 #include <stdbool.h>
 
 #include "sd-bus.h"
-#include "time-util.h"
 
 struct sd_bus_creds {
         bool allocated;
diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c
index 7181639..4bc8965 100644
--- a/src/libsystemd/sd-bus/bus-dump.c
+++ b/src/libsystemd/sd-bus/bus-dump.c
@@ -22,7 +22,6 @@
 #include "util.h"
 #include "capability.h"
 #include "strv.h"
-#include "audit.h"
 #include "macro.h"
 #include "cap-list.h"
 
diff --git a/src/libsystemd/sd-bus/bus-gvariant.c b/src/libsystemd/sd-bus/bus-gvariant.c
index dc40009..b32bd33 100644
--- a/src/libsystemd/sd-bus/bus-gvariant.c
+++ b/src/libsystemd/sd-bus/bus-gvariant.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "util.h"
 #include "bus-type.h"
 #include "bus-gvariant.h"
 #include "bus-signature.h"
diff --git a/src/libsystemd/sd-bus/bus-internal.h b/src/libsystemd/sd-bus/bus-internal.h
index e9f1a81..411ade3 100644
--- a/src/libsystemd/sd-bus/bus-internal.h
+++ b/src/libsystemd/sd-bus/bus-internal.h
@@ -22,8 +22,6 @@
 ***/
 
 #include <sys/socket.h>
-#include <sys/un.h>
-#include <netinet/in.h>
 #include <pthread.h>
 
 #include "hashmap.h"
diff --git a/src/libsystemd/sd-bus/bus-introspect.c b/src/libsystemd/sd-bus/bus-introspect.c
index d528ab2..e2f4550 100644
--- a/src/libsystemd/sd-bus/bus-introspect.c
+++ b/src/libsystemd/sd-bus/bus-introspect.c
@@ -20,7 +20,6 @@
 ***/
 
 #include "util.h"
-#include "sd-bus-protocol.h"
 #include "bus-introspect.h"
 #include "bus-signature.h"
 #include "bus-internal.h"
diff --git a/src/libsystemd/sd-bus/bus-introspect.h b/src/libsystemd/sd-bus/bus-introspect.h
index 98312d1..1914e6c 100644
--- a/src/libsystemd/sd-bus/bus-introspect.h
+++ b/src/libsystemd/sd-bus/bus-introspect.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
 #include <stdio.h>
 
 #include "sd-bus.h"
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index bdc7706..7bedfd1 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -38,7 +38,6 @@
 #include "strv.h"
 #include "memfd-util.h"
 #include "capability.h"
-#include "cgroup-util.h"
 #include "fileio.h"
 
 #include "bus-internal.h"
diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c
index 162f0ab..a9e944c 100644
--- a/src/libsystemd/sd-bus/bus-match.c
+++ b/src/libsystemd/sd-bus/bus-match.c
@@ -22,7 +22,6 @@
 #include "bus-internal.h"
 #include "bus-message.h"
 #include "bus-match.h"
-#include "bus-error.h"
 #include "bus-util.h"
 #include "strv.h"
 
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index da14a28..d2e1557 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -27,7 +27,6 @@
 #include "utf8.h"
 #include "strv.h"
 #include "time-util.h"
-#include "cgroup-util.h"
 #include "memfd-util.h"
 
 #include "sd-bus.h"
diff --git a/src/libsystemd/sd-bus/bus-message.h b/src/libsystemd/sd-bus/bus-message.h
index b4cdce7..33a569b 100644
--- a/src/libsystemd/sd-bus/bus-message.h
+++ b/src/libsystemd/sd-bus/bus-message.h
@@ -23,11 +23,9 @@
 
 #include <stdbool.h>
 #include <byteswap.h>
-#include <sys/socket.h>
 
 #include "macro.h"
 #include "sd-bus.h"
-#include "kdbus.h"
 #include "time-util.h"
 #include "bus-creds.h"
 #include "bus-protocol.h"
diff --git a/src/libsystemd/sd-bus/bus-signature.h b/src/libsystemd/sd-bus/bus-signature.h
index 2e06e30..c4fed0b 100644
--- a/src/libsystemd/sd-bus/bus-signature.h
+++ b/src/libsystemd/sd-bus/bus-signature.h
@@ -22,7 +22,6 @@
 ***/
 
 #include <stdbool.h>
-#include <sys/types.h>
 
 bool signature_is_single(const char *s, bool allow_dict_entry);
 bool signature_is_pair(const char *s);
diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c
index 52883fa..c15929c 100644
--- a/src/libsystemd/sd-bus/bus-socket.c
+++ b/src/libsystemd/sd-bus/bus-socket.c
@@ -20,16 +20,13 @@
 ***/
 
 #include <endian.h>
-#include <assert.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <poll.h>
-#include <byteswap.h>
 
 #include "util.h"
 #include "macro.h"
 #include "missing.h"
-#include "strv.h"
 #include "utf8.h"
 #include "sd-daemon.h"
 
diff --git a/src/libsystemd/sd-bus/bus-track.c b/src/libsystemd/sd-bus/bus-track.c
index 6be8310..0481785 100644
--- a/src/libsystemd/sd-bus/bus-track.c
+++ b/src/libsystemd/sd-bus/bus-track.c
@@ -20,7 +20,6 @@
 ***/
 
 #include "sd-bus.h"
-#include "set.h"
 #include "bus-util.h"
 #include "bus-internal.h"
 #include "bus-track.h"
diff --git a/src/libsystemd/sd-bus/bus-type.c b/src/libsystemd/sd-bus/bus-type.c
index b7914d1..6bc7b88 100644
--- a/src/libsystemd/sd-bus/bus-type.c
+++ b/src/libsystemd/sd-bus/bus-type.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "util.h"
 #include "bus-type.h"
 
 bool bus_type_is_valid(char c) {
diff --git a/src/libsystemd/sd-bus/bus-type.h b/src/libsystemd/sd-bus/bus-type.h
index 0e50783..581574a 100644
--- a/src/libsystemd/sd-bus/bus-type.h
+++ b/src/libsystemd/sd-bus/bus-type.h
@@ -25,7 +25,6 @@
 
 #include "macro.h"
 #include "sd-bus.h"
-#include "sd-bus-protocol.h"
 
 bool bus_type_is_valid(char c) _const_;
 bool bus_type_is_valid_in_signature(char c) _const_;
diff --git a/src/libsystemd/sd-bus/bus-util.h b/src/libsystemd/sd-bus/bus-util.h
index e8a97ce..6690af5 100644
--- a/src/libsystemd/sd-bus/bus-util.h
+++ b/src/libsystemd/sd-bus/bus-util.h
@@ -25,7 +25,6 @@
 #include "sd-bus.h"
 #include "hashmap.h"
 #include "time-util.h"
-#include "util.h"
 
 typedef enum BusTransport {
         BUS_TRANSPORT_LOCAL,
diff --git a/src/libsystemd/sd-bus/busctl-introspect.h b/src/libsystemd/sd-bus/busctl-introspect.h
index d6b4cf0..ea807d5 100644
--- a/src/libsystemd/sd-bus/busctl-introspect.h
+++ b/src/libsystemd/sd-bus/busctl-introspect.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
 #include <stdbool.h>
 
 typedef struct XMLIntrospectOps {
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index d3c1772..d52dbdf 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -26,12 +26,10 @@
 #include "log.h"
 #include "build.h"
 #include "pager.h"
-#include "xml.h"
 #include "path-util.h"
 #include "set.h"
 
 #include "sd-bus.h"
-#include "bus-message.h"
 #include "bus-internal.h"
 #include "bus-util.h"
 #include "bus-dump.h"
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index cac9b65..ab44ae3 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -19,20 +19,16 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <endian.h>
-#include <assert.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <netdb.h>
 #include <poll.h>
-#include <byteswap.h>
 #include <sys/mman.h>
 #include <pthread.h>
 
 #include "util.h"
 #include "macro.h"
 #include "strv.h"
-#include "set.h"
 #include "missing.h"
 #include "def.h"
 #include "cgroup-util.h"
@@ -45,8 +41,6 @@
 #include "bus-socket.h"
 #include "bus-kernel.h"
 #include "bus-control.h"
-#include "bus-introspect.h"
-#include "bus-signature.h"
 #include "bus-objects.h"
 #include "bus-util.h"
 #include "bus-container.h"
diff --git a/src/libsystemd/sd-bus/test-bus-chat.c b/src/libsystemd/sd-bus/test-bus-chat.c
index 8625ee6..7f49fe9 100644
--- a/src/libsystemd/sd-bus/test-bus-chat.c
+++ b/src/libsystemd/sd-bus/test-bus-chat.c
@@ -29,7 +29,6 @@
 #include "macro.h"
 
 #include "sd-bus.h"
-#include "bus-message.h"
 #include "bus-error.h"
 #include "bus-match.h"
 #include "bus-internal.h"
diff --git a/src/libsystemd/sd-bus/test-bus-creds.c b/src/libsystemd/sd-bus/test-bus-creds.c
index ff2602b..edd5033 100644
--- a/src/libsystemd/sd-bus/test-bus-creds.c
+++ b/src/libsystemd/sd-bus/test-bus-creds.c
@@ -22,7 +22,6 @@
 #include "sd-bus.h"
 #include "bus-dump.h"
 #include "bus-util.h"
-#include "util.h"
 
 int main(int argc, char *argv[]) {
         _cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
diff --git a/src/libsystemd/sd-bus/test-bus-introspect.c b/src/libsystemd/sd-bus/test-bus-introspect.c
index 67b6461..b2caa02 100644
--- a/src/libsystemd/sd-bus/test-bus-introspect.c
+++ b/src/libsystemd/sd-bus/test-bus-introspect.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "util.h"
 #include "log.h"
 #include "bus-introspect.h"
 
diff --git a/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c b/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c
index 35f87e9..1cacb95 100644
--- a/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c
+++ b/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c
@@ -19,16 +19,12 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <ctype.h>
 #include <sys/wait.h>
 
 #include "util.h"
-#include "log.h"
 #include "time-util.h"
 
 #include "sd-bus.h"
-#include "bus-message.h"
-#include "bus-error.h"
 #include "bus-kernel.h"
 #include "bus-internal.h"
 #include "bus-util.h"
diff --git a/src/libsystemd/sd-bus/test-bus-kernel-bloom.c b/src/libsystemd/sd-bus/test-bus-kernel-bloom.c
index 071b7e0..b11c43b 100644
--- a/src/libsystemd/sd-bus/test-bus-kernel-bloom.c
+++ b/src/libsystemd/sd-bus/test-bus-kernel-bloom.c
@@ -23,8 +23,6 @@
 #include "log.h"
 
 #include "sd-bus.h"
-#include "bus-message.h"
-#include "bus-error.h"
 #include "bus-kernel.h"
 #include "bus-util.h"
 
diff --git a/src/libsystemd/sd-bus/test-bus-kernel.c b/src/libsystemd/sd-bus/test-bus-kernel.c
index 3aec568..20dd761 100644
--- a/src/libsystemd/sd-bus/test-bus-kernel.c
+++ b/src/libsystemd/sd-bus/test-bus-kernel.c
@@ -25,8 +25,6 @@
 #include "log.h"
 
 #include "sd-bus.h"
-#include "bus-message.h"
-#include "bus-error.h"
 #include "bus-kernel.h"
 #include "bus-util.h"
 #include "bus-dump.h"
diff --git a/src/libsystemd/sd-bus/test-bus-marshal.c b/src/libsystemd/sd-bus/test-bus-marshal.c
index d95a03c..7569ff9 100644
--- a/src/libsystemd/sd-bus/test-bus-marshal.c
+++ b/src/libsystemd/sd-bus/test-bus-marshal.c
@@ -19,9 +19,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <stdlib.h>
-#include <byteswap.h>
 #include <math.h>
 
 #ifdef HAVE_GLIB
diff --git a/src/libsystemd/sd-bus/test-bus-match.c b/src/libsystemd/sd-bus/test-bus-match.c
index 76ca0b6..051969f 100644
--- a/src/libsystemd/sd-bus/test-bus-match.c
+++ b/src/libsystemd/sd-bus/test-bus-match.c
@@ -20,7 +20,6 @@
 ***/
 
 #include "log.h"
-#include "util.h"
 #include "macro.h"
 
 #include "bus-match.h"
diff --git a/src/libsystemd/sd-bus/test-bus-objects.c b/src/libsystemd/sd-bus/test-bus-objects.c
index acf67a5..895eda4 100644
--- a/src/libsystemd/sd-bus/test-bus-objects.c
+++ b/src/libsystemd/sd-bus/test-bus-objects.c
@@ -19,11 +19,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <stdlib.h>
 #include <pthread.h>
-#include <unistd.h>
-#include <fcntl.h>
 
 #include "log.h"
 #include "util.h"
diff --git a/src/libsystemd/sd-bus/test-bus-server.c b/src/libsystemd/sd-bus/test-bus-server.c
index 5f807c3..080d8ed 100644
--- a/src/libsystemd/sd-bus/test-bus-server.c
+++ b/src/libsystemd/sd-bus/test-bus-server.c
@@ -19,11 +19,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <stdlib.h>
 #include <pthread.h>
-#include <unistd.h>
-#include <fcntl.h>
 
 #include "log.h"
 #include "util.h"
@@ -31,7 +28,6 @@
 
 #include "sd-bus.h"
 #include "bus-internal.h"
-#include "bus-message.h"
 #include "bus-util.h"
 
 struct context {
diff --git a/src/libsystemd/sd-bus/test-bus-signature.c b/src/libsystemd/sd-bus/test-bus-signature.c
index 3fc565c..4165c92 100644
--- a/src/libsystemd/sd-bus/test-bus-signature.c
+++ b/src/libsystemd/sd-bus/test-bus-signature.c
@@ -19,8 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
-#include <stdlib.h>
 
 #include "log.h"
 #include "bus-signature.h"
diff --git a/src/libsystemd/sd-bus/test-bus-zero-copy.c b/src/libsystemd/sd-bus/test-bus-zero-copy.c
index a054f74..0dc980a 100644
--- a/src/libsystemd/sd-bus/test-bus-zero-copy.c
+++ b/src/libsystemd/sd-bus/test-bus-zero-copy.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <fcntl.h>
 #include <sys/mman.h>
 
 #include "util.h"
@@ -28,7 +27,6 @@
 
 #include "sd-bus.h"
 #include "bus-message.h"
-#include "bus-error.h"
 #include "bus-kernel.h"
 #include "bus-dump.h"
 
diff --git a/src/libsystemd/sd-daemon/sd-daemon.c b/src/libsystemd/sd-daemon/sd-daemon.c
index 4aea636..b7acc4a 100644
--- a/src/libsystemd/sd-daemon/sd-daemon.c
+++ b/src/libsystemd/sd-daemon/sd-daemon.c
@@ -19,11 +19,9 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <sys/un.h>
-#include <fcntl.h>
 #include <netinet/in.h>
 #include <stdlib.h>
 #include <errno.h>
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index 25089a0..0c4e517 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -22,7 +22,6 @@
 #include <sys/epoll.h>
 #include <sys/timerfd.h>
 #include <sys/wait.h>
-#include <pthread.h>
 
 #include "sd-id128.h"
 #include "sd-daemon.h"
diff --git a/src/libsystemd/sd-hwdb/sd-hwdb.c b/src/libsystemd/sd-hwdb/sd-hwdb.c
index 61c7b44..3bbf028 100644
--- a/src/libsystemd/sd-hwdb/sd-hwdb.c
+++ b/src/libsystemd/sd-hwdb/sd-hwdb.c
@@ -23,10 +23,8 @@
 #include <errno.h>
 #include <string.h>
 #include <inttypes.h>
-#include <ctype.h>
 #include <stdlib.h>
 #include <fnmatch.h>
-#include <getopt.h>
 #include <sys/mman.h>
 
 #include "sd-hwdb.h"
diff --git a/src/libsystemd/sd-network/network-util.h b/src/libsystemd/sd-network/network-util.h
index 02bd545..11a0012 100644
--- a/src/libsystemd/sd-network/network-util.h
+++ b/src/libsystemd/sd-network/network-util.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "util.h"
 #include "sd-network.h"
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(sd_network_monitor*, sd_network_monitor_unref);
diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c
index c4713fe..297fdac 100644
--- a/src/libsystemd/sd-network/sd-network.c
+++ b/src/libsystemd/sd-network/sd-network.c
@@ -20,19 +20,16 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <unistd.h>
 #include <string.h>
 #include <errno.h>
 #include <sys/inotify.h>
 #include <poll.h>
-#include <net/if.h>
 
 #include "util.h"
 #include "macro.h"
 #include "strv.h"
 #include "fileio.h"
 #include "sd-network.h"
-#include "network-internal.h"
 
 _public_ int sd_network_get_operational_state(char **state) {
         _cleanup_free_ char *s = NULL;
diff --git a/src/libsystemd/sd-resolve/sd-resolve.c b/src/libsystemd/sd-resolve/sd-resolve.c
index 6448280..ca51786 100644
--- a/src/libsystemd/sd-resolve/sd-resolve.c
+++ b/src/libsystemd/sd-resolve/sd-resolve.c
@@ -19,24 +19,13 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
-#include <fcntl.h>
 #include <signal.h>
 #include <unistd.h>
-#include <sys/select.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <pwd.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
 #include <resolv.h>
-#include <dirent.h>
-#include <sys/time.h>
-#include <sys/resource.h>
 #include <stdint.h>
 #include <pthread.h>
 #include <sys/prctl.h>
diff --git a/src/libsystemd/sd-resolve/test-resolve.c b/src/libsystemd/sd-resolve/test-resolve.c
index d08e1b5..3187ce9 100644
--- a/src/libsystemd/sd-resolve/test-resolve.c
+++ b/src/libsystemd/sd-resolve/test-resolve.c
@@ -21,14 +21,11 @@
 ***/
 
 #include <string.h>
-#include <sys/types.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
 #include <stdio.h>
 #include <netinet/in.h>
-#include <arpa/nameser.h>
 #include <resolv.h>
-#include <signal.h>
 #include <errno.h>
 
 #include "socket-util.h"
diff --git a/src/libsystemd/sd-rtnl/local-addresses.h b/src/libsystemd/sd-rtnl/local-addresses.h
index ef7def5..bdc28d3 100644
--- a/src/libsystemd/sd-rtnl/local-addresses.h
+++ b/src/libsystemd/sd-rtnl/local-addresses.h
@@ -21,10 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
-#include <sys/types.h>
-#include <assert.h>
-#include <sys/socket.h>
 
 #include "sd-rtnl.h"
 #include "in-addr-util.h"
diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c
index 276591f..8f7d50a 100644
--- a/src/libsystemd/sd-rtnl/rtnl-message.c
+++ b/src/libsystemd/sd-rtnl/rtnl-message.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <netinet/in.h>
-#include <netinet/ether.h>
 #include <stdbool.h>
 #include <unistd.h>
 
diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c
index a4c71f3..3f4ba2e 100644
--- a/src/libsystemd/sd-rtnl/rtnl-types.c
+++ b/src/libsystemd/sd-rtnl/rtnl-types.c
@@ -19,12 +19,10 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stddef.h>
 #include <stdint.h>
 #include <sys/socket.h>
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
-#include <linux/in6.h>
 #include <linux/veth.h>
 #include <linux/if_bridge.h>
 #include <linux/if_addr.h>
diff --git a/src/libsystemd/sd-rtnl/rtnl-util.c b/src/libsystemd/sd-rtnl/rtnl-util.c
index 5666ea4..9ddf074 100644
--- a/src/libsystemd/sd-rtnl/rtnl-util.c
+++ b/src/libsystemd/sd-rtnl/rtnl-util.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <netinet/ether.h>
 
 #include "sd-rtnl.h"
 
diff --git a/src/libsystemd/sd-rtnl/rtnl-util.h b/src/libsystemd/sd-rtnl/rtnl-util.h
index ca9fbd4..9e4bdb8 100644
--- a/src/libsystemd/sd-rtnl/rtnl-util.h
+++ b/src/libsystemd/sd-rtnl/rtnl-util.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <netinet/ether.h>
 
 #include "util.h"
 #include "sd-rtnl.h"
diff --git a/src/libsystemd/sd-rtnl/test-rtnl.c b/src/libsystemd/sd-rtnl/test-rtnl.c
index 02f7a8e..47cce64 100644
--- a/src/libsystemd/sd-rtnl/test-rtnl.c
+++ b/src/libsystemd/sd-rtnl/test-rtnl.c
@@ -29,7 +29,6 @@
 #include "rtnl-util.h"
 #include "event-util.h"
 #include "missing.h"
-#include "rtnl-internal.h"
 
 static void test_message_link_bridge(sd_rtnl *rtnl) {
         _cleanup_rtnl_message_unref_ sd_rtnl_message *message = NULL;
diff --git a/src/libudev/libudev-device-private.c b/src/libudev/libudev-device-private.c
index fb4c6e2..15d3b23 100644
--- a/src/libudev/libudev-device-private.c
+++ b/src/libudev/libudev-device-private.c
@@ -17,7 +17,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <stddef.h>
diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c
index 1a880c2..4e6e47c 100644
--- a/src/libudev/libudev-enumerate.c
+++ b/src/libudev/libudev-enumerate.c
@@ -20,14 +20,12 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 #include <dirent.h>
 #include <fnmatch.h>
 #include <stdbool.h>
 #include <sys/stat.h>
-#include <sys/param.h>
 
 #include "libudev.h"
 #include "libudev-private.h"
diff --git a/src/libudev/libudev-list.c b/src/libudev/libudev-list.c
index 42fcb85..044ee3a 100644
--- a/src/libudev/libudev-list.c
+++ b/src/libudev/libudev-list.c
@@ -17,14 +17,11 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 
-#include "libudev.h"
 #include "libudev-private.h"
 
 /**
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index 3f1fee7..eb7b6f8 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -23,12 +23,8 @@
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>
-#include <dirent.h>
 #include <poll.h>
-#include <sys/stat.h>
 #include <sys/socket.h>
-#include <sys/un.h>
-#include <arpa/inet.h>
 #include <linux/netlink.h>
 #include <linux/filter.h>
 
diff --git a/src/libudev/libudev-queue.c b/src/libudev/libudev-queue.c
index 8ef1f3d..11e15d1 100644
--- a/src/libudev/libudev-queue.c
+++ b/src/libudev/libudev-queue.c
@@ -18,17 +18,12 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
 #include <unistd.h>
 #include <errno.h>
-#include <string.h>
-#include <limits.h>
-#include <sys/stat.h>
 #include <sys/inotify.h>
 
-#include "libudev.h"
 #include "libudev-private.h"
 
 /**
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c
index 291829e..0f8f634 100644
--- a/src/libudev/libudev-util.c
+++ b/src/libudev/libudev-util.c
@@ -17,20 +17,12 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>
-#include <dirent.h>
 #include <ctype.h>
-#include <fcntl.h>
-#include <time.h>
-#include <pwd.h>
-#include <grp.h>
-#include <sys/stat.h>
-#include <sys/param.h>
 
 #include "device-nodes.h"
 #include "libudev.h"
diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c
index 8785f22..ec15d25 100644
--- a/src/libudev/libudev.c
+++ b/src/libudev/libudev.c
@@ -21,11 +21,8 @@
 #include <stdlib.h>
 #include <stddef.h>
 #include <stdarg.h>
-#include <unistd.h>
-#include <errno.h>
 #include <string.h>
 #include <ctype.h>
-#include <time.h>
 
 #include "libudev.h"
 #include "libudev-private.h"
diff --git a/src/libudev/libudev.h b/src/libudev/libudev.h
index a94505c..eb58740 100644
--- a/src/libudev/libudev.h
+++ b/src/libudev/libudev.h
@@ -22,7 +22,6 @@
 
 #include <stdarg.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index 41a88a8..515fca5 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -23,25 +23,19 @@
 #include <locale.h>
 #include <stdlib.h>
 #include <stdbool.h>
-#include <unistd.h>
 #include <getopt.h>
 #include <string.h>
 #include <ftw.h>
-#include <sys/mman.h>
-#include <fcntl.h>
 
 #include "sd-bus.h"
 #include "bus-util.h"
 #include "bus-error.h"
-#include "bus-message.h"
 #include "util.h"
 #include "spawn-polkit-agent.h"
 #include "build.h"
 #include "strv.h"
 #include "pager.h"
 #include "set.h"
-#include "path-util.h"
-#include "utf8.h"
 #include "def.h"
 #include "virt.h"
 #include "fileio.h"
diff --git a/src/locale/localed.c b/src/locale/localed.c
index d1c90d6..ec969af 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -33,7 +33,6 @@
 #include "env-util.h"
 #include "fileio.h"
 #include "fileio-label.h"
-#include "label.h"
 #include "bus-util.h"
 #include "bus-error.h"
 #include "bus-message.h"
diff --git a/src/login/inhibit.c b/src/login/inhibit.c
index 44bda34..fcc8d72 100644
--- a/src/login/inhibit.c
+++ b/src/login/inhibit.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <getopt.h>
-#include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index b0eede9..e751af2 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -23,7 +23,6 @@
 #include <errno.h>
 #include <string.h>
 #include <getopt.h>
-#include <pwd.h>
 #include <locale.h>
 
 #include "sd-bus.h"
diff --git a/src/login/logind-acl.c b/src/login/logind-acl.c
index 5856f90..941fd72 100644
--- a/src/login/logind-acl.c
+++ b/src/login/logind-acl.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <errno.h>
 #include <string.h>
 
diff --git a/src/login/logind-action.c b/src/login/logind-action.c
index 0844df2..20c1c89 100644
--- a/src/login/logind-action.c
+++ b/src/login/logind-action.c
@@ -21,7 +21,6 @@
 
 #include <unistd.h>
 
-#include "sd-messages.h"
 #include "conf-parser.h"
 #include "special.h"
 #include "sleep-config.h"
diff --git a/src/login/logind-action.h b/src/login/logind-action.h
index e9b424b..ff98065 100644
--- a/src/login/logind-action.h
+++ b/src/login/logind-action.h
@@ -36,7 +36,6 @@ typedef enum HandleAction {
 } HandleAction;
 
 #include "logind.h"
-#include "logind-inhibit.h"
 
 int manager_handle_action(
                 Manager *m,
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
index d7211e6..610adc5 100644
--- a/src/login/logind-button.c
+++ b/src/login/logind-button.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -28,9 +27,7 @@
 #include <linux/input.h>
 
 #include "sd-messages.h"
-#include "conf-parser.h"
 #include "util.h"
-#include "special.h"
 #include "logind-button.h"
 
 Button* button_new(Manager *m, const char *name) {
diff --git a/src/login/logind-button.h b/src/login/logind-button.h
index 72a612e..80d93c7 100644
--- a/src/login/logind-button.h
+++ b/src/login/logind-button.h
@@ -23,8 +23,6 @@
 
 typedef struct Button Button;
 
-#include "list.h"
-#include "util.h"
 #include "logind.h"
 
 struct Button {
diff --git a/src/login/logind-core.c b/src/login/logind-core.c
index a6ff5ad..e8da59a 100644
--- a/src/login/logind-core.c
+++ b/src/login/logind-core.c
@@ -20,16 +20,13 @@
 ***/
 
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <pwd.h>
-#include <unistd.h>
 #include <linux/vt.h>
 
 #include "strv.h"
 #include "cgroup-util.h"
-#include "audit.h"
 #include "bus-util.h"
 #include "bus-error.h"
 #include "udev-util.h"
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 8b0bafd..030550e 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -24,7 +24,6 @@
 #include <unistd.h>
 #include <pwd.h>
 
-#include "sd-id128.h"
 #include "sd-messages.h"
 #include "strv.h"
 #include "mkdir.h"
@@ -32,10 +31,7 @@
 #include "special.h"
 #include "sleep-config.h"
 #include "fileio-label.h"
-#include "label.h"
-#include "utf8.h"
 #include "unit-name.h"
-#include "virt.h"
 #include "audit.h"
 #include "bus-util.h"
 #include "bus-error.h"
diff --git a/src/login/logind-device.c b/src/login/logind-device.c
index 76c5a5c..ee4c45f 100644
--- a/src/login/logind-device.c
+++ b/src/login/logind-device.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <string.h>
 
 #include "util.h"
diff --git a/src/login/logind-device.h b/src/login/logind-device.h
index c273d2b..6b27285 100644
--- a/src/login/logind-device.h
+++ b/src/login/logind-device.h
@@ -24,8 +24,6 @@
 typedef struct Device Device;
 
 #include "list.h"
-#include "util.h"
-#include "logind.h"
 #include "logind-seat.h"
 #include "logind-session-device.h"
 
diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
index 84fee0e..5d81693 100644
--- a/src/login/logind-inhibit.c
+++ b/src/login/logind-inhibit.c
@@ -26,7 +26,6 @@
 
 #include "util.h"
 #include "mkdir.h"
-#include "path-util.h"
 #include "logind-inhibit.h"
 #include "fileio.h"
 
diff --git a/src/login/logind-inhibit.h b/src/login/logind-inhibit.h
index f767876..1b77fc1 100644
--- a/src/login/logind-inhibit.h
+++ b/src/login/logind-inhibit.h
@@ -23,8 +23,6 @@
 
 typedef struct Inhibitor Inhibitor;
 
-#include "list.h"
-#include "util.h"
 
 typedef enum InhibitWhat {
         INHIBIT_SHUTDOWN = 1,
@@ -46,7 +44,6 @@ typedef enum InhibitMode {
 } InhibitMode;
 
 #include "logind.h"
-#include "logind-seat.h"
 
 struct Inhibitor {
         Manager *manager;
diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c
index 126c5b8..49808c9 100644
--- a/src/login/logind-seat.c
+++ b/src/login/logind-seat.c
@@ -19,21 +19,16 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <errno.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <sys/ioctl.h>
-#include <linux/vt.h>
 #include <string.h>
 
-#include "sd-id128.h"
 #include "sd-messages.h"
 #include "logind-seat.h"
 #include "logind-acl.h"
 #include "util.h"
 #include "mkdir.h"
-#include "path-util.h"
 
 Seat *seat_new(Manager *m, const char *id) {
         Seat *s;
diff --git a/src/login/logind-seat.h b/src/login/logind-seat.h
index 9e469d4..c1bb83b 100644
--- a/src/login/logind-seat.h
+++ b/src/login/logind-seat.h
@@ -24,9 +24,6 @@
 typedef struct Seat Seat;
 
 #include "list.h"
-#include "util.h"
-#include "logind.h"
-#include "logind-device.h"
 #include "logind-session.h"
 
 struct Seat {
diff --git a/src/login/logind-session-device.c b/src/login/logind-session-device.c
index c2de862..656f268 100644
--- a/src/login/logind-session-device.c
+++ b/src/login/logind-session-device.c
@@ -19,16 +19,12 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <fcntl.h>
 #include <libudev.h>
 #include <linux/input.h>
-#include <linux/ioctl.h>
 #include <string.h>
 #include <sys/ioctl.h>
-#include <sys/stat.h>
 #include <sys/types.h>
-#include <unistd.h>
 
 #include "util.h"
 #include "missing.h"
diff --git a/src/login/logind-session-device.h b/src/login/logind-session-device.h
index 61a843d..1c9f998 100644
--- a/src/login/logind-session-device.h
+++ b/src/login/logind-session-device.h
@@ -25,11 +25,7 @@ typedef enum DeviceType DeviceType;
 typedef struct SessionDevice SessionDevice;
 
 #include "list.h"
-#include "util.h"
 #include "logind.h"
-#include "logind-device.h"
-#include "logind-seat.h"
-#include "logind-session.h"
 
 enum DeviceType {
         DEVICE_TYPE_UNKNOWN,
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index a02a537..ce5dbb4 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -28,9 +28,7 @@
 #include <sys/ioctl.h>
 #include <unistd.h>
 
-#include "sd-id128.h"
 #include "sd-messages.h"
-#include "strv.h"
 #include "util.h"
 #include "mkdir.h"
 #include "path-util.h"
diff --git a/src/login/logind-session.h b/src/login/logind-session.h
index a007fb5..e1bcc29 100644
--- a/src/login/logind-session.h
+++ b/src/login/logind-session.h
@@ -25,10 +25,6 @@ typedef struct Session Session;
 typedef enum KillWho KillWho;
 
 #include "list.h"
-#include "util.h"
-#include "logind.h"
-#include "logind-seat.h"
-#include "logind-session-device.h"
 #include "logind-user.h"
 #include "login-shared.h"
 
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index f4c4490..294c1e7 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -27,7 +27,6 @@
 #include "util.h"
 #include "mkdir.h"
 #include "hashmap.h"
-#include "strv.h"
 #include "fileio.h"
 #include "path-util.h"
 #include "special.h"
diff --git a/src/login/logind-user.h b/src/login/logind-user.h
index 4e0568f..4d75342 100644
--- a/src/login/logind-user.h
+++ b/src/login/logind-user.h
@@ -24,9 +24,7 @@
 typedef struct User User;
 
 #include "list.h"
-#include "util.h"
 #include "logind.h"
-#include "logind-session.h"
 
 typedef enum UserState {
         USER_OFFLINE,    /* Not logged in at all */
diff --git a/src/login/logind.c b/src/login/logind.c
index b44f376..08a7cbc 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -24,13 +24,10 @@
 #include <fcntl.h>
 #include <string.h>
 #include <unistd.h>
-#include <linux/vt.h>
-#include <sys/timerfd.h>
 
 #include "sd-daemon.h"
 #include "strv.h"
 #include "conf-parser.h"
-#include "mkdir.h"
 #include "bus-util.h"
 #include "bus-error.h"
 #include "logind.h"
diff --git a/src/login/logind.h b/src/login/logind.h
index e0cb7d0..48e647a 100644
--- a/src/login/logind.h
+++ b/src/login/logind.h
@@ -22,12 +22,10 @@
 ***/
 
 #include <stdbool.h>
-#include <inttypes.h>
 #include <libudev.h>
 
 #include "sd-event.h"
 #include "sd-bus.h"
-#include "util.h"
 #include "list.h"
 #include "hashmap.h"
 #include "set.h"
@@ -35,9 +33,6 @@
 typedef struct Manager Manager;
 
 #include "logind-device.h"
-#include "logind-seat.h"
-#include "logind-session.h"
-#include "logind-user.h"
 #include "logind-inhibit.h"
 #include "logind-button.h"
 #include "logind-action.h"
diff --git a/src/login/test-inhibit.c b/src/login/test-inhibit.c
index 274687d..03516de 100644
--- a/src/login/test-inhibit.c
+++ b/src/login/test-inhibit.c
@@ -25,7 +25,6 @@
 #include "util.h"
 #include "sd-bus.h"
 #include "bus-util.h"
-#include "bus-error.h"
 
 static int inhibit(sd_bus *bus, const char *what) {
         _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
diff --git a/src/login/user-sessions.c b/src/login/user-sessions.c
index 6edb823..1c31769 100644
--- a/src/login/user-sessions.c
+++ b/src/login/user-sessions.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <string.h>
 #include <unistd.h>
 #include <errno.h>
 
diff --git a/src/machine-id-commit/machine-id-commit.c b/src/machine-id-commit/machine-id-commit.c
index c7e4de8..d9c1b7c 100644
--- a/src/machine-id-commit/machine-id-commit.c
+++ b/src/machine-id-commit/machine-id-commit.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <getopt.h>
diff --git a/src/machine-id-setup/machine-id-setup-main.c b/src/machine-id-setup/machine-id-setup-main.c
index 85bbfc4..20cb60b 100644
--- a/src/machine-id-setup/machine-id-setup-main.c
+++ b/src/machine-id-setup/machine-id-setup-main.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <getopt.h>
diff --git a/src/machine/image-dbus.c b/src/machine/image-dbus.c
index f5c7d4d..fdac259 100644
--- a/src/machine/image-dbus.c
+++ b/src/machine/image-dbus.c
@@ -20,7 +20,6 @@
 ***/
 
 #include "bus-label.h"
-#include "bus-common-errors.h"
 #include "strv.h"
 #include "bus-util.h"
 #include "machine-image.h"
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
index b46f0a8..13b413d 100644
--- a/src/machine/machine-dbus.c
+++ b/src/machine/machine-dbus.c
@@ -21,7 +21,6 @@
 
 #include <errno.h>
 #include <string.h>
-#include <arpa/inet.h>
 
 #include "bus-util.h"
 #include "bus-label.h"
diff --git a/src/machine/machine-dbus.h b/src/machine/machine-dbus.h
index 6012527..fcc5613 100644
--- a/src/machine/machine-dbus.h
+++ b/src/machine/machine-dbus.h
@@ -22,7 +22,6 @@
 ***/
 
 #include "sd-bus.h"
-#include "machine.h"
 
 extern const sd_bus_vtable machine_vtable[];
 
diff --git a/src/machine/machine.c b/src/machine/machine.c
index 223eb0f..2b482f9 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -28,7 +28,6 @@
 #include "util.h"
 #include "mkdir.h"
 #include "hashmap.h"
-#include "strv.h"
 #include "fileio.h"
 #include "special.h"
 #include "unit-name.h"
diff --git a/src/machine/machine.h b/src/machine/machine.h
index 4827ba3..2f77849 100644
--- a/src/machine/machine.h
+++ b/src/machine/machine.h
@@ -25,7 +25,6 @@ typedef struct Machine Machine;
 typedef enum KillWho KillWho;
 
 #include "list.h"
-#include "util.h"
 #include "machined.h"
 
 typedef enum MachineState {
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 9f8c68b..80fb426 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -24,7 +24,6 @@
 #include <errno.h>
 #include <string.h>
 #include <getopt.h>
-#include <pwd.h>
 #include <locale.h>
 #include <fcntl.h>
 #include <netinet/in.h>
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c
index ac19695..4eb557d 100644
--- a/src/machine/machined-dbus.c
+++ b/src/machine/machined-dbus.c
@@ -22,21 +22,12 @@
 #include <errno.h>
 #include <string.h>
 #include <unistd.h>
-#include <pwd.h>
 
 #include "sd-id128.h"
-#include "sd-messages.h"
-#include "strv.h"
-#include "mkdir.h"
 #include "path-util.h"
-#include "special.h"
-#include "fileio-label.h"
-#include "label.h"
-#include "utf8.h"
 #include "unit-name.h"
 #include "bus-util.h"
 #include "bus-common-errors.h"
-#include "time-util.h"
 #include "cgroup-util.h"
 #include "machine-image.h"
 #include "image-dbus.h"
diff --git a/src/machine/machined.c b/src/machine/machined.c
index 6877c2b..8de1988 100644
--- a/src/machine/machined.c
+++ b/src/machine/machined.c
@@ -20,17 +20,11 @@
 ***/
 
 #include <errno.h>
-#include <pwd.h>
-#include <fcntl.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/epoll.h>
 
 #include "sd-daemon.h"
-#include "strv.h"
-#include "conf-parser.h"
 #include "cgroup-util.h"
-#include "mkdir.h"
 #include "bus-util.h"
 #include "bus-error.h"
 #include "label.h"
diff --git a/src/machine/machined.h b/src/machine/machined.h
index df0cb82..0f3df17 100644
--- a/src/machine/machined.h
+++ b/src/machine/machined.h
@@ -22,9 +22,7 @@
 ***/
 
 #include <stdbool.h>
-#include <inttypes.h>
 
-#include "util.h"
 #include "list.h"
 #include "hashmap.h"
 #include "sd-event.h"
diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
index 5f67878..76e9403 100644
--- a/src/modules-load/modules-load.c
+++ b/src/modules-load/modules-load.c
@@ -19,13 +19,10 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <unistd.h>
-#include <fcntl.h>
 #include <errno.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <limits.h>
-#include <dirent.h>
 #include <getopt.h>
 #include <libkmod.h>
 
@@ -33,7 +30,6 @@
 #include "util.h"
 #include "strv.h"
 #include "conf-files.h"
-#include "fileio.h"
 #include "build.h"
 
 static char **arg_proc_cmdline_modules = NULL;
diff --git a/src/network/networkd-address-pool.c b/src/network/networkd-address-pool.c
index 7ad11c6..584a956 100644
--- a/src/network/networkd-address-pool.c
+++ b/src/network/networkd-address-pool.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <arpa/inet.h>
 
 #include "networkd.h"
 #include "networkd-link.h"
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 47033ac..255ff77 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -25,7 +25,6 @@
 #include "util.h"
 #include "conf-parser.h"
 #include "fw-util.h"
-#include "network-internal.h"
 #include "networkd.h"
 #include "networkd-link.h"
 
diff --git a/src/network/networkd-fdb.c b/src/network/networkd-fdb.c
index feab8d4..b6b8327 100644
--- a/src/network/networkd-fdb.c
+++ b/src/network/networkd-fdb.c
@@ -19,16 +19,11 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <ctype.h>
 #include <net/if.h>
 #include <net/ethernet.h>
 
 #include "networkd.h"
-#include "networkd-netdev.h"
 #include "networkd-link.h"
-#include "network-internal.h"
-#include "path-util.h"
-#include "conf-files.h"
 #include "conf-parser.h"
 #include "util.h"
 
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index f716e82..0665e1f 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -28,12 +28,9 @@
 #include "fileio.h"
 #include "bus-util.h"
 #include "udev-util.h"
-#include "libudev-private.h"
 #include "network-internal.h"
 #include "networkd-link.h"
 #include "networkd-netdev.h"
-#include "conf-parser.h"
-#include "dhcp-lease-internal.h"
 
 bool link_dhcp6_enabled(Link *link) {
         if (link->flags & IFF_LOOPBACK)
diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h
index cec158e..a8ae127 100644
--- a/src/network/networkd-link.h
+++ b/src/network/networkd-link.h
@@ -21,7 +21,6 @@
 
 #pragma once
 
-#include <endian.h>
 
 #include "networkd.h"
 
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index ce97ac0..cffae83 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -27,13 +27,11 @@
 #include "networkd.h"
 #include "networkd-netdev.h"
 #include "networkd-link.h"
-#include "network-internal.h"
 #include "libudev-private.h"
 #include "udev-util.h"
 #include "rtnl-util.h"
 #include "bus-util.h"
 #include "def.h"
-#include "mkdir.h"
 #include "virt.h"
 
 #include "sd-rtnl.h"
diff --git a/src/network/networkd-netdev-bond.c b/src/network/networkd-netdev-bond.c
index 88321ef..c911551 100644
--- a/src/network/networkd-netdev-bond.c
+++ b/src/network/networkd-netdev-bond.c
@@ -21,7 +21,6 @@
 ***/
 
 #include <netinet/ether.h>
-#include <arpa/inet.h>
 #include <linux/if_bonding.h>
 
 #include "conf-parser.h"
diff --git a/src/network/networkd-netdev-bridge.c b/src/network/networkd-netdev-bridge.c
index 91b7051..fd6af7e 100644
--- a/src/network/networkd-netdev-bridge.c
+++ b/src/network/networkd-netdev-bridge.c
@@ -20,11 +20,7 @@
     along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <netinet/ether.h>
-#include <arpa/inet.h>
-#include <net/if.h>
 
-#include "sd-rtnl.h"
 #include "networkd-netdev-bridge.h"
 #include "missing.h"
 
diff --git a/src/network/networkd-netdev-dummy.c b/src/network/networkd-netdev-dummy.c
index 01c10a2..bb246a2 100644
--- a/src/network/networkd-netdev-dummy.c
+++ b/src/network/networkd-netdev-dummy.c
@@ -20,12 +20,7 @@
     along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <netinet/ether.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <linux/veth.h>
 
-#include "sd-rtnl.h"
 #include "networkd-netdev-dummy.h"
 
 const NetDevVTable dummy_vtable = {
diff --git a/src/network/networkd-netdev-ipvlan.c b/src/network/networkd-netdev-ipvlan.c
index 9a7c280..5189000 100644
--- a/src/network/networkd-netdev-ipvlan.c
+++ b/src/network/networkd-netdev-ipvlan.c
@@ -20,12 +20,9 @@
 ***/
 
 #include <net/if.h>
-#include <linux/if_link.h>
 
 #include "networkd-netdev-ipvlan.h"
-#include "network-internal.h"
 #include "conf-parser.h"
-#include "list.h"
 
 static const char* const ipvlan_mode_table[_NETDEV_IPVLAN_MODE_MAX] = {
         [NETDEV_IPVLAN_MODE_L2] = "L2",
diff --git a/src/network/networkd-netdev-macvlan.c b/src/network/networkd-netdev-macvlan.c
index 198fb57..5f41f1c 100644
--- a/src/network/networkd-netdev-macvlan.c
+++ b/src/network/networkd-netdev-macvlan.c
@@ -22,9 +22,7 @@
 #include <net/if.h>
 
 #include "networkd-netdev-macvlan.h"
-#include "network-internal.h"
 #include "conf-parser.h"
-#include "list.h"
 
 static const char* const macvlan_mode_table[_NETDEV_MACVLAN_MODE_MAX] = {
         [NETDEV_MACVLAN_MODE_PRIVATE] = "private",
diff --git a/src/network/networkd-netdev-tunnel.c b/src/network/networkd-netdev-tunnel.c
index e95082d..89ad3ee 100644
--- a/src/network/networkd-netdev-tunnel.c
+++ b/src/network/networkd-netdev-tunnel.c
@@ -19,7 +19,6 @@
     along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <netinet/ether.h>
 #include <arpa/inet.h>
 #include <net/if.h>
 #include <linux/ip.h>
@@ -29,7 +28,6 @@
 #include "sd-rtnl.h"
 #include "networkd-netdev-tunnel.h"
 #include "networkd-link.h"
-#include "network-internal.h"
 #include "util.h"
 #include "missing.h"
 #include "conf-parser.h"
diff --git a/src/network/networkd-netdev-veth.c b/src/network/networkd-netdev-veth.c
index 251cf92..9e9e122 100644
--- a/src/network/networkd-netdev-veth.c
+++ b/src/network/networkd-netdev-veth.c
@@ -19,8 +19,6 @@
     along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <netinet/ether.h>
-#include <arpa/inet.h>
 #include <net/if.h>
 #include <linux/veth.h>
 
diff --git a/src/network/networkd-netdev-vlan.c b/src/network/networkd-netdev-vlan.c
index 665559f..0ed024b 100644
--- a/src/network/networkd-netdev-vlan.c
+++ b/src/network/networkd-netdev-vlan.c
@@ -22,8 +22,6 @@
 #include <net/if.h>
 
 #include "networkd-netdev-vlan.h"
-#include "network-internal.h"
-#include "list.h"
 
 static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *req) {
         VLan *v = VLAN(netdev);
diff --git a/src/network/networkd-netdev-vxlan.c b/src/network/networkd-netdev-vxlan.c
index d5128cb..4a3a511 100644
--- a/src/network/networkd-netdev-vxlan.c
+++ b/src/network/networkd-netdev-vxlan.c
@@ -19,8 +19,6 @@
     along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <netinet/ether.h>
-#include <arpa/inet.h>
 #include <net/if.h>
 
 #include "sd-rtnl.h"
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index 8119205..3d7cc73 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -24,7 +24,6 @@
 #include "networkd-netdev.h"
 #include "networkd-link.h"
 #include "network-internal.h"
-#include "path-util.h"
 #include "conf-files.h"
 #include "conf-parser.h"
 #include "list.h"
diff --git a/src/network/networkd-netdev.h b/src/network/networkd-netdev.h
index 3756b1e..7fd8396 100644
--- a/src/network/networkd-netdev.h
+++ b/src/network/networkd-netdev.h
@@ -22,10 +22,7 @@
 #pragma once
 
 #include "networkd.h"
-#include "hashmap.h"
 #include "list.h"
-#include "set.h"
-#include "in-addr-util.h"
 
 typedef struct NetDevVTable NetDevVTable;
 
diff --git a/src/network/networkd-network-bus.c b/src/network/networkd-network-bus.c
index 36b40d3..b5f8f5c 100644
--- a/src/network/networkd-network-bus.c
+++ b/src/network/networkd-network-bus.c
@@ -19,8 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "bus-util.h"
-#include "bus-label.h"
 #include "strv.h"
 
 #include "networkd.h"
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 35ac064..c6cf00a 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -22,7 +22,6 @@
 #include <ctype.h>
 #include <net/if.h>
 
-#include "path-util.h"
 #include "conf-files.h"
 #include "conf-parser.h"
 #include "util.h"
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index c2d1ffc..7f110a5 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -19,15 +19,12 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <net/if.h>
 
 #include "networkd.h"
 #include "networkd-link.h"
 
-#include "utf8.h"
 #include "util.h"
 #include "conf-parser.h"
-#include "network-internal.h"
 
 int route_new_static(Network *network, unsigned section, Route **ret) {
         _cleanup_route_free_ Route *route = NULL;
diff --git a/src/network/networkd-wait-online-link.c b/src/network/networkd-wait-online-link.c
index e091b20..341bcae 100644
--- a/src/network/networkd-wait-online-link.c
+++ b/src/network/networkd-wait-online-link.c
@@ -20,10 +20,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <net/if.h>
 
 #include "sd-network.h"
-#include "strv.h"
 
 #include "networkd-wait-online-link.h"
 
diff --git a/src/network/networkd-wait-online-manager.c b/src/network/networkd-wait-online-manager.c
index cafe110..1c997a5 100644
--- a/src/network/networkd-wait-online-manager.c
+++ b/src/network/networkd-wait-online-manager.c
@@ -25,7 +25,6 @@
 
 #include "rtnl-util.h"
 
-#include "network-util.h"
 #include "network-internal.h"
 #include "networkd-wait-online-link.h"
 #include "networkd-wait-online.h"
diff --git a/src/network/networkd-wait-online.h b/src/network/networkd-wait-online.h
index 66b865c..73d1296 100644
--- a/src/network/networkd-wait-online.h
+++ b/src/network/networkd-wait-online.h
@@ -25,7 +25,6 @@
 #include "sd-rtnl.h"
 #include "sd-network.h"
 
-#include "util.h"
 #include "hashmap.h"
 
 typedef struct Manager Manager;
diff --git a/src/network/networkd.c b/src/network/networkd.c
index 7319276..723d105 100644
--- a/src/network/networkd.c
+++ b/src/network/networkd.c
@@ -20,7 +20,6 @@
 ***/
 
 #include "capability.h"
-#include "sd-event.h"
 #include "sd-daemon.h"
 
 #include "networkd.h"
diff --git a/src/network/test-network-tables.c b/src/network/test-network-tables.c
index 6709ab0..67fcca2 100644
--- a/src/network/test-network-tables.c
+++ b/src/network/test-network-tables.c
@@ -1,5 +1,4 @@
 #include "networkd.h"
-#include "networkd-link.h"
 #include "networkd-netdev-bond.h"
 #include "networkd-netdev-macvlan.h"
 #include "dhcp6-internal.h"
diff --git a/src/notify/notify.c b/src/notify/notify.c
index f98075d..a8ffbe9 100644
--- a/src/notify/notify.c
+++ b/src/notify/notify.c
@@ -24,7 +24,6 @@
 #include <errno.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include <string.h>
 
 #include "systemd/sd-daemon.h"
 
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index fb67251..b37089c 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -23,27 +23,21 @@
 #include <sched.h>
 #include <unistd.h>
 #include <sys/types.h>
-#include <sys/syscall.h>
 #include <sys/mount.h>
-#include <sys/wait.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <errno.h>
 #include <sys/prctl.h>
 #include <getopt.h>
-#include <termios.h>
-#include <sys/signalfd.h>
 #include <grp.h>
 #include <linux/fs.h>
-#include <sys/un.h>
 #include <sys/socket.h>
 #include <linux/netlink.h>
 #include <net/if.h>
 #include <linux/veth.h>
 #include <sys/personality.h>
 #include <linux/loop.h>
-#include <poll.h>
 #include <sys/file.h>
 
 #ifdef HAVE_SELINUX
@@ -66,7 +60,6 @@
 #include "util.h"
 #include "mkdir.h"
 #include "macro.h"
-#include "audit.h"
 #include "missing.h"
 #include "cgroup-util.h"
 #include "strv.h"
@@ -79,9 +72,7 @@
 #include "bus-util.h"
 #include "bus-error.h"
 #include "ptyfwd.h"
-#include "bus-kernel.h"
 #include "env-util.h"
-#include "def.h"
 #include "rtnl-util.h"
 #include "udev-util.h"
 #include "blkid-util.h"
diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c
index a939bb2..fed76c6 100644
--- a/src/nss-myhostname/nss-myhostname.c
+++ b/src/nss-myhostname/nss-myhostname.c
@@ -19,16 +19,12 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <limits.h>
 #include <nss.h>
-#include <sys/types.h>
 #include <netdb.h>
 #include <errno.h>
 #include <string.h>
-#include <unistd.h>
 #include <net/if.h>
 #include <stdlib.h>
-#include <arpa/inet.h>
 
 #include "local-addresses.h"
 #include "macro.h"
diff --git a/src/nss-resolve/nss-resolve.c b/src/nss-resolve/nss-resolve.c
index 3f32ed0..bc6c5dc 100644
--- a/src/nss-resolve/nss-resolve.c
+++ b/src/nss-resolve/nss-resolve.c
@@ -19,16 +19,11 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <limits.h>
 #include <nss.h>
-#include <sys/types.h>
 #include <netdb.h>
 #include <errno.h>
 #include <string.h>
-#include <unistd.h>
-#include <net/if.h>
 #include <stdlib.h>
-#include <arpa/inet.h>
 #include <dlfcn.h>
 
 #include "sd-bus.h"
diff --git a/src/path/path.c b/src/path/path.c
index 2f0148f..99a4f2f 100644
--- a/src/path/path.c
+++ b/src/path/path.c
@@ -22,9 +22,7 @@
 #include <stdio.h>
 #include <getopt.h>
 #include <errno.h>
-#include <unistd.h>
 #include <stdlib.h>
-#include <string.h>
 
 #include "sd-path.h"
 #include "build.h"
diff --git a/src/quotacheck/quotacheck.c b/src/quotacheck/quotacheck.c
index 9ae3abd..819706a 100644
--- a/src/quotacheck/quotacheck.c
+++ b/src/quotacheck/quotacheck.c
@@ -21,12 +21,10 @@
 
 #include <stdio.h>
 #include <stdbool.h>
-#include <string.h>
 #include <errno.h>
 #include <unistd.h>
 
 #include "util.h"
-#include "fileio.h"
 
 static bool arg_skip = false;
 static bool arg_force = false;
diff --git a/src/remount-fs/remount-fs.c b/src/remount-fs/remount-fs.c
index 57b4702..70dacfa 100644
--- a/src/remount-fs/remount-fs.c
+++ b/src/remount-fs/remount-fs.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <unistd.h>
-#include <fcntl.h>
 #include <errno.h>
 #include <string.h>
 #include <sys/stat.h>
@@ -30,7 +29,6 @@
 #include "log.h"
 #include "util.h"
 #include "path-util.h"
-#include "set.h"
 #include "mount-setup.h"
 #include "exit-status.h"
 
diff --git a/src/reply-password/reply-password.c b/src/reply-password/reply-password.c
index abf5f52..d0d61b9 100644
--- a/src/reply-password/reply-password.c
+++ b/src/reply-password/reply-password.c
@@ -20,17 +20,9 @@
 ***/
 
 #include <sys/socket.h>
-#include <poll.h>
-#include <sys/types.h>
-#include <assert.h>
 #include <string.h>
 #include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
 #include <sys/un.h>
-#include <sys/stat.h>
-#include <sys/signalfd.h>
-#include <getopt.h>
 #include <stddef.h>
 
 #include "log.h"
diff --git a/src/resolve-host/resolve-host.c b/src/resolve-host/resolve-host.c
index 43ecf81..068756c 100644
--- a/src/resolve-host/resolve-host.c
+++ b/src/resolve-host/resolve-host.c
@@ -19,14 +19,12 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <arpa/inet.h>
 #include <net/if.h>
 #include <getopt.h>
 
 #include "sd-bus.h"
 #include "bus-util.h"
 #include "bus-error.h"
-#include "bus-common-errors.h"
 #include "in-addr-util.h"
 #include "af-list.h"
 #include "build.h"
diff --git a/src/resolve/resolved-dns-cache.h b/src/resolve/resolved-dns-cache.h
index e92280c..8a9b3d4 100644
--- a/src/resolve/resolved-dns-cache.h
+++ b/src/resolve/resolved-dns-cache.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
 
 #include "hashmap.h"
 #include "prioq.h"
diff --git a/src/resolve/resolved-dns-domain.h b/src/resolve/resolved-dns-domain.h
index 36f27ea..516d244 100644
--- a/src/resolve/resolved-dns-domain.h
+++ b/src/resolve/resolved-dns-domain.h
@@ -21,7 +21,6 @@
 
 #pragma once
 
-#include <sys/types.h>
 
 #include "hashmap.h"
 #include "in-addr-util.h"
diff --git a/src/resolve/resolved-dns-packet.h b/src/resolve/resolved-dns-packet.h
index 561dd3a..c586738 100644
--- a/src/resolve/resolved-dns-packet.h
+++ b/src/resolve/resolved-dns-packet.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
  ***/
 
-#include <inttypes.h>
 
 #include "macro.h"
 #include "sparse-endian.h"
diff --git a/src/resolve/resolved-dns-query.c b/src/resolve/resolved-dns-query.c
index f0483c9..d619fae 100644
--- a/src/resolve/resolved-dns-query.c
+++ b/src/resolve/resolved-dns-query.c
@@ -19,10 +19,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "af-list.h"
 
 #include "resolved-dns-query.h"
-#include "resolved-dns-domain.h"
 
 /* How long to wait for the query in total */
 #define QUERY_TIMEOUT_USEC (30 * USEC_PER_SEC)
diff --git a/src/resolve/resolved-dns-query.h b/src/resolve/resolved-dns-query.h
index 13b3ee4..788992e 100644
--- a/src/resolve/resolved-dns-query.h
+++ b/src/resolve/resolved-dns-query.h
@@ -21,21 +21,15 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
 
 #include "sd-bus.h"
-#include "util.h"
 #include "set.h"
 
 typedef struct DnsQuery DnsQuery;
 
-#include "resolved-dns-scope.h"
-#include "resolved-dns-rr.h"
 #include "resolved-dns-question.h"
 #include "resolved-dns-answer.h"
 #include "resolved-dns-stream.h"
-#include "resolved-dns-transaction.h"
-#include "resolved-manager.h"
 
 struct DnsQuery {
         Manager *manager;
diff --git a/src/resolve/resolved-dns-rr.h b/src/resolve/resolved-dns-rr.h
index 9d9a89d..26796c8 100644
--- a/src/resolve/resolved-dns-rr.h
+++ b/src/resolve/resolved-dns-rr.h
@@ -21,10 +21,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
  ***/
 
-#include <inttypes.h>
 #include <netinet/in.h>
 
-#include "util.h"
 #include "hashmap.h"
 #include "in-addr-util.h"
 #include "dns-type.h"
diff --git a/src/resolve/resolved-dns-scope.h b/src/resolve/resolved-dns-scope.h
index f05648e..cfbde13 100644
--- a/src/resolve/resolved-dns-scope.h
+++ b/src/resolve/resolved-dns-scope.h
@@ -27,11 +27,8 @@ typedef struct DnsScope DnsScope;
 
 #include "resolved-dns-server.h"
 #include "resolved-dns-packet.h"
-#include "resolved-dns-query.h"
 #include "resolved-dns-cache.h"
 #include "resolved-dns-zone.h"
-#include "resolved-dns-stream.h"
-#include "resolved-manager.h"
 #include "resolved-link.h"
 
 typedef enum DnsScopeMatch {
diff --git a/src/resolve/resolved-dns-server.h b/src/resolve/resolved-dns-server.h
index a438a27..70ff35b 100644
--- a/src/resolve/resolved-dns-server.h
+++ b/src/resolve/resolved-dns-server.h
@@ -32,7 +32,6 @@ typedef enum DnsServerType {
         DNS_SERVER_LINK,
 } DnsServerType;
 
-#include "resolved-manager.h"
 #include "resolved-link.h"
 
 struct DnsServer {
diff --git a/src/resolve/resolved-dns-stream.h b/src/resolve/resolved-dns-stream.h
index 46eae31..fb81e9f 100644
--- a/src/resolve/resolved-dns-stream.h
+++ b/src/resolve/resolved-dns-stream.h
@@ -27,7 +27,6 @@ typedef struct DnsStream DnsStream;
 
 #include "resolved-dns-packet.h"
 #include "resolved-dns-transaction.h"
-#include "resolved-manager.h"
 
 struct DnsStream {
         Manager *manager;
diff --git a/src/resolve/resolved-dns-transaction.h b/src/resolve/resolved-dns-transaction.h
index 182fb77..f6d539d 100644
--- a/src/resolve/resolved-dns-transaction.h
+++ b/src/resolve/resolved-dns-transaction.h
@@ -40,11 +40,9 @@ enum DnsTransactionState {
 };
 
 #include "resolved-dns-scope.h"
-#include "resolved-dns-rr.h"
 #include "resolved-dns-packet.h"
 #include "resolved-dns-question.h"
 #include "resolved-dns-answer.h"
-#include "resolved-dns-stream.h"
 
 struct DnsTransaction {
         DnsScope *scope;
diff --git a/src/resolve/resolved-link.h b/src/resolve/resolved-link.h
index 4f0702e..eee1846 100644
--- a/src/resolve/resolved-link.h
+++ b/src/resolve/resolved-link.h
@@ -29,8 +29,6 @@
 typedef struct Link Link;
 typedef struct LinkAddress LinkAddress;
 
-#include "resolved-dns-server.h"
-#include "resolved-dns-scope.h"
 #include "resolved-dns-rr.h"
 #include "resolved-manager.h"
 
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index b5ad701..167bea3 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -19,18 +19,13 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
  ***/
 
-#include <arpa/inet.h>
 #include <resolv.h>
-#include <net/if.h>
 #include <sys/ioctl.h>
 #include <poll.h>
 #include <netinet/in.h>
 
 #include "rtnl-util.h"
-#include "event-util.h"
-#include "network-util.h"
 #include "network-internal.h"
-#include "conf-parser.h"
 #include "socket-util.h"
 #include "af-list.h"
 #include "utf8.h"
diff --git a/src/resolve/resolved-manager.h b/src/resolve/resolved-manager.h
index 1151029..5a581cc 100644
--- a/src/resolve/resolved-manager.h
+++ b/src/resolve/resolved-manager.h
@@ -24,9 +24,7 @@
 #include "sd-event.h"
 #include "sd-network.h"
 #include "sd-rtnl.h"
-#include "util.h"
 #include "list.h"
-#include "in-addr-util.h"
 #include "hashmap.h"
 
 typedef struct Manager Manager;
@@ -41,8 +39,6 @@ enum Support {
 };
 
 #include "resolved-dns-query.h"
-#include "resolved-dns-server.h"
-#include "resolved-dns-scope.h"
 #include "resolved-dns-stream.h"
 #include "resolved-link.h"
 
diff --git a/src/resolve/resolved.c b/src/resolve/resolved.c
index ce15a80..271247c 100644
--- a/src/resolve/resolved.c
+++ b/src/resolve/resolved.c
@@ -22,7 +22,6 @@
 #include "sd-event.h"
 #include "sd-daemon.h"
 #include "mkdir.h"
-#include "label.h"
 #include "capability.h"
 #include "selinux-util.h"
 
diff --git a/src/resolve/test-dns-domain.c b/src/resolve/test-dns-domain.c
index ebc8d98..2f3edaf 100644
--- a/src/resolve/test-dns-domain.c
+++ b/src/resolve/test-dns-domain.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
  ***/
 
-#include "log.h"
 #include "macro.h"
 #include "resolved-dns-domain.h"
 
diff --git a/src/shared/acl-util.c b/src/shared/acl-util.c
index a4ff1ab..34707e6 100644
--- a/src/shared/acl-util.c
+++ b/src/shared/acl-util.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <errno.h>
 #include <stdbool.h>
 
diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c
index 390c323..64e5040 100644
--- a/src/shared/acpi-fpdt.c
+++ b/src/shared/acpi-fpdt.c
@@ -19,13 +19,11 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdlib.h>
 #include <stdio.h>
 #include <stdint.h>
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <sys/types.h>
 
 #include <util.h>
 #include <fileio.h>
diff --git a/src/shared/apparmor-util.c b/src/shared/apparmor-util.c
index c14843d..c2bbd33 100644
--- a/src/shared/apparmor-util.c
+++ b/src/shared/apparmor-util.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <unistd.h>
 
 #include "util.h"
 #include "fileio.h"
diff --git a/src/shared/arphrd-list.c b/src/shared/arphrd-list.c
index 6e113ef..284043c 100644
--- a/src/shared/arphrd-list.c
+++ b/src/shared/arphrd-list.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <net/if_arp.h>
-#include <sys/socket.h>
 #include <string.h>
 
 #include "util.h"
diff --git a/src/shared/ask-password-api.h b/src/shared/ask-password-api.h
index 704ee6e..0954e07 100644
--- a/src/shared/ask-password-api.h
+++ b/src/shared/ask-password-api.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "util.h"
 
 int ask_password_tty(const char *message, usec_t until, bool echo, const char *flag_file, char **_passphrase);
 
diff --git a/src/shared/audit.c b/src/shared/audit.c
index 4701c0a..4c1496f 100644
--- a/src/shared/audit.c
+++ b/src/shared/audit.c
@@ -19,20 +19,13 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
-#include <string.h>
-#include <unistd.h>
 #include <errno.h>
-#include <stdlib.h>
 #include <stdio.h>
-#include <ctype.h>
 
 #include "macro.h"
 #include "audit.h"
 #include "util.h"
-#include "log.h"
 #include "fileio.h"
-#include "virt.h"
 
 int audit_session_from_pid(pid_t pid, uint32_t *id) {
         _cleanup_free_ char *s = NULL;
diff --git a/src/shared/audit.h b/src/shared/audit.h
index b4aecff..7e9c929 100644
--- a/src/shared/audit.h
+++ b/src/shared/audit.h
@@ -23,7 +23,6 @@
 
 #include <sys/types.h>
 
-#include "capability.h"
 
 int audit_session_from_pid(pid_t pid, uint32_t *id);
 int audit_loginuid_from_pid(pid_t pid, uid_t *uid);
diff --git a/src/shared/barrier.c b/src/shared/barrier.c
index f65363a..ec121d7 100644
--- a/src/shared/barrier.c
+++ b/src/shared/barrier.c
@@ -21,13 +21,10 @@
 
 #include <errno.h>
 #include <fcntl.h>
-#include <limits.h>
 #include <poll.h>
 #include <stdbool.h>
 #include <stdint.h>
-#include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 #include <sys/eventfd.h>
 #include <sys/types.h>
 #include <unistd.h>
diff --git a/src/shared/barrier.h b/src/shared/barrier.h
index d4ad2a4..7816fae 100644
--- a/src/shared/barrier.h
+++ b/src/shared/barrier.h
@@ -21,14 +21,9 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <errno.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/types.h>
 
 #include "macro.h"
-#include "util.h"
 
 /* See source file for an API description. */
 
diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
index 73907c6..6bd317f 100644
--- a/src/shared/base-filesystem.c
+++ b/src/shared/base-filesystem.c
@@ -22,17 +22,12 @@
 #include <errno.h>
 #include <sys/stat.h>
 #include <stdlib.h>
-#include <string.h>
-#include <assert.h>
 #include <unistd.h>
 
 #include "base-filesystem.h"
 #include "log.h"
 #include "macro.h"
-#include "strv.h"
 #include "util.h"
-#include "label.h"
-#include "mkdir.h"
 
 typedef struct BaseFilesystem {
         const char *dir;
diff --git a/src/shared/boot-timestamps.c b/src/shared/boot-timestamps.c
index 54e0537..6841959 100644
--- a/src/shared/boot-timestamps.c
+++ b/src/shared/boot-timestamps.c
@@ -19,7 +19,6 @@
   You should have received a copy of the GNU Lesser General Public License
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
-#include <unistd.h>
 
 #include "boot-timestamps.h"
 #include "acpi-fpdt.h"
diff --git a/src/shared/btrfs-util.c b/src/shared/btrfs-util.c
index b34ac8b..2a70dfe 100644
--- a/src/shared/btrfs-util.c
+++ b/src/shared/btrfs-util.c
@@ -31,7 +31,6 @@
 #include "util.h"
 #include "path-util.h"
 #include "macro.h"
-#include "strv.h"
 #include "copy.h"
 #include "selinux-util.h"
 #include "smack-util.h"
diff --git a/src/shared/bus-label.c b/src/shared/bus-label.c
index 61eb75b..9e9eaf4 100644
--- a/src/shared/bus-label.c
+++ b/src/shared/bus-label.c
@@ -19,13 +19,10 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <stdlib.h>
-#include <unistd.h>
 
 #include "util.h"
 #include "macro.h"
-#include "def.h"
 
 #include "bus-label.h"
 
diff --git a/src/shared/cap-list.c b/src/shared/cap-list.c
index 8033e8c..bd5bffb 100644
--- a/src/shared/cap-list.c
+++ b/src/shared/cap-list.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <linux/capability.h>
 #include <string.h>
 
 #include "util.h"
diff --git a/src/shared/capability.c b/src/shared/capability.c
index 915ceb9..4840c3e 100644
--- a/src/shared/capability.c
+++ b/src/shared/capability.c
@@ -19,14 +19,9 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
-#include <string.h>
 #include <unistd.h>
 #include <errno.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <ctype.h>
 #include <sys/capability.h>
 #include <sys/prctl.h>
 #include "grp.h"
diff --git a/src/shared/capability.h b/src/shared/capability.h
index 6f2f6f9..8260ae1 100644
--- a/src/shared/capability.h
+++ b/src/shared/capability.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
 #include <stdbool.h>
 #include <sys/capability.h>
 
diff --git a/src/shared/cgroup-show.h b/src/shared/cgroup-show.h
index 3146f56..aa83245 100644
--- a/src/shared/cgroup-show.h
+++ b/src/shared/cgroup-show.h
@@ -23,7 +23,6 @@
 
 #include <stdbool.h>
 #include <sys/types.h>
-#include "util.h"
 #include "logs-show.h"
 
 int show_cgroup_by_path(const char *path, const char *prefix, unsigned columns, bool kernel_threads, OutputFlags flags);
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index dfd8689..05c3125 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -30,12 +30,10 @@
 #include <ftw.h>
 
 #include "cgroup-util.h"
-#include "log.h"
 #include "set.h"
 #include "macro.h"
 #include "util.h"
 #include "path-util.h"
-#include "strv.h"
 #include "unit-name.h"
 #include "fileio.h"
 #include "special.h"
diff --git a/src/shared/clean-ipc.c b/src/shared/clean-ipc.c
index 39ab645..ea781f5 100644
--- a/src/shared/clean-ipc.c
+++ b/src/shared/clean-ipc.c
@@ -24,7 +24,6 @@
 #include <sys/sem.h>
 #include <sys/msg.h>
 #include <sys/stat.h>
-#include <sys/mman.h>
 #include <fcntl.h>
 #include <dirent.h>
 #include <mqueue.h>
diff --git a/src/shared/clock-util.c b/src/shared/clock-util.c
index 9668468..e4e03df 100644
--- a/src/shared/clock-util.c
+++ b/src/shared/clock-util.c
@@ -19,29 +19,16 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
-#include <string.h>
-#include <unistd.h>
 #include <errno.h>
-#include <stdlib.h>
-#include <signal.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <sys/prctl.h>
 #include <sys/time.h>
 #include <linux/rtc.h>
 
 #include "macro.h"
 #include "util.h"
-#include "log.h"
-#include "strv.h"
 #include "clock-util.h"
-#include "fileio.h"
 
 int clock_get_hwclock(struct tm *tm) {
         _cleanup_close_ int fd = -1;
diff --git a/src/shared/clock-util.h b/src/shared/clock-util.h
index 198a7b2..8c2d235 100644
--- a/src/shared/clock-util.h
+++ b/src/shared/clock-util.h
@@ -21,7 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "util.h"
 
 int clock_is_localtime(void);
 int clock_set_timezone(int *min);
diff --git a/src/shared/condition.c b/src/shared/condition.c
index da7560f..f34b45f 100644
--- a/src/shared/condition.c
+++ b/src/shared/condition.c
@@ -23,14 +23,12 @@
 #include <errno.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/statvfs.h>
 #include <fnmatch.h>
 
 #include "sd-id128.h"
 #include "util.h"
 #include "virt.h"
 #include "path-util.h"
-#include "fileio.h"
 #include "architecture.h"
 #include "smack-util.h"
 #include "apparmor-util.h"
diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c
index db4937d..9ab0835 100644
--- a/src/shared/conf-files.c
+++ b/src/shared/conf-files.c
@@ -19,13 +19,10 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <string.h>
-#include <unistd.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <sys/stat.h>
 #include <dirent.h>
 
 #include "macro.h"
diff --git a/src/shared/conf-files.h b/src/shared/conf-files.h
index 368c112..3169a90 100644
--- a/src/shared/conf-files.h
+++ b/src/shared/conf-files.h
@@ -22,7 +22,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "macro.h"
 
 int conf_files_list(char ***strv, const char *suffix, const char *root, const char *dir, ...);
 int conf_files_list_strv(char ***strv, const char *suffix, const char *root, const char* const* dirs);
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 0b1af6c..2148a30 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -22,9 +22,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <errno.h>
-#include <assert.h>
 #include <stdlib.h>
-#include <netinet/ether.h>
 
 #include "conf-parser.h"
 #include "conf-files.h"
@@ -34,8 +32,6 @@
 #include "log.h"
 #include "utf8.h"
 #include "path-util.h"
-#include "set.h"
-#include "exit-status.h"
 #include "sd-messages.h"
 
 int log_syntax_internal(
diff --git a/src/shared/dev-setup.c b/src/shared/dev-setup.c
index e8b0810..cb15da8 100644
--- a/src/shared/dev-setup.c
+++ b/src/shared/dev-setup.c
@@ -20,15 +20,10 @@
 ***/
 
 #include <errno.h>
-#include <sys/stat.h>
 #include <stdlib.h>
-#include <string.h>
-#include <assert.h>
 #include <unistd.h>
 
 #include "dev-setup.h"
-#include "log.h"
-#include "macro.h"
 #include "util.h"
 #include "label.h"
 
diff --git a/src/shared/device-nodes.c b/src/shared/device-nodes.c
index 73e9edd..8751797 100644
--- a/src/shared/device-nodes.c
+++ b/src/shared/device-nodes.c
@@ -19,10 +19,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdlib.h>
 #include <stdio.h>
-#include <stdint.h>
-#include <sys/types.h>
 
 #include "device-nodes.h"
 #include "utf8.h"
diff --git a/src/shared/efivars.c b/src/shared/efivars.c
index a319574..b8c8556 100644
--- a/src/shared/efivars.c
+++ b/src/shared/efivars.c
@@ -22,9 +22,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <fcntl.h>
-#include <ctype.h>
 
-#include "acpi-fpdt.h"
 #include "util.h"
 #include "utf8.h"
 #include "efivars.h"
diff --git a/src/shared/efivars.h b/src/shared/efivars.h
index 7921bed..3a2ddc6 100644
--- a/src/shared/efivars.h
+++ b/src/shared/efivars.h
@@ -21,8 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
-#include <inttypes.h>
 #include <stdbool.h>
 
 #include "sd-id128.h"
diff --git a/src/shared/env-util.c b/src/shared/env-util.c
index 038246d..00c2cdd 100644
--- a/src/shared/env-util.c
+++ b/src/shared/env-util.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <limits.h>
-#include <sys/param.h>
 #include <unistd.h>
 
 #include "strv.h"
diff --git a/src/shared/env-util.h b/src/shared/env-util.h
index 618441a..9de3621 100644
--- a/src/shared/env-util.h
+++ b/src/shared/env-util.h
@@ -22,7 +22,6 @@
 ***/
 
 #include <stdbool.h>
-#include <sys/types.h>
 
 #include "macro.h"
 
diff --git a/src/shared/errno-list.c b/src/shared/errno-list.c
index c63296f..34d1331 100644
--- a/src/shared/errno-list.c
+++ b/src/shared/errno-list.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <errno.h>
 #include <string.h>
 
 #include "util.h"
diff --git a/src/shared/exit-status.c b/src/shared/exit-status.c
index 5c73b4d..57022c5 100644
--- a/src/shared/exit-status.c
+++ b/src/shared/exit-status.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <stdlib.h>
-#include <sys/wait.h>
 
 #include "exit-status.h"
 #include "set.h"
diff --git a/src/shared/fdset.c b/src/shared/fdset.c
index 9e35ce5..3184927 100644
--- a/src/shared/fdset.c
+++ b/src/shared/fdset.c
@@ -22,7 +22,6 @@
 #include <errno.h>
 #include <dirent.h>
 #include <fcntl.h>
-#include <unistd.h>
 
 #include "set.h"
 #include "util.h"
diff --git a/src/shared/fdset.h b/src/shared/fdset.h
index c3c5e52..340438d 100644
--- a/src/shared/fdset.h
+++ b/src/shared/fdset.h
@@ -22,7 +22,6 @@
 ***/
 
 #include "set.h"
-#include "util.h"
 
 typedef struct FDSet FDSet;
 
diff --git a/src/shared/fileio-label.c b/src/shared/fileio-label.c
index 5fd69e0..bec988c 100644
--- a/src/shared/fileio-label.c
+++ b/src/shared/fileio-label.c
@@ -19,13 +19,9 @@
   You should have received a copy of the GNU Lesser General Public License
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
 
 #include "util.h"
 #include "selinux-util.h"
-#include "label.h"
 #include "fileio-label.h"
 
 int write_string_file_atomic_label(const char *fn, const char *line) {
diff --git a/src/shared/generator.c b/src/shared/generator.c
index 7f16d5c..569b25b 100644
--- a/src/shared/generator.c
+++ b/src/shared/generator.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <string.h>
 #include <unistd.h>
 
 #include "util.h"
diff --git a/src/shared/hashmap.c b/src/shared/hashmap.c
index e63ba4b..48d7502 100644
--- a/src/shared/hashmap.c
+++ b/src/shared/hashmap.c
@@ -20,9 +20,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <stdlib.h>
-#include <string.h>
 #include <errno.h>
 
 #include "util.h"
@@ -31,9 +29,12 @@
 #include "macro.h"
 #include "siphash24.h"
 #include "strv.h"
-#include "list.h"
 #include "mempool.h"
 
+#ifdef ENABLE_DEBUG_HASHMAP
+#include "list.h"
+#endif
+
 /*
  * Implementation of hashmaps.
  * Addressing: open
diff --git a/src/shared/install-printf.c b/src/shared/install-printf.c
index d853f17..f62a032 100644
--- a/src/shared/install-printf.c
+++ b/src/shared/install-printf.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <stdlib.h>
 
 #include "specifier.h"
diff --git a/src/shared/install.c b/src/shared/install.c
index 65f1c24..95ba718 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -36,7 +36,6 @@
 #include "install.h"
 #include "conf-parser.h"
 #include "conf-files.h"
-#include "specifier.h"
 #include "install-printf.h"
 #include "special.h"
 
diff --git a/src/shared/json.c b/src/shared/json.c
index bb3d26f..45c8ece 100644
--- a/src/shared/json.c
+++ b/src/shared/json.c
@@ -23,7 +23,6 @@
 #include <math.h>
 
 #include "macro.h"
-#include "log.h"
 #include "util.h"
 #include "utf8.h"
 #include "json.h"
diff --git a/src/shared/json.h b/src/shared/json.h
index a845713..55976d5 100644
--- a/src/shared/json.h
+++ b/src/shared/json.h
@@ -22,7 +22,6 @@
 ***/
 
 #include <stdbool.h>
-#include <inttypes.h>
 
 enum {
         JSON_END,
diff --git a/src/shared/log.h b/src/shared/log.h
index 2889e1e..b994663 100644
--- a/src/shared/log.h
+++ b/src/shared/log.h
@@ -25,8 +25,6 @@
 #include <stdarg.h>
 #include <syslog.h>
 #include <sys/signalfd.h>
-#include <sys/types.h>
-#include <unistd.h>
 #include <errno.h>
 
 #include "macro.h"
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index c249505..944d685 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -20,9 +20,7 @@
 ***/
 
 #include <time.h>
-#include <assert.h>
 #include <errno.h>
-#include <poll.h>
 #include <sys/socket.h>
 #include <string.h>
 #include <fcntl.h>
@@ -32,7 +30,6 @@
 #include "util.h"
 #include "utf8.h"
 #include "hashmap.h"
-#include "fileio.h"
 #include "journal-internal.h"
 
 /* up to three lines (each up to 100 characters),
diff --git a/src/shared/logs-show.h b/src/shared/logs-show.h
index 8d9641e..569e1fa 100644
--- a/src/shared/logs-show.h
+++ b/src/shared/logs-show.h
@@ -22,7 +22,6 @@
 ***/
 
 #include <stdbool.h>
-#include <unistd.h>
 #include <sys/types.h>
 
 #include "sd-journal.h"
diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c
index 8d61507..c734f14 100644
--- a/src/shared/machine-image.c
+++ b/src/shared/machine-image.c
@@ -23,7 +23,6 @@
 #include <linux/fs.h>
 #include <fcntl.h>
 
-#include "strv.h"
 #include "utf8.h"
 #include "btrfs-util.h"
 #include "path-util.h"
diff --git a/src/shared/memfd-util.c b/src/shared/memfd-util.c
index 6624c5e..e99a738 100644
--- a/src/shared/memfd-util.c
+++ b/src/shared/memfd-util.c
@@ -21,7 +21,6 @@
 
 #include <stdio.h>
 #include <fcntl.h>
-#include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <sys/prctl.h>
 
@@ -30,7 +29,6 @@
 #endif
 
 #include "util.h"
-#include "bus-label.h"
 #include "memfd-util.h"
 #include "utf8.h"
 #include "missing.h"
diff --git a/src/shared/memfd-util.h b/src/shared/memfd-util.h
index cf588fe..3ed551f 100644
--- a/src/shared/memfd-util.h
+++ b/src/shared/memfd-util.h
@@ -21,12 +21,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
-#include <sys/types.h>
-#include <stdio.h>
 
-#include "macro.h"
-#include "util.h"
 
 int memfd_new(const char *name);
 int memfd_new_and_map(const char *name, size_t sz, void **p);
diff --git a/src/shared/mempool.h b/src/shared/mempool.h
index 42f473b..6378d2e 100644
--- a/src/shared/mempool.h
+++ b/src/shared/mempool.h
@@ -24,7 +24,7 @@
 
 #include <stddef.h>
 
-struct pool;
+//struct pool;
 
 struct mempool {
         struct pool *first_pool;
diff --git a/src/shared/mkdir-label.c b/src/shared/mkdir-label.c
index ee11ac0..76bbc1e 100644
--- a/src/shared/mkdir-label.c
+++ b/src/shared/mkdir-label.c
@@ -20,16 +20,10 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
-#include <string.h>
 #include <unistd.h>
-#include <errno.h>
-#include <stdlib.h>
 #include <stdio.h>
 
 #include "label.h"
-#include "util.h"
-#include "path-util.h"
 #include "mkdir.h"
 
 int mkdir_safe_label(const char *path, mode_t mode, uid_t uid, gid_t gid) {
diff --git a/src/shared/mkdir.c b/src/shared/mkdir.c
index beefd10..b280618 100644
--- a/src/shared/mkdir.c
+++ b/src/shared/mkdir.c
@@ -19,14 +19,9 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <string.h>
-#include <unistd.h>
 #include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
 
-#include "label.h"
 #include "util.h"
 #include "path-util.h"
 #include "mkdir.h"
diff --git a/src/shared/mkdir.h b/src/shared/mkdir.h
index e317df3..2392d1f 100644
--- a/src/shared/mkdir.h
+++ b/src/shared/mkdir.h
@@ -22,7 +22,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdbool.h>
 #include <sys/types.h>
 
 int mkdir_safe(const char *path, mode_t mode, uid_t uid, gid_t gid);
diff --git a/src/shared/pager.c b/src/shared/pager.c
index 8635d9a..f12bfb3 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index 291a2f4..fbf46cd 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -19,15 +19,12 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
 #include <errno.h>
 
 #include "util.h"
-#include "mkdir.h"
 #include "strv.h"
 #include "path-util.h"
 #include "path-lookup.h"
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index b9db7f1..ff415d3 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -19,15 +19,12 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
 #include <stdlib.h>
-#include <signal.h>
 #include <stdio.h>
 #include <fcntl.h>
-#include <dirent.h>
 #include <sys/statvfs.h>
 
 #include "macro.h"
diff --git a/src/shared/pty.c b/src/shared/pty.c
index fbe6295..0f80f48 100644
--- a/src/shared/pty.c
+++ b/src/shared/pty.c
@@ -44,18 +44,12 @@
 
 #include <errno.h>
 #include <fcntl.h>
-#include <limits.h>
-#include <linux/ioctl.h>
 #include <signal.h>
 #include <stdbool.h>
 #include <stdint.h>
-#include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 #include <sys/epoll.h>
-#include <sys/eventfd.h>
 #include <sys/ioctl.h>
-#include <sys/types.h>
 #include <sys/uio.h>
 #include <sys/wait.h>
 #include <termios.h>
diff --git a/src/shared/pty.h b/src/shared/pty.h
index a87ceb5..63c7db2 100644
--- a/src/shared/pty.h
+++ b/src/shared/pty.h
@@ -21,17 +21,12 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <errno.h>
 #include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
 #include <unistd.h>
 
 #include "barrier.h"
 #include "macro.h"
 #include "sd-event.h"
-#include "util.h"
 
 typedef struct Pty Pty;
 
diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c
index 31274a1..05ca978 100644
--- a/src/shared/ptyfwd.c
+++ b/src/shared/ptyfwd.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <sys/epoll.h>
-#include <sys/signalfd.h>
 #include <sys/ioctl.h>
 #include <limits.h>
 #include <termios.h>
diff --git a/src/shared/ptyfwd.h b/src/shared/ptyfwd.h
index d3e229b..cfba893 100644
--- a/src/shared/ptyfwd.h
+++ b/src/shared/ptyfwd.h
@@ -21,11 +21,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
-#include <signal.h>
 #include <stdbool.h>
 
-#include "util.h"
 #include "sd-event.h"
 
 typedef struct PTYForward PTYForward;
diff --git a/src/shared/ratelimit.c b/src/shared/ratelimit.c
index 01b62b7..81fc9c1 100644
--- a/src/shared/ratelimit.c
+++ b/src/shared/ratelimit.c
@@ -19,10 +19,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 
 #include "ratelimit.h"
-#include "log.h"
 
 /* Modelled after Linux' lib/ratelimit.c by Dave Young
  * <hidave.darkstar at gmail.com>, which is licensed GPLv2. */
diff --git a/src/shared/ring.c b/src/shared/ring.c
index 309075e..6814918 100644
--- a/src/shared/ring.c
+++ b/src/shared/ring.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <errno.h>
-#include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/uio.h>
diff --git a/src/shared/ring.h b/src/shared/ring.h
index 1210aab..a7c44d1 100644
--- a/src/shared/ring.h
+++ b/src/shared/ring.h
@@ -21,11 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <errno.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/uio.h>
 
 typedef struct Ring Ring;
 
diff --git a/src/shared/selinux-util.c b/src/shared/selinux-util.c
index a2233e0..82c6924 100644
--- a/src/shared/selinux-util.c
+++ b/src/shared/selinux-util.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <errno.h>
-#include <unistd.h>
 #include <malloc.h>
 #include <sys/un.h>
 
diff --git a/src/shared/selinux-util.h b/src/shared/selinux-util.h
index a694441..8467185 100644
--- a/src/shared/selinux-util.h
+++ b/src/shared/selinux-util.h
@@ -22,7 +22,6 @@
 ***/
 
 #include <sys/socket.h>
-#include <stdio.h>
 #include <stdbool.h>
 
 bool mac_selinux_use(void);
diff --git a/src/shared/socket-label.c b/src/shared/socket-label.c
index 6806c51..dfb8a1a 100644
--- a/src/shared/socket-label.c
+++ b/src/shared/socket-label.c
@@ -19,24 +19,16 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <net/if.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <stddef.h>
-#include <sys/ioctl.h>
 
 #include "macro.h"
 #include "util.h"
 #include "mkdir.h"
 #include "missing.h"
-#include "label.h"
 #include "selinux-util.h"
 #include "socket-util.h"
 
diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c
index c6f6487..f4a2864 100644
--- a/src/shared/socket-util.c
+++ b/src/shared/socket-util.c
@@ -19,24 +19,18 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
-#include <stdlib.h>
 #include <arpa/inet.h>
 #include <stdio.h>
 #include <net/if.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <stddef.h>
-#include <sys/ioctl.h>
 #include <netdb.h>
 
 #include "macro.h"
 #include "util.h"
-#include "mkdir.h"
-#include "path-util.h"
 #include "socket-util.h"
 #include "missing.h"
 #include "fileio.h"
diff --git a/src/shared/socket-util.h b/src/shared/socket-util.h
index 07d0aff..2d2b902 100644
--- a/src/shared/socket-util.h
+++ b/src/shared/socket-util.h
@@ -25,7 +25,6 @@
 #include <netinet/in.h>
 #include <netinet/ether.h>
 #include <sys/un.h>
-#include <asm/types.h>
 #include <linux/netlink.h>
 #include <linux/if_packet.h>
 
diff --git a/src/shared/spawn-ask-password-agent.c b/src/shared/spawn-ask-password-agent.c
index ee26783..0d74588 100644
--- a/src/shared/spawn-ask-password-agent.c
+++ b/src/shared/spawn-ask-password-agent.c
@@ -19,13 +19,9 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <string.h>
-#include <sys/prctl.h>
 #include <signal.h>
-#include <fcntl.h>
 
 #include "log.h"
 #include "util.h"
diff --git a/src/shared/spawn-polkit-agent.c b/src/shared/spawn-polkit-agent.c
index 8f259a8..bc1810d 100644
--- a/src/shared/spawn-polkit-agent.c
+++ b/src/shared/spawn-polkit-agent.c
@@ -19,13 +19,9 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <string.h>
-#include <sys/prctl.h>
 #include <signal.h>
-#include <fcntl.h>
 #include <errno.h>
 #include <poll.h>
 
diff --git a/src/shared/strbuf.h b/src/shared/strbuf.h
index 2347fd4..fbc4e5f 100644
--- a/src/shared/strbuf.h
+++ b/src/shared/strbuf.h
@@ -21,9 +21,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdarg.h>
 #include <stdint.h>
-#include <stdbool.h>
 
 struct strbuf {
         char *buf;
diff --git a/src/shared/strv.c b/src/shared/strv.c
index e418312..ab661c6 100644
--- a/src/shared/strv.c
+++ b/src/shared/strv.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
diff --git a/src/shared/strxcpyx.h b/src/shared/strxcpyx.h
index 7be246d..ccc7e52 100644
--- a/src/shared/strxcpyx.h
+++ b/src/shared/strxcpyx.h
@@ -21,8 +21,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdarg.h>
-#include <stdbool.h>
 
 #include "macro.h"
 
diff --git a/src/shared/time-dst.c b/src/shared/time-dst.c
index 1ce6f72..2797d1a 100644
--- a/src/shared/time-dst.c
+++ b/src/shared/time-dst.c
@@ -21,18 +21,12 @@
   You should have received a copy of the GNU Lesser General Public License
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
-#include <ctype.h>
 #include <errno.h>
 #include <stddef.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <endian.h>
-#include <byteswap.h>
-#include <assert.h>
-#include <limits.h>
-#include <unistd.h>
 #include <stdint.h>
 #include <stdbool.h>
 #include <sys/stat.h>
diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c
index 21b6691..0cc06f4 100644
--- a/src/shared/unit-name.c
+++ b/src/shared/unit-name.c
@@ -21,7 +21,6 @@
 
 #include <errno.h>
 #include <string.h>
-#include <assert.h>
 
 #include "path-util.h"
 #include "bus-label.h"
diff --git a/src/shared/util.c b/src/shared/util.c
index ba035ca..cde91f1 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
@@ -46,7 +45,6 @@
 #include <pwd.h>
 #include <netinet/ip.h>
 #include <linux/kd.h>
-#include <dlfcn.h>
 #include <sys/wait.h>
 #include <sys/time.h>
 #include <glob.h>
@@ -80,7 +78,6 @@
 #include "missing.h"
 #include "log.h"
 #include "strv.h"
-#include "label.h"
 #include "mkdir.h"
 #include "path-util.h"
 #include "exit-status.h"
diff --git a/src/shared/util.h b/src/shared/util.h
index a83b588..a794f30 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -25,7 +25,6 @@
 #include <fcntl.h>
 #include <inttypes.h>
 #include <time.h>
-#include <sys/time.h>
 #include <stdarg.h>
 #include <stdbool.h>
 #include <stdlib.h>
@@ -36,12 +35,10 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <dirent.h>
-#include <sys/resource.h>
 #include <stddef.h>
 #include <unistd.h>
 #include <locale.h>
 #include <mntent.h>
-#include <sys/socket.h>
 #include <sys/inotify.h>
 
 #if SIZEOF_PID_T == 4
diff --git a/src/shared/utmp-wtmp.c b/src/shared/utmp-wtmp.c
index bdb962a..7fb6fe3 100644
--- a/src/shared/utmp-wtmp.c
+++ b/src/shared/utmp-wtmp.c
@@ -21,7 +21,6 @@
 
 #include <utmpx.h>
 #include <errno.h>
-#include <assert.h>
 #include <string.h>
 #include <sys/utsname.h>
 #include <fcntl.h>
diff --git a/src/shutdownd/shutdownd.c b/src/shutdownd/shutdownd.c
index 701882b..09719a4 100644
--- a/src/shutdownd/shutdownd.c
+++ b/src/shutdownd/shutdownd.c
@@ -21,13 +21,9 @@
 
 #include <sys/socket.h>
 #include <poll.h>
-#include <sys/types.h>
 #include <sys/timerfd.h>
-#include <assert.h>
-#include <string.h>
 #include <errno.h>
 #include <unistd.h>
-#include <fcntl.h>
 #include <stddef.h>
 
 #include "systemd/sd-daemon.h"
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
index cc1ffa6..eee6bc8 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
@@ -22,10 +22,8 @@
 
 #include <stdio.h>
 #include <errno.h>
-#include <string.h>
 #include <getopt.h>
 
-#include "sd-id128.h"
 #include "sd-messages.h"
 #include "log.h"
 #include "util.h"
diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
index a3c3c87..715f440 100644
--- a/src/socket-proxy/socket-proxyd.c
+++ b/src/socket-proxy/socket-proxyd.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
  ***/
 
-#include <arpa/inet.h>
 #include <errno.h>
 #include <getopt.h>
 #include <stdio.h>
@@ -37,7 +36,6 @@
 #include "log.h"
 #include "socket-util.h"
 #include "util.h"
-#include "event-util.h"
 #include "build.h"
 #include "set.h"
 #include "path-util.h"
diff --git a/src/system-update-generator/system-update-generator.c b/src/system-update-generator/system-update-generator.c
index ad34ef1..0004515 100644
--- a/src/system-update-generator/system-update-generator.c
+++ b/src/system-update-generator/system-update-generator.c
@@ -24,8 +24,6 @@
 
 #include "log.h"
 #include "util.h"
-#include "unit-name.h"
-#include "path-util.h"
 
 /*
  * Implements the logic described in
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index d1b7f8a..5b119ce 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -22,21 +22,16 @@
 
 #include <sys/reboot.h>
 #include <linux/reboot.h>
-#include <sys/syscall.h>
 #include <stdio.h>
 #include <getopt.h>
 #include <locale.h>
 #include <stdbool.h>
 #include <string.h>
 #include <errno.h>
-#include <sys/ioctl.h>
-#include <termios.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/socket.h>
-#include <sys/stat.h>
 #include <stddef.h>
-#include <sys/prctl.h>
 #include <fnmatch.h>
 
 #include "sd-daemon.h"
@@ -56,7 +51,6 @@
 #include "cgroup-util.h"
 #include "list.h"
 #include "path-lookup.h"
-#include "conf-parser.h"
 #include "exit-status.h"
 #include "build.h"
 #include "unit-name.h"
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index e47bcb4..0b5668a 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
 #include <pwd.h>
 #include <grp.h>
 #include <shadow.h>
@@ -36,7 +35,6 @@
 #include "conf-files.h"
 #include "copy.h"
 #include "utf8.h"
-#include "label.h"
 #include "fileio-label.h"
 #include "uid-range.h"
 #include "selinux-util.h"
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 6e39b44..d9daa1b 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -34,10 +34,6 @@
 #include "unit.h"
 #include "unit-name.h"
 #include "special.h"
-#include "exit-status.h"
-#include "def.h"
-#include "env-util.h"
-#include "fileio.h"
 #include "hashmap.h"
 
 typedef enum RunlevelType {
diff --git a/src/test/test-barrier.c b/src/test/test-barrier.c
index cb75f73..2d109a3 100644
--- a/src/test/test-barrier.c
+++ b/src/test/test-barrier.c
@@ -28,15 +28,12 @@
  * increase it at the slightly cost of lengthen test-duration on other machines.
  */
 
-#include <errno.h>
 #include <stdio.h>
-#include <string.h>
 #include <sys/time.h>
 #include <sys/wait.h>
 #include <unistd.h>
 
 #include "barrier.h"
-#include "def.h"
 #include "util.h"
 
 /* 20ms to test deadlocks; All timings use multiples of this constant as
diff --git a/src/test/test-btrfs.c b/src/test/test-btrfs.c
index 150a32a..c49b832 100644
--- a/src/test/test-btrfs.c
+++ b/src/test/test-btrfs.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdlib.h>
 #include <fcntl.h>
 
 #include "log.h"
diff --git a/src/test/test-cap-list.c b/src/test/test-cap-list.c
index 632d62f..43a2d35 100644
--- a/src/test/test-cap-list.c
+++ b/src/test/test-cap-list.c
@@ -20,7 +20,6 @@
 ***/
 
 #include "util.h"
-#include "log.h"
 #include "fileio.h"
 #include "cap-list.h"
 #include "capability.h"
diff --git a/src/test/test-capability.c b/src/test/test-capability.c
index 4376992..f47452c 100644
--- a/src/test/test-capability.c
+++ b/src/test/test-capability.c
@@ -17,7 +17,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/capability.h>
 #include <sys/socket.h>
diff --git a/src/test/test-cgroup-mask.c b/src/test/test-cgroup-mask.c
index 9e9de23..d14a07e 100644
--- a/src/test/test-cgroup-mask.c
+++ b/src/test/test-cgroup-mask.c
@@ -20,14 +20,9 @@
 ***/
 
 #include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <pwd.h>
 
 #include "manager.h"
 #include "unit.h"
-#include "util.h"
 #include "macro.h"
 #include "test-helper.h"
 
diff --git a/src/test/test-cgroup-util.c b/src/test/test-cgroup-util.c
index 67eeeb5..9834a6a 100644
--- a/src/test/test-cgroup-util.c
+++ b/src/test/test-cgroup-util.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 
 #include "util.h"
 #include "cgroup-util.h"
diff --git a/src/test/test-cgroup.c b/src/test/test-cgroup.c
index 46642f9..4be69a4 100644
--- a/src/test/test-cgroup.c
+++ b/src/test/test-cgroup.c
@@ -25,7 +25,6 @@
 #include "cgroup-util.h"
 #include "path-util.h"
 #include "util.h"
-#include "log.h"
 
 int main(int argc, char*argv[]) {
         char *path;
diff --git a/src/test/test-ellipsize.c b/src/test/test-ellipsize.c
index f97c78e..6a2f9aa 100644
--- a/src/test/test-ellipsize.c
+++ b/src/test/test-ellipsize.c
@@ -22,7 +22,6 @@
 #include <stdio.h>
 
 #include "util.h"
-#include "utf8.h"
 #include "def.h"
 
 static void test_one(const char *p) {
diff --git a/src/test/test-engine.c b/src/test/test-engine.c
index 456999c..c8d0a14 100644
--- a/src/test/test-engine.c
+++ b/src/test/test-engine.c
@@ -22,7 +22,6 @@
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
-#include <unistd.h>
 
 #include "manager.h"
 #include "bus-util.h"
diff --git a/src/test/test-env-replace.c b/src/test/test-env-replace.c
index 0274e97..8f1fcd9 100644
--- a/src/test/test-env-replace.c
+++ b/src/test/test-env-replace.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <unistd.h>
 #include <string.h>
 
 #include "util.h"
diff --git a/src/test/test-execute.c b/src/test/test-execute.c
index 91ccaf7..428fd32 100644
--- a/src/test/test-execute.c
+++ b/src/test/test-execute.c
@@ -23,7 +23,6 @@
 #include "manager.h"
 #include "util.h"
 #include "macro.h"
-#include "strv.h"
 #include "mkdir.h"
 
 typedef void (*test_function_t)(Manager *m);
diff --git a/src/test/test-hashmap.c b/src/test/test-hashmap.c
index 6900da9..40be084 100644
--- a/src/test/test-hashmap.c
+++ b/src/test/test-hashmap.c
@@ -17,8 +17,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <inttypes.h>
-#include "strv.h"
 #include "util.h"
 #include "hashmap.h"
 
diff --git a/src/test/test-hostname.c b/src/test/test-hostname.c
index 86efa1a..c7e5de8 100644
--- a/src/test/test-hostname.c
+++ b/src/test/test-hostname.c
@@ -19,10 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <fcntl.h>
 
 #include "hostname-setup.h"
 #include "util.h"
diff --git a/src/test/test-install.c b/src/test/test-install.c
index 467970b..5ee52e6 100644
--- a/src/test/test-install.c
+++ b/src/test/test-install.c
@@ -19,13 +19,9 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <errno.h>
 #include <string.h>
 #include <stdio.h>
-#include <fcntl.h>
 
-#include "util.h"
-#include "path-util.h"
 #include "install.h"
 
 static void dump_changes(UnitFileChange *c, unsigned n) {
diff --git a/src/test/test-job-type.c b/src/test/test-job-type.c
index 1d9d49b..af0d76e 100644
--- a/src/test/test-job-type.c
+++ b/src/test/test-job-type.c
@@ -20,9 +20,6 @@
 ***/
 
 #include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
 
 #include "job.h"
 #include "unit.h"
diff --git a/src/test/test-json.c b/src/test/test-json.c
index b091318..24dc700 100644
--- a/src/test/test-json.c
+++ b/src/test/test-json.c
@@ -21,7 +21,6 @@
 
 #include <math.h>
 
-#include "log.h"
 #include "util.h"
 #include "json.h"
 
diff --git a/src/test/test-libudev.c b/src/test/test-libudev.c
index 293c151..2b004fd 100644
--- a/src/test/test-libudev.c
+++ b/src/test/test-libudev.c
@@ -19,13 +19,8 @@
 ***/
 
 #include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
 #include <unistd.h>
-#include <errno.h>
-#include <string.h>
 #include <getopt.h>
-#include <fcntl.h>
 #include <sys/epoll.h>
 
 #include "libudev.h"
diff --git a/src/test/test-locale-util.c b/src/test/test-locale-util.c
index 1398a3a..9765075 100644
--- a/src/test/test-locale-util.c
+++ b/src/test/test-locale-util.c
@@ -17,7 +17,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <unistd.h>
 
 #include "locale-util.h"
 #include "strv.h"
diff --git a/src/test/test-loopback.c b/src/test/test-loopback.c
index 75fe053..c03bda4 100644
--- a/src/test/test-loopback.c
+++ b/src/test/test-loopback.c
@@ -19,14 +19,11 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <errno.h>
 #include <string.h>
 #include <stdio.h>
-#include <fcntl.h>
 
 #include "loopback-setup.h"
 #include "log.h"
-#include "util.h"
 
 int main(int argc, char* argv[]) {
         int r;
diff --git a/src/test/test-ns.c b/src/test/test-ns.c
index 7cd7b77..76b131c 100644
--- a/src/test/test-ns.c
+++ b/src/test/test-ns.c
@@ -20,13 +20,9 @@
 ***/
 
 #include <stdlib.h>
-#include <string.h>
 #include <unistd.h>
-#include <sys/mount.h>
-#include <linux/fs.h>
 
 #include "namespace.h"
-#include "execute.h"
 #include "log.h"
 
 int main(int argc, char *argv[]) {
diff --git a/src/test/test-path-lookup.c b/src/test/test-path-lookup.c
index 38e5c93..a951b01 100644
--- a/src/test/test-path-lookup.c
+++ b/src/test/test-path-lookup.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <sys/stat.h>
-#include <sys/types.h>
 
 #include "path-lookup.h"
 #include "log.h"
diff --git a/src/test/test-pty.c b/src/test/test-pty.c
index cab569a..eadecb9 100644
--- a/src/test/test-pty.c
+++ b/src/test/test-pty.c
@@ -20,13 +20,11 @@
 ***/
 
 #include <errno.h>
-#include <fcntl.h>
 #include <locale.h>
 #include <string.h>
 #include <sys/wait.h>
 #include <unistd.h>
 
-#include "def.h"
 #include "pty.h"
 #include "util.h"
 
diff --git a/src/test/test-ring.c b/src/test/test-ring.c
index a9dd01c..cb8a5d4 100644
--- a/src/test/test-ring.c
+++ b/src/test/test-ring.c
@@ -20,14 +20,9 @@
 ***/
 
 #include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <locale.h>
-#include <errno.h>
 
 #include "def.h"
 #include "ring.h"
-#include "util.h"
 
 static void test_ring(void) {
         static const char buf[8192];
diff --git a/src/test/test-rtnl-manual.c b/src/test/test-rtnl-manual.c
index c8133db..c406454 100644
--- a/src/test/test-rtnl-manual.c
+++ b/src/test/test-rtnl-manual.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <netinet/ether.h>
 #include <arpa/inet.h>
 #include <net/if.h>
 #include <linux/ip.h>
@@ -29,10 +28,6 @@
 #include "util.h"
 #include "macro.h"
 #include "sd-rtnl.h"
-#include "socket-util.h"
-#include "rtnl-util.h"
-#include "event-util.h"
-#include "rtnl-internal.h"
 
 static int load_module(const char *mod_name) {
         struct kmod_ctx *ctx;
diff --git a/src/test/test-set.c b/src/test/test-set.c
index e280c89..ac292ed 100644
--- a/src/test/test-set.c
+++ b/src/test/test-set.c
@@ -17,7 +17,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "util.h"
 #include "set.h"
 
 static void test_set_steal_first(void) {
diff --git a/src/test/test-sleep.c b/src/test/test-sleep.c
index a1020ad..1d75d05 100644
--- a/src/test/test-sleep.c
+++ b/src/test/test-sleep.c
@@ -19,10 +19,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <errno.h>
-#include <string.h>
 #include <stdio.h>
-#include <fcntl.h>
 
 #include "util.h"
 #include "log.h"
diff --git a/src/test/test-strxcpyx.c b/src/test/test-strxcpyx.c
index a7c8e12..858a408 100644
--- a/src/test/test-strxcpyx.c
+++ b/src/test/test-strxcpyx.c
@@ -22,7 +22,6 @@
 #include <string.h>
 
 #include "util.h"
-#include "strv.h"
 #include "strxcpyx.h"
 
 static void test_strpcpy(void) {
diff --git a/src/test/test-tables.c b/src/test/test-tables.c
index bda224b..0e5ab16 100644
--- a/src/test/test-tables.c
+++ b/src/test/test-tables.c
@@ -23,14 +23,12 @@
 #include "condition.h"
 #include "device.h"
 #include "execute.h"
-#include "exit-status.h"
 #include "install.h"
 #include "job.h"
 #include "kill.h"
 #include "log.h"
 #include "logs-show.h"
 #include "mount.h"
-#include "path-lookup.h"
 #include "path.h"
 #include "scope.h"
 #include "service.h"
diff --git a/src/test/test-tmpfiles.c b/src/test/test-tmpfiles.c
index 4b72c4a..90e49d4 100644
--- a/src/test/test-tmpfiles.c
+++ b/src/test/test-tmpfiles.c
@@ -19,8 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <stdlib.h>
diff --git a/src/test/test-udev.c b/src/test/test-udev.c
index b57d275..4403624 100644
--- a/src/test/test-udev.c
+++ b/src/test/test-udev.c
@@ -19,14 +19,9 @@
 ***/
 
 #include <stdio.h>
-#include <stddef.h>
 #include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <ctype.h>
 #include <errno.h>
 #include <unistd.h>
-#include <grp.h>
 #include <sched.h>
 #include <sys/mount.h>
 #include <sys/signalfd.h>
diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
index e517f57..22ac76d 100644
--- a/src/test/test-unit-file.c
+++ b/src/test/test-unit-file.c
@@ -20,7 +20,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <stdio.h>
 #include <stddef.h>
 #include <string.h>
diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c
index 5c7f8b4..7d882ae 100644
--- a/src/test/test-unit-name.c
+++ b/src/test/test-unit-name.c
@@ -24,14 +24,12 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/types.h>
 #include <pwd.h>
 
 #include "manager.h"
 #include "unit.h"
 #include "unit-name.h"
 #include "unit-printf.h"
-#include "install.h"
 #include "specifier.h"
 #include "util.h"
 #include "macro.h"
diff --git a/src/test/test-watchdog.c b/src/test/test-watchdog.c
index f6bb045..2e5d0c3 100644
--- a/src/test/test-watchdog.c
+++ b/src/test/test-watchdog.c
@@ -20,7 +20,6 @@
 ***/
 
 #include <unistd.h>
-#include <string.h>
 
 #include "watchdog.h"
 #include "log.h"
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index 4d89886..9e04f8f 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -22,11 +22,8 @@
 
 #include <stdlib.h>
 #include <stdbool.h>
-#include <unistd.h>
 #include <getopt.h>
 #include <locale.h>
-#include <string.h>
-#include <sys/timex.h>
 
 #include "sd-bus.h"
 #include "bus-util.h"
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 753c3d1..3c0ea7f 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -23,7 +23,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "sd-id128.h"
 #include "sd-messages.h"
 #include "sd-event.h"
 #include "sd-bus.h"
@@ -32,10 +31,8 @@
 #include "strv.h"
 #include "def.h"
 #include "clock-util.h"
-#include "conf-files.h"
 #include "path-util.h"
 #include "fileio-label.h"
-#include "label.h"
 #include "bus-util.h"
 #include "bus-error.h"
 #include "bus-common-errors.h"
diff --git a/src/timesync/timesyncd-conf.c b/src/timesync/timesyncd-conf.c
index be1f4bb..df4d89a 100644
--- a/src/timesync/timesyncd-conf.c
+++ b/src/timesync/timesyncd-conf.c
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "in-addr-util.h"
 
 #include "timesyncd-manager.h"
 #include "timesyncd-server.h"
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
index 223671c..e08fc8d 100644
--- a/src/timesync/timesyncd-manager.c
+++ b/src/timesync/timesyncd-manager.c
@@ -21,21 +21,15 @@
 
 #include <stdlib.h>
 #include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
 #include <time.h>
 #include <math.h>
-#include <arpa/inet.h>
 #include <netinet/in.h>
 #include <netinet/ip.h>
 #include <sys/timerfd.h>
 #include <sys/timex.h>
 #include <sys/socket.h>
 #include <resolv.h>
-#include <sys/prctl.h>
 #include <sys/types.h>
-#include <grp.h>
 
 #include "missing.h"
 #include "util.h"
@@ -45,13 +39,8 @@
 #include "list.h"
 #include "ratelimit.h"
 #include "strv.h"
-#include "conf-parser.h"
 #include "sd-daemon.h"
-#include "event-util.h"
 #include "network-util.h"
-#include "clock-util.h"
-#include "capability.h"
-#include "mkdir.h"
 #include "timesyncd-conf.h"
 #include "timesyncd-manager.h"
 #include "time-util.h"
diff --git a/src/timesync/timesyncd-manager.h b/src/timesync/timesyncd-manager.h
index c7efdc5..b1a844b 100644
--- a/src/timesync/timesyncd-manager.h
+++ b/src/timesync/timesyncd-manager.h
@@ -25,7 +25,6 @@
 #include "sd-resolve.h"
 #include "sd-network.h"
 #include "list.h"
-#include "socket-util.h"
 #include "ratelimit.h"
 
 typedef struct Manager Manager;
diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c
index 2a73dac..735668b 100644
--- a/src/timesync/timesyncd.c
+++ b/src/timesync/timesyncd.c
@@ -21,7 +21,6 @@
 
 #include "sd-event.h"
 #include "sd-daemon.h"
-#include "mkdir.h"
 #include "capability.h"
 #include "clock-util.h"
 #include "network-util.h"
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index c948d4d..2cb4b09 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -26,8 +26,6 @@
 #include <string.h>
 #include <limits.h>
 #include <dirent.h>
-#include <grp.h>
-#include <pwd.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
@@ -37,8 +35,6 @@
 #include <glob.h>
 #include <fnmatch.h>
 #include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/param.h>
 #include <sys/xattr.h>
 
 #include "log.h"
diff --git a/src/udev/accelerometer/accelerometer.c b/src/udev/accelerometer/accelerometer.c
index 0f1b3c6..9e2c590 100644
--- a/src/udev/accelerometer/accelerometer.c
+++ b/src/udev/accelerometer/accelerometer.c
@@ -46,16 +46,10 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <stdbool.h>
 #include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <getopt.h>
 #include <limits.h>
-#include <linux/limits.h>
 #include <linux/input.h>
 
 #include "libudev.h"
diff --git a/src/udev/collect/collect.c b/src/udev/collect/collect.c
index 4bb6edb..6cf41c6 100644
--- a/src/udev/collect/collect.c
+++ b/src/udev/collect/collect.c
@@ -20,18 +20,10 @@
  */
 
 #include <stdio.h>
-#include <stdlib.h>
 #include <stddef.h>
-#include <unistd.h>
-#include <signal.h>
-#include <fcntl.h>
 #include <errno.h>
-#include <string.h>
 #include <getopt.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 
-#include "libudev.h"
 #include "libudev-private.h"
 #include "macro.h"
 
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index 8b3dc45..810a881 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -22,7 +22,6 @@
 #include <netinet/ether.h>
 #include <linux/netdevice.h>
 
-#include "sd-id128.h"
 
 #include "missing.h"
 #include "link-config.h"
@@ -36,11 +35,8 @@
 #include "path-util.h"
 #include "conf-parser.h"
 #include "conf-files.h"
-#include "fileio.h"
-#include "hashmap.h"
 #include "rtnl-util.h"
 #include "network-internal.h"
-#include "siphash24.h"
 
 struct link_config_ctx {
         LIST_HEAD(link_config, links);
diff --git a/src/udev/net/link-config.h b/src/udev/net/link-config.h
index cb434d1..34facde 100644
--- a/src/udev/net/link-config.h
+++ b/src/udev/net/link-config.h
@@ -23,7 +23,6 @@
 
 #include "ethtool-util.h"
 #include "condition.h"
-#include "util.h"
 #include "list.h"
 #include "libudev.h"
 
diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c
index 03e3dc2..f4f6900 100644
--- a/src/udev/udev-builtin-blkid.c
+++ b/src/udev/udev-builtin-blkid.c
@@ -20,8 +20,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
diff --git a/src/udev/udev-builtin-btrfs.c b/src/udev/udev-builtin-btrfs.c
index 3643596..3352821 100644
--- a/src/udev/udev-builtin-btrfs.c
+++ b/src/udev/udev-builtin-btrfs.c
@@ -17,12 +17,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <unistd.h>
 #include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
 #include <fcntl.h>
-#include <errno.h>
 #include <sys/ioctl.h>
 
 #ifdef HAVE_LINUX_BTRFS_H
diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c
index 9547664..5e0e7eb 100644
--- a/src/udev/udev-builtin-hwdb.c
+++ b/src/udev/udev-builtin-hwdb.c
@@ -18,10 +18,6 @@
 ***/
 
 #include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <inttypes.h>
-#include <ctype.h>
 #include <stdlib.h>
 #include <fnmatch.h>
 #include <getopt.h>
diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c
index d8ee4cb..8ab1be8 100644
--- a/src/udev/udev-builtin-keyboard.c
+++ b/src/udev/udev-builtin-keyboard.c
@@ -18,19 +18,15 @@
 ***/
 
 #include <stdio.h>
-#include <errno.h>
 #include <string.h>
 #include <stdlib.h>
-#include <fcntl.h>
 #include <sys/ioctl.h>
-#include <linux/limits.h>
 #include <linux/input.h>
 
 #include "udev.h"
 
 static const struct key *keyboard_lookup_key(const char *str, unsigned len);
 #include "keyboard-keys-from-name.h"
-#include "keyboard-keys-to-name.h"
 
 static int install_force_release(struct udev_device *dev, const unsigned *release, unsigned release_count) {
         struct udev_device *atkbd;
diff --git a/src/udev/udev-builtin-kmod.c b/src/udev/udev-builtin-kmod.c
index ad2829e..81e78a8 100644
--- a/src/udev/udev-builtin-kmod.c
+++ b/src/udev/udev-builtin-kmod.c
@@ -21,12 +21,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
-#include <unistd.h>
-#include <string.h>
 #include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
 #include <libkmod.h>
 
 #include "udev.h"
diff --git a/src/udev/udev-builtin-uaccess.c b/src/udev/udev-builtin-uaccess.c
index b78c09b..99bb91a 100644
--- a/src/udev/udev-builtin-uaccess.c
+++ b/src/udev/udev-builtin-uaccess.c
@@ -20,14 +20,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-#include <fcntl.h>
 #include <errno.h>
-#include <dirent.h>
-#include <getopt.h>
 
 #include "systemd/sd-login.h"
 #include "logind-acl.h"
diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c
index 1950ec2..d2aec1b 100644
--- a/src/udev/udev-builtin.c
+++ b/src/udev/udev-builtin.c
@@ -17,12 +17,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <unistd.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
 #include <string.h>
-#include <errno.h>
 #include <getopt.h>
 
 #include "udev.h"
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
index 7b5ef6b..3e943b9 100644
--- a/src/udev/udev-ctrl.c
+++ b/src/udev/udev-ctrl.c
@@ -10,12 +10,10 @@
  */
 
 #include <errno.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/types.h>
 #include <poll.h>
 #include <sys/socket.h>
 #include <sys/un.h>
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index bc115f1..1c5d5e9 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -23,7 +23,6 @@
 #include <errno.h>
 #include <ctype.h>
 #include <string.h>
-#include <time.h>
 #include <net/if.h>
 #include <sys/prctl.h>
 #include <poll.h>
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index 793b484..debf9ea 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -15,7 +15,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stddef.h>
@@ -23,11 +22,8 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
-#include <grp.h>
 #include <dirent.h>
-#include <sys/time.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 
 #include "udev.h"
 #include "smack-util.h"
diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c
index 6ba8674..15b76dd 100644
--- a/src/udev/udev-watch.c
+++ b/src/udev/udev-watch.c
@@ -17,14 +17,10 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <sys/types.h>
 #include <errno.h>
-#include <fcntl.h>
 #include <stdio.h>
 #include <dirent.h>
 #include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
 #include <unistd.h>
 #include <sys/inotify.h>
 
diff --git a/src/udev/udevadm-control.c b/src/udev/udevadm-control.c
index 6af7163..7817046 100644
--- a/src/udev/udevadm-control.c
+++ b/src/udev/udevadm-control.c
@@ -12,7 +12,6 @@
  * GNU General Public License for more details.
  */
 
-#include <time.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -20,10 +19,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <getopt.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/wait.h>
-#include <sys/un.h>
 
 #include "udev.h"
 #include "udev-util.h"
diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
index d65e40c..00609e3 100644
--- a/src/udev/udevadm-hwdb.c
+++ b/src/udev/udevadm-hwdb.c
@@ -18,7 +18,6 @@
 ***/
 
 #include <stdlib.h>
-#include <unistd.h>
 #include <getopt.h>
 #include <string.h>
 #include <ctype.h>
diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c
index 0bab01a..352e024 100644
--- a/src/udev/udevadm-info.c
+++ b/src/udev/udevadm-info.c
@@ -15,19 +15,16 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stddef.h>
 #include <ctype.h>
-#include <stdarg.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <errno.h>
 #include <getopt.h>
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 
 #include "udev.h"
 #include "udev-util.h"
diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c
index 15ded09..7ef2e68 100644
--- a/src/udev/udevadm-monitor.c
+++ b/src/udev/udevadm-monitor.c
@@ -15,22 +15,15 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <unistd.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <stddef.h>
 #include <string.h>
-#include <fcntl.h>
 #include <errno.h>
 #include <signal.h>
 #include <getopt.h>
 #include <time.h>
 #include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/un.h>
 #include <sys/epoll.h>
-#include <linux/types.h>
-#include <linux/netlink.h>
 
 #include "udev.h"
 #include "udev-util.h"
diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
index fff5de7..0d3025e 100644
--- a/src/udev/udevadm-settle.c
+++ b/src/udev/udevadm-settle.c
@@ -23,17 +23,10 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <errno.h>
-#include <dirent.h>
-#include <fcntl.h>
 #include <getopt.h>
-#include <signal.h>
-#include <time.h>
 #include <poll.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 
 #include "udev.h"
-#include "udev-util.h"
 #include "util.h"
 
 static void help(void) {
diff --git a/src/udev/udevadm-test-builtin.c b/src/udev/udevadm-test-builtin.c
index baaeca9..35a7349 100644
--- a/src/udev/udevadm-test-builtin.c
+++ b/src/udev/udevadm-test-builtin.c
@@ -17,19 +17,9 @@
 
 #include <stdlib.h>
 #include <stddef.h>
-#include <string.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
-#include <dirent.h>
-#include <fcntl.h>
 #include <getopt.h>
-#include <signal.h>
-#include <time.h>
-#include <sys/inotify.h>
-#include <poll.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 
 #include "udev.h"
 
diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c
index 4922b5b..542c56e 100644
--- a/src/udev/udevadm-test.c
+++ b/src/udev/udevadm-test.c
@@ -17,13 +17,10 @@
  */
 
 #include <stdlib.h>
-#include <string.h>
 #include <stdio.h>
 #include <stddef.h>
 #include <unistd.h>
 #include <errno.h>
-#include <ctype.h>
-#include <fcntl.h>
 #include <signal.h>
 #include <getopt.h>
 #include <sys/signalfd.h>
diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
index 4dc756a..11e83f3 100644
--- a/src/udev/udevadm-trigger.c
+++ b/src/udev/udevadm-trigger.c
@@ -15,20 +15,13 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdlib.h>
 #include <stddef.h>
 #include <string.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <getopt.h>
 #include <errno.h>
-#include <dirent.h>
 #include <fcntl.h>
-#include <fnmatch.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
 
 #include "udev.h"
 #include "udev-util.h"
diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c
index 56cd0cd..b86d892 100644
--- a/src/udev/udevadm.c
+++ b/src/udev/udevadm.c
@@ -16,11 +16,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <unistd.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <stddef.h>
-#include <string.h>
 #include <errno.h>
 #include <getopt.h>
 
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 99d4c89..0556356 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -26,25 +26,19 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <string.h>
-#include <ctype.h>
 #include <fcntl.h>
-#include <time.h>
 #include <getopt.h>
-#include <dirent.h>
 #include <sys/file.h>
 #include <sys/time.h>
 #include <sys/prctl.h>
 #include <sys/socket.h>
-#include <sys/un.h>
 #include <sys/signalfd.h>
 #include <sys/epoll.h>
 #include <sys/mount.h>
-#include <poll.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <sys/inotify.h>
-#include <sys/utsname.h>
 
 #include "sd-daemon.h"
 #include "rtnl-util.h"
diff --git a/src/update-done/update-done.c b/src/update-done/update-done.c
index 561963e..44caf84 100644
--- a/src/update-done/update-done.c
+++ b/src/update-done/update-done.c
@@ -20,7 +20,6 @@
 ***/
 
 #include "util.h"
-#include "label.h"
 #include "selinux-util.h"
 
 #define MESSAGE                                                         \
diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c
index 15da831..5a7250c 100644
--- a/src/update-utmp/update-utmp.c
+++ b/src/update-utmp/update-utmp.c
@@ -19,10 +19,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #ifdef HAVE_AUDIT
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index 2837171..bf681d9 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -23,21 +23,16 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <errno.h>
-#include <string.h>
 #include <fcntl.h>
-#include <ctype.h>
 #include <stdbool.h>
-#include <stdarg.h>
 #include <limits.h>
 #include <sys/ioctl.h>
-#include <sys/wait.h>
 #include <linux/tiocl.h>
 #include <linux/kd.h>
 #include <linux/vt.h>
 
 #include "util.h"
 #include "log.h"
-#include "macro.h"
 #include "virt.h"
 #include "fileio.h"
 


More information about the systemd-devel mailing list