]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #2671 from 0xAX/move-pager-open-to-one-place
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 25 Feb 2016 20:29:59 +0000 (15:29 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 25 Feb 2016 20:29:59 +0000 (15:29 -0500)
tree-wide: merge pager_open_if_enabled() to the pager_open()

165 files changed:
.gitignore
CODING_STYLE
Makefile-man.am
Makefile.am
NEWS
README
TODO
configure.ac
man/bootchart.conf.xml [deleted file]
man/machinectl.xml
man/nss-myhostname.xml
man/nss-mymachines.xml
man/nss-resolve.xml
man/systemd-bootchart.xml [deleted file]
man/systemd-importd.service.xml [new file with mode: 0644]
man/systemd.netdev.xml
man/systemd.unit.xml
src/activate/activate.c
src/analyze/analyze-verify.c
src/analyze/analyze.c
src/basic/MurmurHash2.c
src/basic/architecture.h
src/basic/calendarspec.c
src/basic/cgroup-util.c
src/basic/ether-addr-util.c
src/basic/ether-addr-util.h
src/basic/extract-word.c
src/basic/fileio.c
src/basic/hexdecoct.c
src/basic/hostname-util.c
src/basic/io-util.c
src/basic/io-util.h
src/basic/list.h
src/basic/log.h
src/basic/macro.h
src/basic/parse-util.c
src/basic/signal-util.h
src/basic/socket-util.c
src/basic/stdio-util.h
src/basic/strbuf.c
src/basic/string-util.c
src/basic/time-util.c
src/basic/utf8.c
src/basic/virt.c
src/boot/efi/splash.c
src/bootchart/Makefile [deleted symlink]
src/bootchart/bootchart.c [deleted file]
src/bootchart/bootchart.conf [deleted file]
src/bootchart/bootchart.h [deleted file]
src/bootchart/store.c [deleted file]
src/bootchart/store.h [deleted file]
src/bootchart/svg.c [deleted file]
src/bootchart/svg.h [deleted file]
src/core/execute.c
src/core/job.c
src/core/load-fragment.c
src/core/main.c
src/core/manager.c
src/core/service.c
src/core/socket.c
src/core/umount.c
src/core/unit.c
src/coredump/stacktrace.c
src/delta/delta.c
src/initctl/initctl.c
src/journal-remote/browse.html
src/journal-remote/journal-remote.c
src/journal-remote/journal-upload-journal.c
src/journal-remote/journal-upload.c
src/journal/catalog.c
src/journal/journal-file.c
src/journal/journal-send.c
src/journal/journal-vacuum.c
src/journal/journal-verify.c
src/journal/journalctl.c
src/journal/journald-audit.c
src/journal/journald-kmsg.c
src/journal/journald-rate-limit.c
src/journal/journald-server.c
src/journal/journald-stream.c
src/journal/mmap-cache.c
src/journal/sd-journal.c
src/journal/test-journal-enum.c
src/libsystemd-network/dhcp-option.c
src/libsystemd-network/dhcp-packet.c
src/libsystemd-network/network-internal.c
src/libsystemd-network/sd-dhcp-server.c
src/libsystemd-network/sd-ipv4acd.c
src/libsystemd-network/sd-ipv4ll.c
src/libsystemd/sd-bus/bus-dump.c
src/libsystemd/sd-bus/bus-message.c
src/libsystemd/sd-bus/bus-objects.c
src/libsystemd/sd-bus/bus-slot.c
src/libsystemd/sd-bus/bus-socket.c
src/libsystemd/sd-bus/bus-track.c
src/libsystemd/sd-bus/sd-bus.c
src/libsystemd/sd-bus/test-bus-error.c
src/libsystemd/sd-daemon/sd-daemon.c
src/libsystemd/sd-device/device-private.c
src/libsystemd/sd-device/sd-device.c
src/libsystemd/sd-event/sd-event.c
src/libsystemd/sd-event/test-event.c
src/libsystemd/sd-netlink/netlink-message.c
src/libsystemd/sd-netlink/netlink-socket.c
src/libsystemd/sd-netlink/sd-netlink.c
src/libsystemd/sd-netlink/test-netlink.c
src/libsystemd/sd-network/sd-network.c
src/libsystemd/sd-resolve/sd-resolve.c
src/libudev/libudev-enumerate.c
src/locale/localed.c
src/machine/machine.c
src/machine/machinectl.c
src/machine/machined-dbus.c
src/network/networkctl.c
src/network/networkd-dhcp4.c
src/network/networkd-fdb.c
src/network/networkd-ipv4ll.c
src/network/networkd-link.c
src/network/networkd-ndisc.c
src/network/networkd-netdev-bond.c
src/network/networkd-netdev-tuntap.c
src/network/networkd-netdev-vxlan.c
src/nspawn/nspawn-network.c
src/nspawn/nspawn.c
src/nss-mymachines/nss-mymachines.c
src/nss-resolve/nss-resolve.c
src/resolve/resolved-bus.c
src/resolve/resolved-conf.c
src/resolve/resolved-dns-answer.c
src/resolve/resolved-dns-cache.c
src/resolve/resolved-dns-packet.c
src/resolve/resolved-dns-query.c
src/resolve/resolved-dns-rr.h
src/resolve/resolved-dns-server.c
src/resolve/resolved-dns-transaction.c
src/resolve/resolved-etc-hosts.c
src/resolve/resolved-resolv-conf.c
src/resolve/test-dns-packet.c
src/resolve/test-dnssec.c
src/shared/bus-util.c
src/shared/condition.c
src/shared/conf-parser.h
src/shared/dns-domain.c
src/shared/gcrypt-util.c
src/shared/logs-show.c
src/shared/sleep-config.c
src/shared/uid-range.c
src/socket-proxy/socket-proxyd.c
src/systemctl/systemctl.c
src/systemd/sd-messages.h
src/sysv-generator/sysv-generator.c
src/test/test-execute.c
src/test/test-netlink-manual.c
src/test/test-path.c
src/test/test-time.c
src/test/test-unit-file.c
src/udev/mtd_probe/probe_smartmedia.c
src/udev/udev-builtin-input_id.c
src/udev/udevadm-monitor.c
src/udev/udevadm-test.c
tools/make-directive-index.py
units/.gitignore
units/systemd-bootchart.service.in [deleted file]
units/systemd-importd.service.in
units/systemd-resolved.service.m4.in

index 2324e6e478fd18f341975706524dbffbba51e811..eab660e859bc16421983f36449ef23689e3ea1c0 100644 (file)
@@ -53,7 +53,6 @@
 /systemd-ask-password
 /systemd-backlight
 /systemd-binfmt
-/systemd-bootchart
 /systemd-bootx64.efi
 /systemd-cat
 /systemd-cgls
index 46e366898e7ee5ddeac6882ef9fa51c081de7cd0..e5ba396368d8f49f3a77e62d82246fa89f26cde1 100644 (file)
   programming error with assert_return() and return a sensible return
   code. In all other calls, it is recommended to check for programming
   errors with a more brutal assert(). We are more forgiving to public
-  users then for ourselves! Note that assert() and assert_return()
+  users than for ourselves! Note that assert() and assert_return()
   really only should be used for detecting programming errors, not for
   runtime errors. assert() and assert_return() by usage of _likely_()
   inform the compiler that he should not expect these checks to fail,
index 8b68bf37ccfc9e23678f79578668e19310847d25..3f03afc2efef39a1a9499a338930a7127242091d 100644 (file)
@@ -1843,18 +1843,6 @@ man/systemd-binfmt.html: man/systemd-binfmt.service.html
 
 endif
 
-if ENABLE_BOOTCHART
-MANPAGES += \
-       man/bootchart.conf.5 \
-       man/systemd-bootchart.1
-MANPAGES_ALIAS += \
-       man/bootchart.conf.d.5
-man/bootchart.conf.d.5: man/bootchart.conf.5
-man/bootchart.conf.d.html: man/bootchart.conf.html
-       $(html-alias)
-
-endif
-
 if ENABLE_COREDUMP
 MANPAGES += \
        man/coredump.conf.5 \
@@ -1910,6 +1898,17 @@ MANPAGES_ALIAS += \
 
 endif
 
+if ENABLE_IMPORTD
+MANPAGES += \
+       man/systemd-importd.service.8
+MANPAGES_ALIAS += \
+       man/systemd-importd.8
+man/systemd-importd.8: man/systemd-importd.service.8
+man/systemd-importd.html: man/systemd-importd.service.html
+       $(html-alias)
+
+endif
+
 if ENABLE_LOCALED
 MANPAGES += \
        man/localectl.1 \
@@ -2449,7 +2448,6 @@ endif
 
 EXTRA_DIST += \
        man/binfmt.d.xml \
-       man/bootchart.conf.xml \
        man/bootctl.xml \
        man/bootup.xml \
        man/busctl.xml \
@@ -2572,7 +2570,6 @@ EXTRA_DIST += \
        man/systemd-ask-password.xml \
        man/systemd-backlight@.service.xml \
        man/systemd-binfmt.service.xml \
-       man/systemd-bootchart.xml \
        man/systemd-cat.xml \
        man/systemd-cgls.xml \
        man/systemd-cgtop.xml \
@@ -2593,6 +2590,7 @@ EXTRA_DIST += \
        man/systemd-hibernate-resume@.service.xml \
        man/systemd-hostnamed.service.xml \
        man/systemd-hwdb.xml \
+       man/systemd-importd.service.xml \
        man/systemd-inhibit.xml \
        man/systemd-initctl.service.xml \
        man/systemd-journal-gatewayd.service.xml \
index a0043c2e4a12b8438a87319eb35c9344649da57d..7bd98dddf65e97e4c2354de3671a56d7b271e006 100644 (file)
@@ -1550,6 +1550,7 @@ EXTRA_DIST += \
        test/test-execute/exec-privatedevices-yes.service \
        test/test-execute/exec-privatetmp-no.service \
        test/test-execute/exec-privatetmp-yes.service \
+       test/test-execute/exec-spec-interpolation.service \
        test/test-execute/exec-systemcallerrornumber.service \
        test/test-execute/exec-systemcallfilter-failing2.service \
        test/test-execute/exec-systemcallfilter-failing.service \
@@ -1571,6 +1572,11 @@ EXTRA_DIST += \
        test/test-execute/exec-capabilityboundingset-merge.service \
        test/test-execute/exec-capabilityboundingset-reset.service \
        test/test-execute/exec-capabilityboundingset-simple.service \
+       test/test-execute/exec-capabilityambientset.service \
+       test/test-execute/exec-capabilityambientset-merge.service \
+       test/test-execute/exec-runtimedirectory.service \
+       test/test-execute/exec-runtimedirectory-mode.service \
+       test/test-execute/exec-runtimedirectory-owner.service \
        test/bus-policy/hello.conf \
        test/bus-policy/methods.conf \
        test/bus-policy/ownerships.conf \
@@ -4415,32 +4421,6 @@ EXTRA_DIST += \
        src/vconsole/90-vconsole.rules.in \
        units/systemd-vconsole-setup.service.in
 
-# ------------------------------------------------------------------------------
-if ENABLE_BOOTCHART
-systemd_bootchart_SOURCES = \
-       src/bootchart/bootchart.c \
-       src/bootchart/bootchart.h \
-       src/bootchart/store.c \
-       src/bootchart/store.h \
-       src/bootchart/svg.c \
-       src/bootchart/svg.h
-
-systemd_bootchart_LDADD = \
-       libshared.la
-
-rootlibexec_PROGRAMS += \
-       systemd-bootchart
-
-dist_pkgsysconf_DATA += \
-       src/bootchart/bootchart.conf
-
-nodist_systemunit_DATA += \
-       units/systemd-bootchart.service
-endif
-
-EXTRA_DIST += \
-       units/systemd-bootchart.service.in
-
 # ------------------------------------------------------------------------------
 if ENABLE_QUOTACHECK
 rootlibexec_PROGRAMS += \
diff --git a/NEWS b/NEWS
index 0cce79443b1f9d1745ec74eb98841a969afbfcd2..8b30bee6b7a7161bb3431e8c1a957cddde1dbfce 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,7 +11,7 @@ CHANGES WITH 230 in spe:
           interested in collecting feedback about the DNSSEC validator and its
           limitations in the wild. Note however, that DNSSEC support is
           probably nothing downstreams should turn on in stable distros just
-          yet, as it might create incompabilities with a few DNS servers and
+          yet, as it might create incompatibilities with a few DNS servers and
           networks. We tried hard to make sure we downgrade to non-DNSSEC mode
           automatically whenever we detect such incompatible setups, but there
           might be systems we do not cover yet. Hence: please help us testing
diff --git a/README b/README
index 41fb07a298c47cfdf7212cbf69bdcaf5b4f60210..3bdf4107cf56fe090481ffcbbb608c5af8298856 100644 (file)
--- a/README
+++ b/README
@@ -88,10 +88,6 @@ REQUIREMENTS:
         Required for CPUQuota= in resource control unit settings
           CONFIG_CFS_BANDWIDTH
 
-        For systemd-bootchart, several proc debug interfaces are required:
-          CONFIG_SCHEDSTATS
-          CONFIG_SCHED_DEBUG
-
         For UEFI systems:
           CONFIG_EFIVAR_FS
           CONFIG_EFI_PARTITION
diff --git a/TODO b/TODO
index 038e8109551fb04a587a6acad7d77a5c1d5fbc84..08b74083d35d60ea0a06f5e3e7df15f9d4f02a73 100644 (file)
--- a/TODO
+++ b/TODO
@@ -754,12 +754,6 @@ Features:
      works with ^C
    - add documentation to systemd.daemon
 
-* bootchart:
-   - plot per-process IO utilization
-   - group processes based on service association (cgroups)
-   - document initcall_debug
-   - kernel cmdline "bootchart" option for simplicity?
-
 * udev-link-config:
    - Make sure ID_PATH is always exported and complete for
      network devices where possible, so we can safely rely
index 269aceddcccc1291b190118c1703c5276a0d811a..e55d1a02a62403857f628f29336b9b81a46ff92c 100644 (file)
@@ -938,14 +938,6 @@ if test "x$enable_vconsole" != "xno"; then
 fi
 AM_CONDITIONAL(ENABLE_VCONSOLE, [test "$have_vconsole" = "yes"])
 
-# ------------------------------------------------------------------------------
-have_bootchart=no
-AC_ARG_ENABLE(bootchart, AS_HELP_STRING([--disable-bootchart], [disable bootchart tool]))
-if test "x$enable_bootchart" != "xno"; then
-        have_bootchart=yes
-fi
-AM_CONDITIONAL(ENABLE_BOOTCHART, [test "$have_bootchart" = "yes"])
-
 # ------------------------------------------------------------------------------
 have_quotacheck=no
 AC_ARG_ENABLE(quotacheck, AS_HELP_STRING([--disable-quotacheck], [disable quotacheck tools]))
@@ -1571,7 +1563,6 @@ AC_MSG_RESULT([
         ELFUTILS:                ${have_elfutils}
         binfmt:                  ${have_binfmt}
         vconsole:                ${have_vconsole}
-        bootchart:               ${have_bootchart}
         quotacheck:              ${have_quotacheck}
         tmpfiles:                ${have_tmpfiles}
         sysusers:                ${have_sysusers}
diff --git a/man/bootchart.conf.xml b/man/bootchart.conf.xml
deleted file mode 100644 (file)
index f6ac7e6..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-<?xml version='1.0'?> <!--*-nxml-*-->
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-
-<!--
-  This file is part of systemd.
-
-  Copyright 2012 Intel Corporation
-
-  Authors:
-    Auke Kok <auke-jan.h.kok@intel.com>
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
--->
-
-<refentry id="bootchart.conf" conditional='ENABLE_BOOTCHART'
-    xmlns:xi="http://www.w3.org/2001/XInclude">
-  <refentryinfo>
-    <title>bootchart.conf</title>
-    <productname>systemd</productname>
-
-    <authorgroup>
-      <author>
-        <contrib>Developer</contrib>
-        <firstname>Auke</firstname>
-        <surname>Kok</surname>
-        <email>auke-jan.h.kok@intel.com</email>
-      </author>
-    </authorgroup>
-  </refentryinfo>
-
-  <refmeta>
-    <refentrytitle>bootchart.conf</refentrytitle>
-    <manvolnum>5</manvolnum>
-  </refmeta>
-
-  <refnamediv>
-    <refname>bootchart.conf</refname>
-    <refname>bootchart.conf.d</refname>
-    <refpurpose>Boot performance analysis graphing tool configuration files</refpurpose>
-  </refnamediv>
-
-  <refsynopsisdiv>
-    <para><filename>/etc/systemd/bootchart.conf</filename></para>
-    <para><filename>/etc/systemd/bootchart.conf.d/*.conf</filename></para>
-    <para><filename>/run/systemd/bootchart.conf.d/*.conf</filename></para>
-    <para><filename>/usr/lib/systemd/bootchart.conf.d/*.conf</filename></para>
-  </refsynopsisdiv>
-
-  <refsect1>
-    <title>Description</title>
-
-    <para>When starting, systemd-bootchart will read the configuration
-    file <filename>/etc/systemd/bootchart.conf</filename>, followed by
-    the files in the <filename>bootchart.conf.d</filename>
-    directories. These configuration files determine logging
-    parameters and graph output.</para>
-  </refsect1>
-
-  <xi:include href="standard-conf.xml" xpointer="main-conf" />
-
-  <refsect1>
-    <title>Options</title>
-
-    <variablelist class='bootchart-directives'>
-
-      <varlistentry>
-        <term><varname>Samples=500</varname></term>
-        <listitem><para>Configure the amount of samples to record in
-        total before bootchart exits. Each sample will record at
-        intervals defined by Frequency=.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><varname>Frequency=25</varname></term>
-        <listitem><para>Configure the sample log frequency. This can
-        be a fractional number, but must be larger than 0.0. Most
-        systems can cope with values under 25–50 without impacting
-        boot time severely.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><varname>Relative=no</varname></term>
-        <listitem><para>Configures whether the left axis of the output
-        graph equals time=0.0 (<constant>CLOCK_MONOTONIC</constant>
-        start). This is useful for using bootchart at post-boot time
-        to profile an already booted system, otherwise the graph would
-        become extremely large. If set to yes, the horizontal axis
-        starts at the first recorded sample instead of time=0.0.
-        </para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><varname>Filter=no</varname></term>
-        <listitem><para>Configures whether the resulting graph should
-        omit tasks that did not contribute significantly to the boot.
-        Processes that are too short-lived (only seen in one sample)
-        or that do not consume any significant CPU time (less than
-        0.001sec) will not be displayed in the output
-        graph.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><varname>Output=[path]</varname></term>
-        <listitem><para>Configures the output directory for writing
-        the graphs. By default, bootchart writes the graphs to
-        <filename>/run/log</filename>.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><varname>Init=[path]</varname></term>
-        <listitem><para>Configures bootchart to run a non-standard
-        binary instead of
-        <filename>/usr/lib/systemd/systemd</filename>. This option is
-        only relevant if bootchart was invoked from the kernel command
-        line with
-        init=/usr/lib/systemd/systemd-bootchart.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><varname>PlotMemoryUsage=no</varname></term>
-        <listitem><para>If set to yes, enables logging and graphing of
-        processes' PSS memory consumption.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><varname>PlotEntropyGraph=no</varname></term>
-        <listitem><para>If set to yes, enables logging and graphing of
-        the kernel random entropy pool size.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><varname>ScaleX=100</varname></term>
-        <listitem><para>Horizontal scaling factor for all variable
-        graph components.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><varname>ScaleY=20</varname></term>
-        <listitem><para>Vertical scaling factor for all variable graph
-        components.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><varname>ControlGroup=no</varname></term>
-        <listitem><para>Display process control group.
-        </para></listitem>
-      </varlistentry>
-
-    </variablelist>
-  </refsect1>
-
-  <refsect1>
-      <title>See Also</title>
-      <para>
-        <citerefentry><refentrytitle>systemd-bootchart</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
-        <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
-      </para>
-  </refsect1>
-
-</refentry>
index 8d65155d9eb876fc48c9b0ba316d7c6fe147b8c1..967ca01470cf6443ec7f80e9bb99572f8e49285e 100644 (file)
       <title>Download a Fedora image, set a root password in it, start
       it as service</title>
 
-      <programlisting># machinectl pull-raw --verify=no http://ftp.halifax.rwth-aachen.de/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-23-20151030.x86_64.raw.xz
+      <programlisting># machinectl pull-raw --verify=no https://dl.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-23-20151030.x86_64.raw.xz
 # systemd-nspawn -M Fedora-Cloud-Base-23-20151030
 # passwd
 # exit
index 251bdecbad1f993a45bce7180d0682249a2bf8c4..f8837745ae652f196ed8724b5b84f0f15e5fe020 100644 (file)
   <refsect1>
     <title>Description</title>
 
-    <para><command>nss-myhostname</command> is a plugin for the GNU
-    Name Service Switch (NSS) functionality of the GNU C Library
-    (<command>glibc</command>), primarily providing hostname resolution
-    for the locally configured system hostname as returned by
-    <citerefentry><refentrytitle>gethostname</refentrytitle><manvolnum>2</manvolnum></citerefentry>.
-    The precise hostnames resolved by this module are:</para>
+    <para><command>nss-myhostname</command> is a plug-in module for the GNU Name Service Switch (NSS) functionality of
+    the GNU C Library (<command>glibc</command>), primarily providing hostname resolution for the locally configured
+    system hostname as returned by
+    <citerefentry><refentrytitle>gethostname</refentrytitle><manvolnum>2</manvolnum></citerefentry>.  The precise
+    hostnames resolved by this module are:</para>
 
     <itemizedlist>
       <listitem><para>The local, configured hostname is resolved to
@@ -80,7 +79,6 @@
       ordered by their metric. This assigns a stable hostname to the
       current gateway, useful for referencing it independently of the
       current network configuration state.</para></listitem>
-
     </itemizedlist>
 
     <para>Various software relies on an always-resolvable local
     changing <filename>/etc/hosts</filename> is unnecessary, and on
     many systems, the file becomes entirely optional.</para>
 
-    <para>To activate the NSS modules, <literal>myhostname</literal>
-    has to be added to the line starting with
-    <literal>hosts:</literal> in
-    <filename>/etc/nsswitch.conf</filename>.</para>
+    <para>To activate the NSS modules, add <literal>myhostname</literal> to the line starting with
+    <literal>hosts:</literal> in <filename>/etc/nsswitch.conf</filename>.</para>
 
-    <para>It is recommended to place <literal>myhostname</literal>
-    last in the <filename>nsswitch.conf</filename> line to make sure
-    that this mapping is only used as fallback, and that any DNS or
-    <filename>/etc/hosts</filename> based mapping takes
-    precedence.</para>
+    <para>It is recommended to place <literal>myhostname</literal> last in the <filename>nsswitch.conf</filename>'
+    <literal>hosts:</literal> line to make sure that this mapping is only used as fallback, and that any DNS or
+    <filename>/etc/hosts</filename> based mapping takes precedence.</para>
   </refsect1>
 
   <refsect1>
     <title>Example</title>
 
-    <para>Here is an example <filename>/etc/nsswitch.conf</filename>
-    file that enables <command>myhostname</command> correctly:</para>
+    <para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables
+    <command>nss-myhostname</command> correctly:</para>
 
 <programlisting>passwd:         compat mymachines
 group:          compat mymachines
 shadow:         compat
 
-hosts:          files resolve mymachines <command>myhostname</command>
+hosts:          files mymachines resolve <command>myhostname</command>
 networks:       files
 
 protocols:      db files
index d2bec763bb600e50237c0c0390a48f27f42099a1..ec047449bf99ede0b34951ba10253139ab1bfaca 100644 (file)
   <refsect1>
     <title>Description</title>
 
-    <para><command>nss-mymachines</command> is a plugin for the GNU
-    Name Service Switch (NSS) functionality of the GNU C Library
-    (<command>glibc</command>), providing hostname resolution for
-    container names of containers running locally that are registered
-    with
-    <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
-    The container names are resolved to the IP addresses of the
-    specific container, ordered by their scope.</para>
-
-    <para>The module also resolves user IDs used by containers to user
-    names indicating the container name, and back.</para>
-
-    <para>To activate the NSS modules, <literal>mymachines</literal>
-    has to be added to the lines starting with
-    <literal>hosts:</literal>, <literal>passwd:</literal> and
-    <literal>group:</literal> in
+    <para><command>nss-mymachines</command> is a plug-in module for the GNU Name Service Switch (NSS) functionality of
+    the GNU C Library (<command>glibc</command>), providing hostname resolution for the names of containers running
+    locally that are registered with
+    <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.  The
+    container names are resolved to the IP addresses of the specific container, ordered by their scope. This
+    functionality only applies to containers using network namespacing.</para>
+
+    <para>The module also resolves user and group IDs used by containers to user and group names indicating the
+    container name, and back. This functionality only applies to containers using user namespacing.</para>
+
+    <para>To activate the NSS module, add <literal>mymachines</literal> to the lines starting with
+    <literal>hosts:</literal>, <literal>passwd:</literal> and <literal>group:</literal> in
     <filename>/etc/nsswitch.conf</filename>.</para>
 
-    <para>It is recommended to place <literal>mymachines</literal>
-    near the end of the <filename>nsswitch.conf</filename> lines to
-    make sure that its mappings are only used as fallback, and that any
-    other mappings, such as DNS or <filename>/etc/hosts</filename>
-    based mappings, take precedence.</para>
+    <para>It is recommended to place <literal>mymachines</literal> after the <literal>files</literal> or
+    <literal>compat</literal> entry of the <filename>/etc/nsswitch.conf</filename> lines to make sure that its mappings
+    are preferred over other resolvers such as DNS, but so that <filename>/etc/hosts</filename>,
+    <filename>/etc/passwd</filename> and <filename>/etc/group</filename> based mappings take precedence.</para>
   </refsect1>
 
   <refsect1>
     <title>Example</title>
 
-    <para>Here is an example <filename>/etc/nsswitch.conf</filename>
-    file that enables <command>mymachines</command> correctly:</para>
+    <para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables
+    <command>nss-mymachines</command> correctly:</para>
 
     <programlisting>passwd:         compat <command>mymachines</command>
 group:          compat <command>mymachines</command>
 shadow:         compat
 
-hosts:          files resolve <command>mymachines</command> myhostname
+hosts:          files <command>mymachines</command> resolve myhostname
 networks:       files
 
 protocols:      db files
index 8b0928145f0efa30d856c678fe2eaf1edeb9c489..d9e56453e8e2f71894280e415ec3693a4d2a5c0a 100644 (file)
   <refsect1>
     <title>Description</title>
 
-    <para><command>nss-resolve</command> is a plugin module for the
-    GNU Name Service Switch (NSS) functionality of the GNU C Library
-    (<command>glibc</command>) enabling it to resolve host names via
-    the
-    <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-    local network name resolution service.</para>
-
-    <para>To activate the NSS module, <literal>resolve</literal>
-    has to be added to the line starting with
-    <literal>hosts:</literal> in
-    <filename>/etc/nsswitch.conf</filename>.</para>
-
-    <para>It is recommended to place <literal>resolve</literal> early
-    in the <filename>nsswitch.conf</filename> line (but after the
-    <literal>files</literal> entry), replacing the
-    <literal>dns</literal> entry if it exists, to ensure DNS queries
-    are always routed via
+    <para><command>nss-resolve</command> is a plug-in module for the GNU Name Service Switch (NSS) functionality of the
+    GNU C Library (<command>glibc</command>) enabling it to resolve host names via the
+    <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> local network
+    name resolution service. It replaces the <command>nss-dns</command> plug-in module that traditionally resolves
+    hostnames via DNS.</para>
+
+    <para>To activate the NSS module, add <literal>resolve</literal> to the line starting with
+    <literal>hosts:</literal> in <filename>/etc/nsswitch.conf</filename>.</para>
+
+    <para>It is recommended to place <literal>resolve</literal> early in <filename>/etc/nsswitch.conf</filename>'
+    <literal>hosts:</literal> line (but after the <literal>files</literal> or <literal>mymachines</literal> entries),
+    replacing the <literal>dns</literal> entry if it exists, to ensure DNS queries are always routed via
     <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
+
+    <para>Note that <command>nss-resolve</command> will chain-load <command>nss-dns</command> if
+    <filename>systemd-resolved.service</filename> is not running, ensuring that basic DNS resolution continues to work
+    if the service is down.</para>
   </refsect1>
 
   <refsect1>
     <title>Example</title>
 
-    <para>Here is an example <filename>/etc/nsswitch.conf</filename>
-    file that enables <command>resolve</command> correctly:</para>
+    <para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables <command>nss-resolve</command>
+    correctly:</para>
 
 <programlisting>passwd:         compat mymachines
 group:          compat mymachines
 shadow:         compat
 
-hosts:          files <command>resolve</command> mymachines myhostname
+hosts:          files mymachines <command>resolve</command> myhostname
 networks:       files
 
 protocols:      db files
@@ -96,12 +95,6 @@ rpc:            db files
 
 netgroup:       nis</programlisting>
 
-    <para>Note that <command>nss-resolve</command> will chain-load
-    <command>nss-dns</command> if
-    <filename>systemd-resolved.service</filename> is not running,
-    ensuring that basic DNS resolution continues to work if the
-    service is down.</para>
-
   </refsect1>
 
   <refsect1>
diff --git a/man/systemd-bootchart.xml b/man/systemd-bootchart.xml
deleted file mode 100644 (file)
index bcee11f..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-<?xml version='1.0'?> <!--*-nxml-*-->
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-
-<!--
-  This file is part of systemd.
-
-  Copyright 2012 Intel Corporation
-
-  Authors:
-    Auke Kok <auke-jan.h.kok@intel.com>
-    William Giokas <1007380@gmail.com>
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
--->
-
-<refentry id="systemd-bootchart" conditional='ENABLE_BOOTCHART'
-    xmlns:xi="http://www.w3.org/2001/XInclude">
-
-  <refentryinfo>
-    <title>systemd-bootchart</title>
-    <productname>systemd</productname>
-
-    <authorgroup>
-      <author>
-        <contrib>Developer</contrib>
-        <firstname>Auke</firstname>
-        <surname>Kok</surname>
-        <email>auke-jan.h.kok@intel.com</email>
-      </author>
-    </authorgroup>
-  </refentryinfo>
-
-  <refmeta>
-    <refentrytitle>systemd-bootchart</refentrytitle>
-    <manvolnum>1</manvolnum>
-  </refmeta>
-
-  <refnamediv>
-    <refname>systemd-bootchart</refname>
-    <refpurpose>Boot performance graphing tool</refpurpose>
-  </refnamediv>
-
-  <refsect1>
-    <title>Description</title>
-    <para>
-      <command>systemd-bootchart</command> is a tool, usually run at
-      system startup, that collects the CPU load, disk load, memory
-      usage, as well as per-process information from a running system.
-      Collected results are output as an SVG graph. Normally,
-      systemd-bootchart is invoked by the kernel by passing
-      <option>init=<filename>/usr/lib/systemd/systemd-bootchart</filename></option>
-      on the kernel command line. systemd-bootchart will then fork the
-      real init off to resume normal system startup, while monitoring
-      and logging startup information in the background.
-    </para>
-    <para>
-      After collecting a certain amount of data (usually 15–30
-      seconds, default 20 s) the logging stops and a graph is
-      generated from the logged information. This graph contains vital
-      clues as to which resources are being used, in which order, and
-      where possible problems exist in the startup sequence of the
-      system. It is essentially a more detailed version of the
-      <command>systemd-analyze plot</command> function.
-    </para>
-    <para>
-      Of course, bootchart can also be used at any moment in time to
-      collect and graph some data for an amount of time. It is
-      recommended to use the <option>--rel</option> switch in this
-      case.
-    </para>
-    <para>
-      Bootchart does not require root privileges, and will happily run
-      as a normal user.
-    </para>
-    <para>
-      Bootchart graphs are by default written time-stamped in
-      <filename>/run/log</filename> and saved to the journal with
-      <varname>MESSAGE_ID=9f26aa562cf440c2b16c773d0479b518</varname>.
-      Journal field <varname>BOOTCHART=</varname> contains the
-      bootchart in SVG format.
-    </para>
-
-  </refsect1>
-
-  <refsect1>
-    <title>Invocation</title>
-
-    <para><command>systemd-bootchart</command> can be invoked in several different ways:</para>
-
-    <variablelist>
-
-      <varlistentry>
-        <term><emphasis>Kernel invocation</emphasis></term>
-        <listitem><para>The kernel can invoke
-        <command>systemd-bootchart</command> instead of the init
-        process. In turn, <command>systemd-bootchart</command> will
-        invoke <command>/usr/lib/systemd/systemd</command>.
-        </para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><emphasis>Started as a standalone program</emphasis></term>
-        <listitem><para>One can execute
-        <command>systemd-bootchart</command> as normal application
-        from the command line. In this mode, it is highly recommended
-        to pass the <option>-r</option> flag in order to not graph the
-        time elapsed since boot and before systemd-bootchart was
-        started, as it may result in extremely large graphs. The time
-        elapsed since boot might also include any time that the system
-        was suspended.</para></listitem>
-      </varlistentry>
-    </variablelist>
-  </refsect1>
-
-  <refsect1>
-    <title>Options</title>
-
-    <para>These options can also be set in the
-    <filename>/etc/systemd/bootchart.conf</filename> file. See
-    <citerefentry project='man-pages'><refentrytitle>bootchart.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
-    </para>
-
-    <variablelist>
-      <xi:include href="standard-options.xml" xpointer="help" />
-
-      <varlistentry>
-        <term><option>-n</option></term>
-        <term><option>--sample <replaceable>N</replaceable></option></term>
-        <listitem><para>Specify the number of samples,
-        <replaceable>N</replaceable>, to record. Samples will be
-        recorded at intervals defined with <option>--freq</option>.
-        </para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><option>-f</option></term>
-        <term><option>--freq <replaceable>f</replaceable></option></term>
-        <listitem><para>Specify the sample log frequency, a positive
-        real <replaceable>f</replaceable>, in Hz. Most systems can
-        cope with values up to 25–50 without creating too much
-        overhead.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><option>-r</option></term>
-        <term><option>--rel</option></term>
-        <listitem><para>Use relative times instead of absolute times.
-        This is useful for using bootchart at post-boot time to
-        profile an already booted system. Without this option the
-        graph would become extremely large. If set, the horizontal
-        axis starts at the first recorded sample instead of time
-        0.0.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><option>-F</option></term>
-        <term><option>--no-filter</option></term>
-        <listitem><para>Disable filtering of tasks that did not
-        contribute significantly to the boot. Processes that are too
-        short-lived (only seen in one sample) or that do not consume
-        any significant CPU time (less than 0.001 s) will not be
-        displayed in the output graph. </para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><option>-C</option></term>
-        <term><option>--cmdline</option></term>
-        <listitem><para>Display the full command line with arguments
-        of processes, instead of only the process name.
-        </para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><option>-g</option></term>
-        <term><option>--control-group</option></term>
-        <listitem><para>Display process control group
-        </para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><option>-o</option></term>
-        <term><option>--output <replaceable>path</replaceable></option></term>
-        <listitem><para>Specify the output directory for the graphs.
-        By default, bootchart writes the graphs to
-        <filename>/run/log</filename>.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><option>-i</option></term>
-        <term><option>--init <replaceable>path</replaceable></option></term>
-        <listitem><para>Use this init binary. Defaults to
-        <command>/usr/lib/systemd/systemd</command>.
-        </para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><option>-p</option></term>
-        <term><option>--pss</option></term>
-        <listitem><para>Enable logging and graphing of processes' PSS
-        (Proportional Set Size) memory consumption. See
-        <filename>filesystems/proc.txt</filename> in the kernel
-        documentation for an explanation of this field.
-        </para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><option>-e</option></term>
-        <term><option>--entropy</option></term>
-        <listitem><para>Enable logging and graphing of the kernel
-        random entropy pool size.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><option>-x</option></term>
-        <term><option>--scale-x <replaceable>N</replaceable></option></term>
-        <listitem><para>Horizontal scaling factor for all variable
-        graph components.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><option>-y</option></term>
-        <term><option>--scale-y <replaceable>N</replaceable></option></term>
-        <listitem><para>Vertical scaling factor for all variable graph
-        components.</para></listitem>
-      </varlistentry>
-
-    </variablelist>
-
-
-  </refsect1>
-
-  <refsect1>
-    <title>Output</title>
-
-    <para><command>systemd-bootchart</command> generates SVG graphs.
-    In order to render those on a graphical display any SVG capable
-    viewer can be used. It should be noted that the SVG render engines
-    in most browsers (including Chrome and Firefox) are many times
-    faster than dedicated graphical applications like Gimp and
-    Inkscape. Just point your browser at
-    <ulink url="file:///run/log/" />!
-    </para>
-  </refsect1>
-
-  <refsect1>
-    <title>History</title>
-
-    <para>This version of bootchart was implemented from scratch, but
-    is inspired by former bootchart incantations:</para>
-
-    <variablelist>
-      <varlistentry>
-        <term><emphasis>Original bash</emphasis></term>
-        <listitem><para>The original bash/shell code implemented
-        bootchart. This version created a compressed tarball for
-        processing with external applications. This version did not
-        graph anything, only generated data.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><emphasis>Ubuntu C Implementation</emphasis></term>
-        <listitem><para>This version replaced the shell version with a
-        fast and efficient data logger, but also did not graph the
-        data.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><emphasis>Java bootchart</emphasis></term>
-        <listitem><para>This was the original graphing application for
-        charting the data, written in java.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><emphasis>pybootchartgui.py</emphasis></term>
-        <listitem><para>pybootchart created a graph from the data
-        collected by either the bash or C version.</para></listitem>
-      </varlistentry>
-    </variablelist>
-
-    <para>The version of bootchart you are using now combines both the
-    data collection and the charting into a single application, making
-    it more efficient and simpler. There are no longer any timing
-    issues with the data collector and the grapher, as the graphing
-    cannot be run until the data has been collected. Also, the data
-    kept in memory is reduced to the absolute minimum needed.</para>
-
-  </refsect1>
-
-  <refsect1>
-    <title>See Also</title>
-
-    <para>
-      <citerefentry project='man-pages'><refentrytitle>bootchart.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
-    </para>
-  </refsect1>
-
-  <refsect1>
-    <title>Bugs</title>
-
-    <para>systemd-bootchart does not get the model information for the
-    hard drive unless the root device is specified with
-    <code>root=/dev/sdxY</code>. Using UUIDs or PARTUUIDs will boot
-    fine, but the hard drive model will not be added to the
-    chart.</para>
-    <para>For bugs, please contact the author and current maintainer:</para>
-    <simplelist>
-      <member>Auke Kok <email>auke-jan.h.kok@intel.com</email></member>
-    </simplelist>
-  </refsect1>
-
-</refentry>
diff --git a/man/systemd-importd.service.xml b/man/systemd-importd.service.xml
new file mode 100644 (file)
index 0000000..8fdced4
--- /dev/null
@@ -0,0 +1,82 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+  This file is part of systemd.
+
+  Copyright 2016 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="systemd-importd.service" conditional='ENABLE_IMPORTD'>
+
+  <refentryinfo>
+    <title>systemd-importd.service</title>
+    <productname>systemd</productname>
+
+    <authorgroup>
+      <author>
+        <contrib>Developer</contrib>
+        <firstname>Lennart</firstname>
+        <surname>Poettering</surname>
+        <email>lennart@poettering.net</email>
+      </author>
+    </authorgroup>
+  </refentryinfo>
+
+  <refmeta>
+    <refentrytitle>systemd-importd.service</refentrytitle>
+    <manvolnum>8</manvolnum>
+  </refmeta>
+
+  <refnamediv>
+    <refname>systemd-importd.service</refname>
+    <refname>systemd-importd</refname>
+    <refpurpose>VM and container image import and export service</refpurpose>
+  </refnamediv>
+
+  <refsynopsisdiv>
+    <para><filename>systemd-importd.service</filename></para>
+    <para><filename>/usr/lib/systemd/systemd-importd</filename></para>
+  </refsynopsisdiv>
+
+  <refsect1>
+    <title>Description</title>
+
+    <para><command>systemd-importd</command> is a system service that allows importing, exporting and downloading of
+    system images suitable for running as VM or containers. It is a companion service for
+    <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, and provides the implementation for
+    <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
+    <command>pull-raw</command>, <command>pull-tar</command>, <command>import-raw</command>,
+    <command>import-tar</command>, <command>export-raw</command>, and <command>export-tar</command> commands.</para>
+
+    <para>See the
+    <ulink url="http://www.freedesktop.org/wiki/Software/systemd/importd">
+    importd D-Bus API Documentation</ulink> for information about the
+    APIs <filename>systemd-importd</filename> provides.</para>
+  </refsect1>
+
+  <refsect1>
+    <title>See Also</title>
+    <para>
+      <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+    </para>
+  </refsect1>
+
+</refentry>
index b697d0c9a6e36137f3f382b37d65bd358dbccf73..c5fb2fa7fb1f048c50e79e0c222eb755b74a6288 100644 (file)
 
     <para>The <literal>[MACVTAP]</literal> section applies for
     netdevs of kind <literal>macvtap</literal> and accepts the
-    same key as <literal>[MACVLAN].</literal> </para>
+    same key as <literal>[MACVLAN]</literal>.</para>
 
     </refsect1>
 
index 5794681963d48aa5e2c0b5097e0265e16ea3b32b..f5022b03cc1827ca2095c84dddccbe8ae4ee5c77 100644 (file)
         between them are shut down, the inverse of the start-up order
         is applied. i.e. if a unit is configured with
         <varname>After=</varname> on another unit, the former is
-        stopped before the latter if both are shut down. If one unit
-        with an ordering dependency on another unit is shut down while
-        the latter is started up, the shut down is ordered before the
-        start-up regardless of whether the ordering dependency is
-        actually of type <varname>After=</varname> or
-        <varname>Before=</varname>. If two units have no ordering
-        dependencies between them, they are shut down or started up
-        simultaneously, and no ordering takes place.
+        stopped before the latter if both are shut down. Given two units
+        with any ordering dependency between them, if one unit is shut
+        down and the other is started up, the shutdown is ordered
+        before the start-up. It doesn't matter if the ordering
+        dependency is <varname>After=</varname> or
+        <varname>Before=</varname>. It also doesn't matter which of the
+        two is shut down, as long as one is shut down and the other is
+        started up. The shutdown is ordered before the start-up in all
+        cases. If two units have no ordering dependencies between them,
+        they are shut down or started up simultaneously, and no ordering
+        takes place.
         </para></listitem>
       </varlistentry>
 
index d6e2d07ff2fc146b5539ab1837aaea2025900410..8ac8dd8e727f459f8da42637d8fac2cdbb086e87 100644 (file)
@@ -77,7 +77,7 @@ static int open_sockets(int *epoll_fd, bool accept) {
                         if (r < 0)
                                 return r;
 
-                        count ++;
+                        count++;
                 }
         }
 
@@ -105,7 +105,7 @@ static int open_sockets(int *epoll_fd, bool accept) {
                 }
 
                 assert(fd == SD_LISTEN_FDS_START + count);
-                count ++;
+                count++;
         }
 
         if (arg_listen)
@@ -176,7 +176,7 @@ static int exec_process(const char* name, char **argv, char **env, int start_fd,
                         if (!envp[n_env])
                                 return log_oom();
 
-                        n_env ++;
+                        n_env++;
                 }
         }
 
@@ -191,7 +191,7 @@ static int exec_process(const char* name, char **argv, char **env, int start_fd,
                 if (!envp[n_env])
                         return log_oom();
 
-                n_env ++;
+                n_env++;
         }
 
         if (arg_inetd) {
index d36c8db3d4061254a6b5efed5f8510daf6d0f238..b83f559e7db931d92970223d1e8b656d785beef6 100644 (file)
@@ -290,7 +290,7 @@ int verify_units(char **filenames, ManagerRunningAs running_as, bool check_man)
                         if (r == 0)
                                 r = k;
                 } else
-                        count ++;
+                        count++;
         }
 
         for (i = 0; i < count; i++) {
index 9479d4584d74b7e5d8da27cbde48cb88dafa74d4..42754a27415e589cfd8c7fc874d3b528bf7216d2 100644 (file)
@@ -60,7 +60,7 @@
                 svg("  <text class=\"%s\" x=\"%.03f\" y=\"%.03f\">", (b) ? "left" : "right", SCALE_X * (x) + (b ? 5.0 : -5.0), SCALE_Y * (y) + 14.0); \
                 svg(format, ## __VA_ARGS__);                            \
                 svg("</text>\n");                                       \
-        } while(false)
+        } while (false)
 
 static enum dot {
         DEP_ALL,
index 2f4149dbe9de8d5e17df476fd8c44b0956e69535..90207939307242e248ed8601b09145aa24f657cd 100644 (file)
@@ -50,7 +50,7 @@ uint32_t MurmurHash2 ( const void * key, int len, uint32_t seed )
 
   const unsigned char * data = (const unsigned char *)key;
 
-  while(len >= 4)
+  while (len >= 4)
   {
     uint32_t k = *(uint32_t*)data;
 
index 63cf6fb7035f2cbc8fd5b909f02365b76fdfb303..c22cbc82798cbbe66fb14c331661d1e4fdbef250 100644 (file)
@@ -77,12 +77,10 @@ int uname_architecture(void);
 #if defined(__x86_64__)
 #  define native_architecture() ARCHITECTURE_X86_64
 #  define LIB_ARCH_TUPLE "x86_64-linux-gnu"
-#  define PROC_CPUINFO_MODEL "model name"
 #  define SECONDARY_ARCHITECTURE ARCHITECTURE_X86
 #elif defined(__i386__)
 #  define native_architecture() ARCHITECTURE_X86
 #  define LIB_ARCH_TUPLE "i386-linux-gnu"
-#  define PROC_CPUINFO_MODEL "model name"
 #elif defined(__powerpc64__)
 #  if __BYTE_ORDER == __BIG_ENDIAN
 #    define native_architecture() ARCHITECTURE_PPC64
@@ -93,7 +91,6 @@ int uname_architecture(void);
 #    define LIB_ARCH_TUPLE  "powerpc64le-linux-gnu"
 #    define SECONDARY_ARCHITECTURE ARCHITECTURE_PPC_LE
 #  endif
-#  define PROC_CPUINFO_MODEL "cpu"
 #elif defined(__powerpc__)
 #  if __BYTE_ORDER == __BIG_ENDIAN
 #    define native_architecture() ARCHITECTURE_PPC
@@ -102,18 +99,15 @@ int uname_architecture(void);
 #    define native_architecture() ARCHITECTURE_PPC_LE
 #    error "Missing LIB_ARCH_TUPLE for PPCLE"
 #  endif
-#  define PROC_CPUINFO_MODEL "cpu"
 #elif defined(__ia64__)
 #  define native_architecture() ARCHITECTURE_IA64
 #  define LIB_ARCH_TUPLE "ia64-linux-gnu"
 #elif defined(__hppa64__)
 #  define native_architecture() ARCHITECTURE_PARISC64
 #  error "Missing LIB_ARCH_TUPLE for HPPA64"
-#  define PROC_CPUINFO_MODEL "cpu"
 #elif defined(__hppa__)
 #  define native_architecture() ARCHITECTURE_PARISC
 #  define LIB_ARCH_TUPLE "hppa‑linux‑gnu"
-#  define PROC_CPUINFO_MODEL "cpu"
 #elif defined(__s390x__)
 #  define native_architecture() ARCHITECTURE_S390X
 #  define LIB_ARCH_TUPLE "s390x-linux-gnu"
@@ -124,11 +118,9 @@ int uname_architecture(void);
 #elif defined(__sparc64__)
 #  define native_architecture() ARCHITECTURE_SPARC64
 #  define LIB_ARCH_TUPLE "sparc64-linux-gnu"
-#  define PROC_CPUINFO_MODEL "cpu"
 #elif defined(__sparc__)
 #  define native_architecture() ARCHITECTURE_SPARC
 #  define LIB_ARCH_TUPLE "sparc-linux-gnu"
-#  define PROC_CPUINFO_MODEL "cpu"
 #elif defined(__mips64__)
 #  if __BYTE_ORDER == __BIG_ENDIAN
 #    define native_architecture() ARCHITECTURE_MIPS64
@@ -137,7 +129,6 @@ int uname_architecture(void);
 #    define native_architecture() ARCHITECTURE_MIPS64_LE
 #    error "Missing LIB_ARCH_TUPLE for MIPS64_LE"
 #  endif
-#  define PROC_CPUINFO_MODEL "cpu model"
 #elif defined(__mips__)
 #  if __BYTE_ORDER == __BIG_ENDIAN
 #    define native_architecture() ARCHITECTURE_MIPS
@@ -146,7 +137,6 @@ int uname_architecture(void);
 #    define native_architecture() ARCHITECTURE_MIPS_LE
 #    define LIB_ARCH_TUPLE "mipsel-linux-gnu"
 #  endif
-#  define PROC_CPUINFO_MODEL "cpu model"
 #elif defined(__alpha__)
 #  define native_architecture() ARCHITECTURE_ALPHA
 #  define LIB_ARCH_TUPLE "alpha-linux-gnu"
@@ -182,7 +172,6 @@ int uname_architecture(void);
 #      define LIB_ARCH_TUPLE "arm-linux-gnu"
 #    endif
 #  endif
-#  define PROC_CPUINFO_MODEL "model name"
 #elif defined(__sh64__)
 #  define native_architecture() ARCHITECTURE_SH64
 #  error "Missing LIB_ARCH_TUPLE for SH64"
@@ -202,10 +191,5 @@ int uname_architecture(void);
 #  error "Please register your architecture here!"
 #endif
 
-#ifndef PROC_CPUINFO_MODEL
-#warning "PROC_CPUINFO_MODEL not defined for your architecture"
-#define PROC_CPUINFO_MODEL "model name"
-#endif
-
 const char *architecture_to_string(int a) _const_;
 int architecture_from_string(const char *s) _pure_;
index 2f40ba2b464031649b0884629739d7a1234b56e0..6e0bab9b940f0e05cf96b5e0b44a357a8ace1aaa 100644 (file)
@@ -114,7 +114,7 @@ static void sort_chain(CalendarComponent **c) {
 static void fix_year(CalendarComponent *c) {
         /* Turns 12 → 2012, 89 → 1989 */
 
-        while(c) {
+        while (c) {
                 CalendarComponent *n = c->next;
 
                 if (c->value >= 0 && c->value < 70)
@@ -1004,7 +1004,7 @@ static int find_next(const CalendarSpec *spec, struct tm *tm, usec_t *usec) {
                         c.tm_hour = c.tm_min = c.tm_sec = tm_usec = 0;
                 }
                 if (r < 0 || tm_out_of_bounds(&c, spec->utc)) {
-                        c.tm_year ++;
+                        c.tm_year++;
                         c.tm_mon = 0;
                         c.tm_mday = 1;
                         c.tm_hour = c.tm_min = c.tm_sec = tm_usec = 0;
@@ -1015,7 +1015,7 @@ static int find_next(const CalendarSpec *spec, struct tm *tm, usec_t *usec) {
                 if (r > 0)
                         c.tm_hour = c.tm_min = c.tm_sec = tm_usec = 0;
                 if (r < 0 || tm_out_of_bounds(&c, spec->utc)) {
-                        c.tm_mon ++;
+                        c.tm_mon++;
                         c.tm_mday = 1;
                         c.tm_hour = c.tm_min = c.tm_sec = tm_usec = 0;
                         continue;
@@ -1031,7 +1031,7 @@ static int find_next(const CalendarSpec *spec, struct tm *tm, usec_t *usec) {
                 if (r > 0)
                         c.tm_min = c.tm_sec = tm_usec = 0;
                 if (r < 0 || tm_out_of_bounds(&c, spec->utc)) {
-                        c.tm_mday ++;
+                        c.tm_mday++;
                         c.tm_hour = c.tm_min = c.tm_sec = tm_usec = 0;
                         continue;
                 }
@@ -1040,7 +1040,7 @@ static int find_next(const CalendarSpec *spec, struct tm *tm, usec_t *usec) {
                 if (r > 0)
                         c.tm_sec = tm_usec = 0;
                 if (r < 0 || tm_out_of_bounds(&c, spec->utc)) {
-                        c.tm_hour ++;
+                        c.tm_hour++;
                         c.tm_min = c.tm_sec = tm_usec = 0;
                         continue;
                 }
@@ -1051,7 +1051,7 @@ static int find_next(const CalendarSpec *spec, struct tm *tm, usec_t *usec) {
                 c.tm_sec /= USEC_PER_SEC;
 
                 if (r < 0 || tm_out_of_bounds(&c, spec->utc)) {
-                        c.tm_min ++;
+                        c.tm_min++;
                         c.tm_sec = tm_usec = 0;
                         continue;
                 }
index 6ef00d51df28e2da6d90fc5e7c5efe2fd120d412..56c1fcaab9b23a337da0f4f36ed0ec01c0a418ab 100644 (file)
@@ -1248,7 +1248,7 @@ int cg_pid_get_path_shifted(pid_t pid, const char *root, char **cgroup) {
         return 0;
 }
 
-int cg_path_decode_unit(const char *cgroup, char **unit){
+int cg_path_decode_unit(const char *cgroup, char **unit) {
         char *c, *s;
         size_t n;
 
index d2c030903b834443cc5f24d7bf2681f4a6349b27..a4d8d656dabcf889ee4972a2e9677791971215ee 100644 (file)
@@ -43,17 +43,6 @@ char* ether_addr_to_string(const struct ether_addr *addr, char buffer[ETHER_ADDR
         return buffer;
 }
 
-bool ether_addr_is_null(const struct ether_addr *addr) {
-        assert(addr);
-
-        return  addr->ether_addr_octet[0] == 0 &&
-                addr->ether_addr_octet[1] == 0 &&
-                addr->ether_addr_octet[2] == 0 &&
-                addr->ether_addr_octet[3] == 0 &&
-                addr->ether_addr_octet[4] == 0 &&
-                addr->ether_addr_octet[5] == 0;
-}
-
 bool ether_addr_equal(const struct ether_addr *a, const struct ether_addr *b) {
         assert(a);
         assert(b);
index 00c5159fe8a1755652ffdc6e144ff0cbabd4a753..074363793e78e467efc125258ec6995c1b58a86e 100644 (file)
 #define ETHER_ADDR_TO_STRING_MAX (3*6)
 char* ether_addr_to_string(const struct ether_addr *addr, char buffer[ETHER_ADDR_TO_STRING_MAX]);
 
-bool ether_addr_is_null(const struct ether_addr *addr);
 bool ether_addr_equal(const struct ether_addr *a, const struct ether_addr *b);
+
+#define ETHER_ADDR_NULL ((const struct ether_addr){})
+
+static inline bool ether_addr_is_null(const struct ether_addr *addr) {
+        return ether_addr_equal(addr, &ETHER_ADDR_NULL);
+}
index ee35d2a0ec9e177ce611fc0b05d7e32f60309033..d6c12284637604a4a052d68d3f9933a63ec88988 100644 (file)
@@ -63,12 +63,12 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra
                 if (!GREEDY_REALLOC(s, allocated, sz+1))
                         return -ENOMEM;
 
-        for (;; (*p) ++, c = **p) {
+        for (;; (*p)++, c = **p) {
                 if (c == 0)
                         goto finish_force_terminate;
                 else if (strchr(separators, c)) {
                         if (flags & EXTRACT_DONT_COALESCE_SEPARATORS) {
-                                (*p) ++;
+                                (*p)++;
                                 goto finish_force_next;
                         }
                 } else {
@@ -81,7 +81,7 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra
                 }
         }
 
-        for (;; (*p) ++, c = **p) {
+        for (;; (*p)++, c = **p) {
                 if (backslash) {
                         if (!GREEDY_REALLOC(s, allocated, sz+7))
                                 return -ENOMEM;
@@ -129,7 +129,7 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra
                         backslash = false;
 
                 } else if (quote) {     /* inside either single or double quotes */
-                        for (;; (*p) ++, c = **p) {
+                        for (;; (*p)++, c = **p) {
                                 if (c == 0) {
                                         if (flags & EXTRACT_RELAX)
                                                 goto finish_force_terminate;
@@ -149,7 +149,7 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra
                         }
 
                 } else {
-                        for (;; (*p) ++, c = **p) {
+                        for (;; (*p)++, c = **p) {
                                 if (c == 0)
                                         goto finish_force_terminate;
                                 else if ((c == '\'' || c == '"') && (flags & EXTRACT_QUOTES)) {
@@ -160,11 +160,11 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra
                                         break;
                                 } else if (strchr(separators, c)) {
                                         if (flags & EXTRACT_DONT_COALESCE_SEPARATORS) {
-                                                (*p) ++;
+                                                (*p)++;
                                                 goto finish_force_next;
                                         }
                                         /* Skip additional coalesced separators. */
-                                        for (;; (*p) ++, c = **p) {
+                                        for (;; (*p)++, c = **p) {
                                                 if (c == 0)
                                                         goto finish_force_terminate;
                                                 if (!strchr(separators, c))
index e43ca6d29e453aaa48ccc4085e050248a34e0bbf..2c454e8ea29a2d1169535d100a99c86630c8d1df 100644 (file)
@@ -352,7 +352,7 @@ static int parse_env_file_internal(
                 case KEY:
                         if (strchr(newline, c)) {
                                 state = PRE_KEY;
-                                line ++;
+                                line++;
                                 n_key = 0;
                         } else if (c == '=') {
                                 state = PRE_VALUE;
@@ -376,7 +376,7 @@ static int parse_env_file_internal(
                 case PRE_VALUE:
                         if (strchr(newline, c)) {
                                 state = PRE_KEY;
-                                line ++;
+                                line++;
                                 key[n_key] = 0;
 
                                 if (value)
@@ -416,7 +416,7 @@ static int parse_env_file_internal(
                 case VALUE:
                         if (strchr(newline, c)) {
                                 state = PRE_KEY;
-                                line ++;
+                                line++;
 
                                 key[n_key] = 0;
 
@@ -535,7 +535,7 @@ static int parse_env_file_internal(
                                 state = COMMENT_ESCAPE;
                         else if (strchr(newline, c)) {
                                 state = PRE_KEY;
-                                line ++;
+                                line++;
                         }
                         break;
 
@@ -908,7 +908,7 @@ int get_proc_field(const char *filename, const char *pattern, const char *termin
                 /* Back off one char if there's nothing but whitespace
                    and zeros */
                 if (!*t || isspace(*t))
-                        t --;
+                        t--;
         }
 
         len = strcspn(t, terminator);
index d7ad8d41f2ac1fefc206e1111ea53af3cf17ab5a..c5bda6c4d68db6b69f2ec8a5d996f3928045ee98 100644 (file)
@@ -276,8 +276,8 @@ int unbase32hexmem(const char *p, size_t l, bool padding, void **mem, size_t *_l
         if (padding) {
                 /* strip the padding */
                 while (l > 0 && p[l - 1] == '=' && pad < 7) {
-                        pad ++;
-                        l --;
+                        pad++;
+                        l--;
                 }
         }
 
@@ -505,7 +505,7 @@ int unbase64char(char c) {
         if (c == '+')
                 return offset;
 
-        offset ++;
+        offset++;
 
         if (c == '/')
                 return offset;
@@ -621,9 +621,9 @@ int unbase64mem(const char *p, size_t l, void **mem, size_t *_len) {
 
         /* strip the padding */
         if (l > 0 && p[l - 1] == '=')
-                l --;
+                l--;
         if (l > 0 && p[l - 1] == '=')
-                l --;
+                l--;
 
         /* a group of four input bytes needs three output bytes, in case of
            padding we need to add two or three extra bytes */
index f900c509a3bdaaa7e4e96f6f092892509f3fe23d..3cd2f2c8721699d0165dda91f329376364c790fa 100644 (file)
@@ -48,8 +48,9 @@ bool hostname_is_set(void) {
 char* gethostname_malloc(void) {
         struct utsname u;
 
-        /* This call tries to return something useful, either the actual hostname or it makes something up. The only
-         * reason it might mail is OOM. It might even return "localhost" if that's set. */
+        /* This call tries to return something useful, either the actual hostname
+         * or it makes something up. The only reason it might fail is OOM.
+         * It might even return "localhost" if that's set. */
 
         assert_se(uname(&u) >= 0);
 
@@ -123,7 +124,7 @@ bool hostname_is_valid(const char *s, bool allow_trailing_dot) {
                                 return false;
 
                         dot = true;
-                        n_dots ++;
+                        n_dots++;
                 } else {
                         if (!hostname_valid_char(*p))
                                 return false;
index 3ec8d61236922cb036ed30c7550c893ba7c0f586..0037a37f2a458151bb62d1ec77202ac64bb76c92 100644 (file)
@@ -249,7 +249,7 @@ ssize_t sparse_write(int fd, const void *p, size_t sz, size_t run_length) {
                 } else if (n > 0)
                         q += n;
                 else
-                        q ++;
+                        q++;
         }
 
         if (q > w) {
index 142c940d92692f6a2257aeba0f5786f039e483d2..4684ed3bfc782919b71600521ba7a66f4b04043d 100644 (file)
@@ -46,7 +46,7 @@ ssize_t sparse_write(int fd, const void *p, size_t sz, size_t run_length);
                 char *_s = (char *)(s);         \
                 _i->iov_base = _s;              \
                 _i->iov_len = strlen(_s);       \
-        } while(false)
+        } while (false)
 
 static inline size_t IOVEC_TOTAL_SIZE(const struct iovec *i, unsigned n) {
         unsigned j;
index c68185f5878eaad93d4abba7bb9a1a6107d424cd..5962aa42113b5d425cd181241a7f17da9ef43439 100644 (file)
@@ -32,7 +32,7 @@
 #define LIST_HEAD_INIT(head)                                            \
         do {                                                            \
                 (head) = NULL; }                                        \
-        while(false)
+        while (false)
 
 /* Initialize a list item */
 #define LIST_INIT(name,item)                                            \
@@ -40,7 +40,7 @@
                 typeof(*(item)) *_item = (item);                        \
                 assert(_item);                                          \
                 _item->name##_prev = _item->name##_next = NULL;         \
-        } while(false)
+        } while (false)
 
 /* Prepend an item to the list */
 #define LIST_PREPEND(name,head,item)                                    \
@@ -51,7 +51,7 @@
                         _item->name##_next->name##_prev = _item;        \
                 _item->name##_prev = NULL;                              \
                 *_head = _item;                                         \
-        } while(false)
+        } while (false)
 
 /* Append an item to the list */
 #define LIST_APPEND(name,head,item)                                     \
@@ -59,7 +59,7 @@
                 typeof(*(head)) *_tail;                                 \
                 LIST_FIND_TAIL(name,head,_tail);                        \
                 LIST_INSERT_AFTER(name,head,_tail,item);                \
-        } while(false)
+        } while (false)
 
 /* Remove an item from the list */
 #define LIST_REMOVE(name,head,item)                                     \
@@ -75,7 +75,7 @@
                         *_head = _item->name##_next;                    \
                 }                                                       \
                 _item->name##_next = _item->name##_prev = NULL;         \
-        } while(false)
+        } while (false)
 
 /* Find the head of the list */
 #define LIST_FIND_HEAD(name,item,head)                                  \
                         _b->name##_prev = _a;                           \
                         _a->name##_next = _b;                           \
                 }                                                       \
-        } while(false)
+        } while (false)
 
 /* Insert an item before another one (a = where, b = what) */
 #define LIST_INSERT_BEFORE(name,head,a,b)                               \
                         _b->name##_next = _a;                           \
                         _a->name##_prev = _b;                           \
                 }                                                       \
-        } while(false)
+        } while (false)
 
 #define LIST_JUST_US(name,item)                                         \
         (!(item)->name##_prev && !(item)->name##_next)                  \
index 60ddead74cfad0082c2759fb80d259f6f5c8a56f..f9fb1742a1edb65b318d30524e36abf67aa2bab4 100644 (file)
@@ -193,7 +193,7 @@ void log_assert_failed_return(
 #ifdef LOG_TRACE
 #  define log_trace(...) log_debug(__VA_ARGS__)
 #else
-#  define log_trace(...) do {} while(0)
+#  define log_trace(...) do {} while (0)
 #endif
 
 /* Structured logging */
index 2695d0edb75ba436e645fc1f32786dde78e22bbd..ddf0968d1b07be99a2c755776d08e20d70cc3039 100644 (file)
@@ -224,7 +224,7 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
 /* We override the glibc assert() here. */
 #undef assert
 #ifdef NDEBUG
-#define assert(expr) do {} while(false)
+#define assert(expr) do {} while (false)
 #else
 #define assert(expr) assert_message_se(expr, #expr)
 #endif
index a3cb81b040f09a5c29304821ca845dd09e70d44e..6c11b605a99854f931ab9b8e967fd8c556330760 100644 (file)
@@ -505,7 +505,7 @@ int parse_fractional_part_u(const char **p, size_t digits, unsigned *res) {
         s = *p;
 
         /* accept any number of digits, strtoull is limted to 19 */
-        for(i=0; i < digits; i++,s++) {
+        for (i=0; i < digits; i++,s++) {
                 if (*s < '0' || *s > '9') {
                         if (i == 0)
                                 return -EINVAL;
index 72b10e8712ce89b128a78eb48da6aab064a021a3..a7322ff26a9e4fa03bae9d655e6bba23f5bad6f7 100644 (file)
@@ -44,9 +44,9 @@ static inline void block_signals_reset(sigset_t *ss) {
         assert_se(sigprocmask(SIG_SETMASK, ss, NULL) >= 0);
 }
 
-#define BLOCK_SIGNALS(...)                                              \
-        _cleanup_(block_signals_reset) sigset_t _saved_sigset = ({      \
-                sigset_t t;                                             \
+#define BLOCK_SIGNALS(...)                                                        \
+        _cleanup_(block_signals_reset) _unused_ sigset_t _saved_sigset = ({       \
+                sigset_t t;                                                       \
                 assert_se(sigprocmask_many(SIG_BLOCK, &t, __VA_ARGS__, -1) >= 0); \
-                t;                                                      \
+                t;                                                                \
         })
index 58512686e3144b9fa81738f72f820d93f7ebaddb..0f38f9a0f3a563264953fbb19e9efa3407bb8b1b 100644 (file)
@@ -942,7 +942,7 @@ ssize_t next_datagram_size_fd(int fd) {
         int k;
 
         /* This is a bit like FIONREAD/SIOCINQ, however a bit more powerful. The difference being: recv(MSG_PEEK) will
-         * actually cause the next datagram in the queue to be validated regarding checksums, which FIONREAD dosn't
+         * actually cause the next datagram in the queue to be validated regarding checksums, which FIONREAD doesn't
          * do. This difference is actually of major importance as we need to be sure that the size returned here
          * actually matches what we will read with recvmsg() next, as otherwise we might end up allocating a buffer of
          * the wrong size. */
index 0a675571ff6c7c238153b591264bb6c0d5d92d98..bd1144b4c9f5610b608fcf7078a3e31cf9673306 100644 (file)
@@ -73,4 +73,4 @@ do {                                                                    \
                         assert_not_reached("Unknown format string argument."); \
                 }                                                       \
         }                                                               \
-} while(false)
+} while (false)
index dac288160392adf755f765cddb81251c427fe792..797f00cf7165f52485d659f2f80c23eaa49c6e4c 100644 (file)
@@ -121,7 +121,7 @@ static void bubbleinsert(struct strbuf_node *node,
                 sizeof(struct strbuf_child_entry) * (node->children_count - left));
         node->children[left] = new;
 
-        node->children_count ++;
+        node->children_count++;
 }
 
 /* add string, return the index/offset into the buffer */
index 0bde55f9d5749a29e2e7b4e133cfb6d2ecb7543a..293a15f9c041cf59f5354829cfdc86b0b0622a20 100644 (file)
@@ -477,7 +477,7 @@ char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigne
         }
 
         if (k > x) /* last character was wide and went over quota */
-                x ++;
+                x++;
 
         for (j = s + old_length; k < new_length && j > i; ) {
                 char32_t c;
index 9bfd8f4f7a4d1dff8c146bc15b4af7fb3c307954..7ca764abeb0bda412a9c27b05c0fdbad98d4426a 100644 (file)
@@ -576,12 +576,12 @@ int parse_timestamp(const char *t, usec_t *usec) {
                 goto from_tm;
 
         } else if (streq(t, "yesterday")) {
-                tm.tm_mday --;
+                tm.tm_mday--;
                 tm.tm_sec = tm.tm_min = tm.tm_hour = 0;
                 goto from_tm;
 
         } else if (streq(t, "tomorrow")) {
-                tm.tm_mday ++;
+                tm.tm_mday++;
                 tm.tm_sec = tm.tm_min = tm.tm_hour = 0;
                 goto from_tm;
         }
index 629db123cdda8a8e5a1408ce2d9ce935ae260ee1..6eae2b983d8dfd7943c479be9918d8539fd538fd 100644 (file)
@@ -241,7 +241,7 @@ char *utf8_escape_non_printable(const char *str) {
                                         *(s++) = hexchar((int) *str);
 
                                         str += 1;
-                                        len --;
+                                        len--;
                                 }
                         }
                 } else {
index 79387007f0a30ae340d536287fb4e79c5c39aa52..e6c5a095a04205847f6a81f1fde48db34f1e2075 100644 (file)
@@ -98,6 +98,8 @@ static int detect_vm_cpuid(void) {
                         : "0" (eax)
                 );
 
+                log_debug("Virtualization found, CPUID=%s", sig.text);
+
                 for (j = 0; j < ELEMENTSOF(cpuid_vendor_table); j ++)
                         if (streq(sig.text, cpuid_vendor_table[j].cpuid))
                                 return cpuid_vendor_table[j].id;
@@ -105,6 +107,7 @@ static int detect_vm_cpuid(void) {
                 return VIRTUALIZATION_VM_OTHER;
         }
 #endif
+        log_debug("No virtualization found in CPUID");
 
         return VIRTUALIZATION_NONE;
 }
@@ -121,19 +124,25 @@ static int detect_vm_device_tree(void) {
 
                 dir = opendir("/proc/device-tree");
                 if (!dir) {
-                        if (errno == ENOENT)
+                        if (errno == ENOENT) {
+                                log_debug_errno(errno, "/proc/device-tree: %m");
                                 return VIRTUALIZATION_NONE;
+                        }
                         return -errno;
                 }
 
                 FOREACH_DIRENT(dent, dir, return -errno)
-                        if (strstr(dent->d_name, "fw-cfg"))
+                        if (strstr(dent->d_name, "fw-cfg")) {
+                                log_debug("Virtualization QEMU: \"fw-cfg\" present in /proc/device-tree/%s", dent->d_name);
                                 return VIRTUALIZATION_QEMU;
+                        }
 
+                log_debug("No virtualization found in /proc/device-tree/*");
                 return VIRTUALIZATION_NONE;
         } else if (r < 0)
                 return r;
 
+        log_debug("Virtualization %s found in /proc/device-tree/hypervisor/compatible", hvtype);
         if (streq(hvtype, "linux,kvm"))
                 return VIRTUALIZATION_KVM;
         else if (strstr(hvtype, "xen"))
@@ -141,6 +150,7 @@ static int detect_vm_device_tree(void) {
         else
                 return VIRTUALIZATION_VM_OTHER;
 #else
+        log_debug("This platform does not support /proc/device-tree");
         return VIRTUALIZATION_NONE;
 #endif
 }
@@ -184,23 +194,44 @@ static int detect_vm_dmi(void) {
                         return r;
                 }
 
+
+
                 for (j = 0; j < ELEMENTSOF(dmi_vendor_table); j++)
-                        if (startswith(s, dmi_vendor_table[j].vendor))
+                        if (startswith(s, dmi_vendor_table[j].vendor)) {
+                                log_debug("Virtualization %s found in DMI (%s)", s, dmi_vendors[i]);
                                 return dmi_vendor_table[j].id;
+                        }
         }
 #endif
 
+        log_debug("No virtualization found in DMI");
+
         return VIRTUALIZATION_NONE;
 }
 
 static int detect_vm_xen(void) {
+        /* Check for Dom0 will be executed later in detect_vm_xen_dom0
+           Thats why we dont check the content of /proc/xen/capabilities here. */
+        if (access("/proc/xen/capabilities", F_OK) < 0) {
+                log_debug("Virtualization XEN not found, /proc/xen/capabilities does not exist");
+                return VIRTUALIZATION_NONE;
+        }
+
+        log_debug("Virtualization XEN found (/proc/xen/capabilities exists)");
+        return  VIRTUALIZATION_XEN;
+
+}
+
+static bool detect_vm_xen_dom0(void) {
         _cleanup_free_ char *domcap = NULL;
         char *cap, *i;
         int r;
 
         r = read_one_line_file("/proc/xen/capabilities", &domcap);
-        if (r == -ENOENT)
-                return VIRTUALIZATION_NONE;
+        if (r == -ENOENT) {
+                log_debug("Virtualization XEN not found, /proc/xen/capabilities does not exist");
+                return false;
+        }
         if (r < 0)
                 return r;
 
@@ -208,8 +239,13 @@ static int detect_vm_xen(void) {
         while ((cap = strsep(&i, ",")))
                 if (streq(cap, "control_d"))
                         break;
+        if (!cap) {
+                log_debug("Virtualization XEN DomU found (/proc/xen/capabilites)");
+                return false;
+        }
 
-        return cap ? VIRTUALIZATION_NONE : VIRTUALIZATION_XEN;
+        log_debug("Virtualization XEN Dom0 ignored (/proc/xen/capabilities)");
+        return true;
 }
 
 static int detect_vm_hypervisor(void) {
@@ -222,6 +258,8 @@ static int detect_vm_hypervisor(void) {
         if (r < 0)
                 return r;
 
+        log_debug("Virtualization %s found in /sys/hypervisor/type", hvtype);
+
         if (streq(hvtype, "xen"))
                 return VIRTUALIZATION_XEN;
         else
@@ -236,9 +274,13 @@ static int detect_vm_uml(void) {
         r = read_full_file("/proc/cpuinfo", &cpuinfo_contents, NULL);
         if (r < 0)
                 return r;
-        if (strstr(cpuinfo_contents, "\nvendor_id\t: User Mode Linux\n"))
+
+        if (strstr(cpuinfo_contents, "\nvendor_id\t: User Mode Linux\n")) {
+                log_debug("UML virtualization found in /proc/cpuinfo");
                 return VIRTUALIZATION_UML;
+        }
 
+        log_debug("No virtualization found in /proc/cpuinfo (%s)", cpuinfo_contents);
         return VIRTUALIZATION_NONE;
 }
 
@@ -254,11 +296,13 @@ static int detect_vm_zvm(void) {
         if (r < 0)
                 return r;
 
+        log_debug("Virtualization %s found in /proc/sysinfo", t);
         if (streq(t, "z/VM"))
                 return VIRTUALIZATION_ZVM;
         else
                 return VIRTUALIZATION_KVM;
 #else
+        log_debug("This platform does not support /proc/sysinfo");
         return VIRTUALIZATION_NONE;
 #endif
 }
@@ -326,7 +370,14 @@ int detect_vm(void) {
                 return r;
 
 finish:
+        /* x86 xen Dom0 is detected as XEN in hypervisor and maybe others.
+         * In order to detect the Dom0 as not virtualization we need to
+         * double-check it */
+        if (r == VIRTUALIZATION_XEN && detect_vm_xen_dom0())
+                r = VIRTUALIZATION_NONE;
+
         cached_found = r;
+        log_debug("Found VM virtualization %s", virtualization_to_string(r));
         return r;
 }
 
@@ -414,6 +465,7 @@ int detect_container(void) {
         r = VIRTUALIZATION_CONTAINER_OTHER;
 
 finish:
+        log_debug("Found container virtualization %s", virtualization_to_string(r));
         cached_found = r;
         return r;
 }
@@ -422,10 +474,10 @@ int detect_virtualization(void) {
         int r;
 
         r = detect_container();
-        if (r != 0)
-                return r;
+        if (r == 0)
+                r = detect_vm();
 
-        return detect_vm();
+        return r;
 }
 
 int running_in_chroot(void) {
index b1cc2c0b729d07b58d1b86dc19f00a08576a13ea..c0ef7f64fecdfb737e9dc26af3355a76878556c4 100644 (file)
@@ -281,9 +281,9 @@ EFI_STATUS graphics_splash(UINT8 *content, UINTN len, const EFI_GRAPHICS_OUTPUT_
         if (EFI_ERROR(err))
                 goto err;
 
-        if(dib->x < GraphicsOutput->Mode->Info->HorizontalResolution)
+        if (dib->x < GraphicsOutput->Mode->Info->HorizontalResolution)
                 x_pos = (GraphicsOutput->Mode->Info->HorizontalResolution - dib->x) / 2;
-        if(dib->y < GraphicsOutput->Mode->Info->VerticalResolution)
+        if (dib->y < GraphicsOutput->Mode->Info->VerticalResolution)
                 y_pos = (GraphicsOutput->Mode->Info->VerticalResolution - dib->y) / 2;
 
         uefi_call_wrapper(GraphicsOutput->Blt, 10, GraphicsOutput,
diff --git a/src/bootchart/Makefile b/src/bootchart/Makefile
deleted file mode 120000 (symlink)
index d0b0e8e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../Makefile
\ No newline at end of file
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
deleted file mode 100644 (file)
index 77d158f..0000000
+++ /dev/null
@@ -1,531 +0,0 @@
-/***
-  This file is part of systemd.
-
-  Copyright (C) 2009-2013 Intel Corporation
-
-  Authors:
-    Auke Kok <auke-jan.h.kok@intel.com>
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
- ***/
-
-/***
-
-  Many thanks to those who contributed ideas and code:
-  - Ziga Mahkovec - Original bootchart author
-  - Anders Norgaard - PyBootchartgui
-  - Michael Meeks - bootchart2
-  - Scott James Remnant - Ubuntu C-based logger
-  - Arjan van der Ven - for the idea to merge bootgraph.pl functionality
-
- ***/
-
-#include <errno.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <limits.h>
-#include <signal.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/resource.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "sd-journal.h"
-
-#include "alloc-util.h"
-#include "bootchart.h"
-#include "conf-parser.h"
-#include "def.h"
-#include "fd-util.h"
-#include "fileio.h"
-#include "io-util.h"
-#include "list.h"
-#include "macro.h"
-#include "parse-util.h"
-#include "path-util.h"
-#include "store.h"
-#include "string-util.h"
-#include "strxcpyx.h"
-#include "svg.h"
-#include "util.h"
-
-static int exiting = 0;
-
-#define DEFAULT_SAMPLES_LEN 500
-#define DEFAULT_HZ 25.0
-#define DEFAULT_SCALE_X 100.0 /* 100px = 1sec */
-#define DEFAULT_SCALE_Y 20.0  /* 16px = 1 process bar */
-#define DEFAULT_INIT ROOTLIBEXECDIR "/systemd"
-#define DEFAULT_OUTPUT "/run/log"
-
-/* graph defaults */
-bool arg_entropy = false;
-bool arg_initcall = true;
-bool arg_relative = false;
-bool arg_filter = true;
-bool arg_show_cmdline = false;
-bool arg_show_cgroup = false;
-bool arg_pss = false;
-bool arg_percpu = false;
-int arg_samples_len = DEFAULT_SAMPLES_LEN; /* we record len+1 (1 start sample) */
-double arg_hz = DEFAULT_HZ;
-double arg_scale_x = DEFAULT_SCALE_X;
-double arg_scale_y = DEFAULT_SCALE_Y;
-
-char arg_init_path[PATH_MAX] = DEFAULT_INIT;
-char arg_output_path[PATH_MAX] = DEFAULT_OUTPUT;
-
-static void signal_handler(int sig) {
-        exiting = 1;
-}
-
-#define BOOTCHART_MAX (16*1024*1024)
-
-static void parse_conf(void) {
-        char *init = NULL, *output = NULL;
-        const ConfigTableItem items[] = {
-                { "Bootchart", "Samples",          config_parse_int,    0, &arg_samples_len },
-                { "Bootchart", "Frequency",        config_parse_double, 0, &arg_hz          },
-                { "Bootchart", "Relative",         config_parse_bool,   0, &arg_relative    },
-                { "Bootchart", "Filter",           config_parse_bool,   0, &arg_filter      },
-                { "Bootchart", "Output",           config_parse_path,   0, &output          },
-                { "Bootchart", "Init",             config_parse_path,   0, &init            },
-                { "Bootchart", "PlotMemoryUsage",  config_parse_bool,   0, &arg_pss         },
-                { "Bootchart", "PlotEntropyGraph", config_parse_bool,   0, &arg_entropy     },
-                { "Bootchart", "ScaleX",           config_parse_double, 0, &arg_scale_x     },
-                { "Bootchart", "ScaleY",           config_parse_double, 0, &arg_scale_y     },
-                { "Bootchart", "ControlGroup",     config_parse_bool,   0, &arg_show_cgroup },
-                { "Bootchart", "PerCPU",           config_parse_bool,   0, &arg_percpu      },
-                { NULL, NULL, NULL, 0, NULL }
-        };
-
-        config_parse_many(PKGSYSCONFDIR "/bootchart.conf",
-                          CONF_PATHS_NULSTR("systemd/bootchart.conf.d"),
-                          NULL, config_item_table_lookup, items, true, NULL);
-
-        if (init != NULL)
-                strscpy(arg_init_path, sizeof(arg_init_path), init);
-        if (output != NULL)
-                strscpy(arg_output_path, sizeof(arg_output_path), output);
-}
-
-static void help(void) {
-        printf("Usage: %s [OPTIONS]\n\n"
-               "Options:\n"
-               "  -r --rel             Record time relative to recording\n"
-               "  -f --freq=FREQ       Sample frequency [%g]\n"
-               "  -n --samples=N       Stop sampling at [%d] samples\n"
-               "  -x --scale-x=N       Scale the graph horizontally [%g] \n"
-               "  -y --scale-y=N       Scale the graph vertically [%g] \n"
-               "  -p --pss             Enable PSS graph (CPU intensive)\n"
-               "  -e --entropy         Enable the entropy_avail graph\n"
-               "  -o --output=PATH     Path to output files [%s]\n"
-               "  -i --init=PATH       Path to init executable [%s]\n"
-               "  -F --no-filter       Disable filtering of unimportant or ephemeral processes\n"
-               "  -C --cmdline         Display full command lines with arguments\n"
-               "  -c --control-group   Display process control group\n"
-               "     --per-cpu         Draw each CPU utilization and wait bar also\n"
-               "  -h --help            Display this message\n\n"
-               "See bootchart.conf for more information.\n",
-               program_invocation_short_name,
-               DEFAULT_HZ,
-               DEFAULT_SAMPLES_LEN,
-               DEFAULT_SCALE_X,
-               DEFAULT_SCALE_Y,
-               DEFAULT_OUTPUT,
-               DEFAULT_INIT);
-}
-
-static int parse_argv(int argc, char *argv[]) {
-
-        enum {
-                ARG_PERCPU = 0x100,
-        };
-
-        static const struct option options[] = {
-                {"rel",           no_argument,        NULL,  'r'       },
-                {"freq",          required_argument,  NULL,  'f'       },
-                {"samples",       required_argument,  NULL,  'n'       },
-                {"pss",           no_argument,        NULL,  'p'       },
-                {"output",        required_argument,  NULL,  'o'       },
-                {"init",          required_argument,  NULL,  'i'       },
-                {"no-filter",     no_argument,        NULL,  'F'       },
-                {"cmdline",       no_argument,        NULL,  'C'       },
-                {"control-group", no_argument,        NULL,  'c'       },
-                {"help",          no_argument,        NULL,  'h'       },
-                {"scale-x",       required_argument,  NULL,  'x'       },
-                {"scale-y",       required_argument,  NULL,  'y'       },
-                {"entropy",       no_argument,        NULL,  'e'       },
-                {"per-cpu",       no_argument,        NULL,  ARG_PERCPU},
-                {}
-        };
-        int c, r;
-
-        if (getpid() == 1)
-                opterr = 0;
-
-        while ((c = getopt_long(argc, argv, "erpf:n:o:i:FCchx:y:", options, NULL)) >= 0)
-                switch (c) {
-
-                case 'r':
-                        arg_relative = true;
-                        break;
-                case 'f':
-                        r = safe_atod(optarg, &arg_hz);
-                        if (r < 0)
-                                log_warning_errno(r, "failed to parse --freq/-f argument '%s': %m",
-                                                  optarg);
-                        break;
-                case 'F':
-                        arg_filter = false;
-                        break;
-                case 'C':
-                        arg_show_cmdline = true;
-                        break;
-                case 'c':
-                        arg_show_cgroup = true;
-                        break;
-                case 'n':
-                        r = safe_atoi(optarg, &arg_samples_len);
-                        if (r < 0)
-                                log_warning_errno(r, "failed to parse --samples/-n argument '%s': %m",
-                                                  optarg);
-                        break;
-                case 'o':
-                        path_kill_slashes(optarg);
-                        strscpy(arg_output_path, sizeof(arg_output_path), optarg);
-                        break;
-                case 'i':
-                        path_kill_slashes(optarg);
-                        strscpy(arg_init_path, sizeof(arg_init_path), optarg);
-                        break;
-                case 'p':
-                        arg_pss = true;
-                        break;
-                case 'x':
-                        r = safe_atod(optarg, &arg_scale_x);
-                        if (r < 0)
-                                log_warning_errno(r, "failed to parse --scale-x/-x argument '%s': %m",
-                                                  optarg);
-                        break;
-                case 'y':
-                        r = safe_atod(optarg, &arg_scale_y);
-                        if (r < 0)
-                                log_warning_errno(r, "failed to parse --scale-y/-y argument '%s': %m",
-                                                  optarg);
-                        break;
-                case 'e':
-                        arg_entropy = true;
-                        break;
-                case ARG_PERCPU:
-                        arg_percpu = true;
-                        break;
-                case 'h':
-                        help();
-                        return 0;
-                case '?':
-                        if (getpid() != 1)
-                                return -EINVAL;
-                        else
-                                return 0;
-                default:
-                        assert_not_reached("Unhandled option code.");
-                }
-
-        if (arg_hz <= 0) {
-                log_error("Frequency needs to be > 0");
-                return -EINVAL;
-        }
-
-        return 1;
-}
-
-static int do_journal_append(char *file) {
-        _cleanup_free_ char *bootchart_message = NULL;
-        _cleanup_free_ char *bootchart_file = NULL;
-        _cleanup_free_ char *p = NULL;
-        _cleanup_close_ int fd = -1;
-        struct iovec iovec[5];
-        int r, j = 0;
-        ssize_t n;
-
-        bootchart_file = strappend("BOOTCHART_FILE=", file);
-        if (!bootchart_file)
-                return log_oom();
-
-        IOVEC_SET_STRING(iovec[j++], bootchart_file);
-        IOVEC_SET_STRING(iovec[j++], "MESSAGE_ID=9f26aa562cf440c2b16c773d0479b518");
-        IOVEC_SET_STRING(iovec[j++], "PRIORITY=7");
-        bootchart_message = strjoin("MESSAGE=Bootchart created: ", file, NULL);
-        if (!bootchart_message)
-                return log_oom();
-
-        IOVEC_SET_STRING(iovec[j++], bootchart_message);
-
-        p = malloc(10 + BOOTCHART_MAX);
-        if (!p)
-                return log_oom();
-
-        memcpy(p, "BOOTCHART=", 10);
-
-        fd = open(file, O_RDONLY|O_CLOEXEC);
-        if (fd < 0)
-                return log_error_errno(errno, "Failed to open bootchart data \"%s\": %m", file);
-
-        n = loop_read(fd, p + 10, BOOTCHART_MAX, false);
-        if (n < 0)
-                return log_error_errno(n, "Failed to read bootchart data: %m");
-
-        iovec[j].iov_base = p;
-        iovec[j].iov_len = 10 + n;
-        j++;
-
-        r = sd_journal_sendv(iovec, j);
-        if (r < 0)
-                log_error_errno(r, "Failed to send bootchart: %m");
-
-        return 0;
-}
-
-int main(int argc, char *argv[]) {
-        static struct list_sample_data *sampledata;
-        _cleanup_closedir_ DIR *proc = NULL;
-        _cleanup_free_ char *build = NULL;
-        _cleanup_fclose_ FILE *of = NULL;
-        _cleanup_close_ int sysfd = -1;
-        struct ps_struct *ps_first;
-        double graph_start;
-        double log_start;
-        double interval;
-        char output_file[PATH_MAX];
-        char datestr[200];
-        int pscount = 0;
-        int n_cpus = 0;
-        int overrun = 0;
-        time_t t = 0;
-        int r, samples;
-        struct ps_struct *ps;
-        struct rlimit rlim;
-        struct list_sample_data *head;
-        struct sigaction sig = {
-                .sa_handler = signal_handler,
-        };
-
-        parse_conf();
-
-        r = parse_argv(argc, argv);
-        if (r < 0)
-                return EXIT_FAILURE;
-
-        if (r == 0)
-                return EXIT_SUCCESS;
-
-        /*
-         * If the kernel executed us through init=/usr/lib/systemd/systemd-bootchart, then
-         * fork:
-         * - parent execs executable specified via init_path[] (/usr/lib/systemd/systemd by default) as pid=1
-         * - child logs data
-         */
-        if (getpid() == 1) {
-                if (fork())
-                        /* parent */
-                        execl(arg_init_path, arg_init_path, NULL);
-        }
-        argv[0][0] = '@';
-
-        rlim.rlim_cur = 4096;
-        rlim.rlim_max = 4096;
-        (void) setrlimit(RLIMIT_NOFILE, &rlim);
-
-        /* start with empty ps LL */
-        ps_first = new0(struct ps_struct, 1);
-        if (!ps_first) {
-                log_oom();
-                return EXIT_FAILURE;
-        }
-
-        /* handle TERM/INT nicely */
-        sigaction(SIGHUP, &sig, NULL);
-
-        interval = (1.0 / arg_hz) * 1000000000.0;
-
-        if (arg_relative)
-                graph_start = log_start = gettime_ns();
-        else {
-                struct timespec n;
-                double uptime;
-
-                clock_gettime(clock_boottime_or_monotonic(), &n);
-                uptime = (n.tv_sec + (n.tv_nsec / (double) NSEC_PER_SEC));
-
-                log_start = gettime_ns();
-                graph_start = log_start - uptime;
-        }
-
-        if (graph_start < 0.0) {
-                log_error("Failed to setup graph start time.\n\n"
-                          "The system uptime probably includes time that the system was suspended. "
-                          "Use --rel to bypass this issue.");
-                return EXIT_FAILURE;
-        }
-
-        LIST_HEAD_INIT(head);
-
-        /* main program loop */
-        for (samples = 0; !exiting && samples < arg_samples_len; samples++) {
-                int res;
-                double sample_stop;
-                double elapsed;
-                double timeleft;
-
-                sampledata = new0(struct list_sample_data, 1);
-                if (sampledata == NULL) {
-                        log_oom();
-                        return EXIT_FAILURE;
-                }
-
-                sampledata->sampletime = gettime_ns();
-                sampledata->counter = samples;
-
-                if (sysfd < 0)
-                        sysfd = open("/sys", O_RDONLY|O_CLOEXEC);
-
-                if (!build) {
-                        if (parse_env_file("/etc/os-release", NEWLINE, "PRETTY_NAME", &build, NULL) == -ENOENT)
-                                parse_env_file("/usr/lib/os-release", NEWLINE, "PRETTY_NAME", &build, NULL);
-                }
-
-                if (proc)
-                        rewinddir(proc);
-                else
-                        proc = opendir("/proc");
-
-                /* wait for /proc to become available, discarding samples */
-                if (proc) {
-                        r = log_sample(proc, samples, ps_first, &sampledata, &pscount, &n_cpus);
-                        if (r < 0)
-                                return EXIT_FAILURE;
-                }
-
-                sample_stop = gettime_ns();
-
-                elapsed = (sample_stop - sampledata->sampletime) * 1000000000.0;
-                timeleft = interval - elapsed;
-
-                /*
-                 * check if we have not consumed our entire timeslice. If we
-                 * do, don't sleep and take a new sample right away.
-                 * we'll lose all the missed samples and overrun our total
-                 * time
-                 */
-                if (timeleft > 0) {
-                        struct timespec req;
-
-                        req.tv_sec = (time_t)(timeleft / 1000000000.0);
-                        req.tv_nsec = (long)(timeleft - (req.tv_sec * 1000000000.0));
-
-                        res = nanosleep(&req, NULL);
-                        if (res) {
-                                if (errno == EINTR)
-                                        /* caught signal, probably HUP! */
-                                        break;
-                                log_error_errno(errno, "nanosleep() failed: %m");
-                                return EXIT_FAILURE;
-                        }
-                } else {
-                        overrun++;
-                        /* calculate how many samples we lost and scrap them */
-                        arg_samples_len -= (int)(-timeleft / interval);
-                }
-                LIST_PREPEND(link, head, sampledata);
-        }
-
-        /* do some cleanup, close fd's */
-        ps = ps_first;
-        while (ps->next_ps) {
-                ps = ps->next_ps;
-                ps->schedstat = safe_close(ps->schedstat);
-                ps->sched = safe_close(ps->sched);
-                ps->smaps = safe_fclose(ps->smaps);
-        }
-
-        if (!of) {
-                t = time(NULL);
-                r = strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t));
-                assert_se(r > 0);
-
-                snprintf(output_file, PATH_MAX, "%s/bootchart-%s.svg", arg_output_path, datestr);
-                of = fopen(output_file, "we");
-        }
-
-        if (!of) {
-                log_error("Error opening output file '%s': %m\n", output_file);
-                return EXIT_FAILURE;
-        }
-
-        r = svg_do(of, strna(build), head, ps_first,
-                   samples, pscount, n_cpus, graph_start,
-                   log_start, interval, overrun);
-
-        if (r < 0) {
-                log_error_errno(r, "Error generating svg file: %m");
-                return EXIT_FAILURE;
-        }
-
-        log_info("systemd-bootchart wrote %s\n", output_file);
-
-        r = do_journal_append(output_file);
-        if (r < 0)
-                return EXIT_FAILURE;
-
-        /* nitpic cleanups */
-        ps = ps_first->next_ps;
-        while (ps->next_ps) {
-                struct ps_struct *old;
-
-                old = ps;
-                old->sample = ps->first;
-                ps = ps->next_ps;
-                while (old->sample->next) {
-                        struct ps_sched_struct *oldsample = old->sample;
-
-                        old->sample = old->sample->next;
-                        free(oldsample);
-                }
-                free(old->cgroup);
-                free(old->sample);
-                free(old);
-        }
-
-        free(ps->cgroup);
-        free(ps->sample);
-        free(ps);
-
-        sampledata = head;
-        while (sampledata->link_prev) {
-                struct list_sample_data *old_sampledata = sampledata;
-                sampledata = sampledata->link_prev;
-                free(old_sampledata);
-        }
-        free(sampledata);
-
-        /* don't complain when overrun once, happens most commonly on 1st sample */
-        if (overrun > 1)
-                log_warning("systemd-bootchart: sample time overrun %i times\n", overrun);
-
-        return 0;
-}
diff --git a/src/bootchart/bootchart.conf b/src/bootchart/bootchart.conf
deleted file mode 100644 (file)
index 4f5e509..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-#
-# Entries in this file show the compile time defaults.
-# You can change settings by editing this file.
-# Defaults can be restored by simply deleting this file.
-#
-# See bootchart.conf(5) for details.
-
-[Bootchart]
-#Samples=500
-#Frequency=25
-#Relative=no
-#Filter=yes
-#Output=<folder name, defaults to /run/log>
-#Init=/path/to/init-binary
-#PlotMemoryUsage=no
-#PlotEntropyGraph=no
-#ScaleX=100
-#ScaleY=20
-#ControlGroup=no
-#PerCPU=no
diff --git a/src/bootchart/bootchart.h b/src/bootchart/bootchart.h
deleted file mode 100644 (file)
index 1b445b9..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-#pragma once
-
-/***
-  This file is part of systemd.
-
-  Copyright (C) 2009-2013 Intel Corporation
-
-  Authors:
-    Auke Kok <auke-jan.h.kok@intel.com>
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  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 <stdbool.h>
-
-#include "list.h"
-
-#define MAXCPUS        16
-#define MAXPIDS     65535
-
-struct block_stat_struct {
-        /* /proc/vmstat pgpgin & pgpgout */
-        int bi;
-        int bo;
-};
-
-struct cpu_stat_sample_struct {
-        /* /proc/schedstat fields 10 & 11 (after name) */
-        double runtime;
-        double waittime;
-};
-
-/* per process, per sample data we will log */
-struct ps_sched_struct {
-        /* /proc/<n>/schedstat fields 1 & 2 */
-        double runtime;
-        double waittime;
-        int pss;
-        struct list_sample_data *sampledata;
-        struct ps_sched_struct *next;
-        struct ps_sched_struct *prev;
-        struct ps_sched_struct *cross; /* cross pointer */
-        struct ps_struct *ps_new;
-};
-
-struct list_sample_data {
-        double runtime[MAXCPUS];
-        double waittime[MAXCPUS];
-        double sampletime;
-        int entropy_avail;
-        struct block_stat_struct blockstat;
-        LIST_FIELDS(struct list_sample_data, link); /* DLL */
-        int counter;
-};
-
-/* process info */
-struct ps_struct {
-        struct ps_struct *next_ps;    /* SLL pointer */
-        struct ps_struct *parent;     /* ppid ref */
-        struct ps_struct *children;   /* children */
-        struct ps_struct *next;       /* siblings */
-
-        /* must match - otherwise it's a new process with same PID */
-        char name[256];
-        int pid;
-        int ppid;
-        char *cgroup;
-
-        /* cache fd's */
-        int sched;
-        int schedstat;
-        FILE *smaps;
-
-        /* pointers to first/last seen timestamps */
-        struct ps_sched_struct *first;
-        struct ps_sched_struct *last;
-
-        /* records actual start time, may be way before bootchart runs */
-        double starttime;
-
-        /* record human readable total cpu time */
-        double total;
-
-        /* largest PSS size found */
-        int pss_max;
-
-        /* for drawing connection lines later */
-        double pos_x;
-        double pos_y;
-
-        struct ps_sched_struct *sample;
-};
-
-extern bool arg_relative;
-extern bool arg_filter;
-extern bool arg_show_cmdline;
-extern bool arg_show_cgroup;
-extern bool arg_pss;
-extern bool arg_entropy;
-extern bool arg_percpu;
-extern bool arg_initcall;
-extern int  arg_samples_len;
-extern double arg_hz;
-extern double arg_scale_x;
-extern double arg_scale_y;
-
-extern char arg_output_path[PATH_MAX];
-extern char arg_init_path[PATH_MAX];
diff --git a/src/bootchart/store.c b/src/bootchart/store.c
deleted file mode 100644 (file)
index 42cb804..0000000
+++ /dev/null
@@ -1,555 +0,0 @@
-/***
-  This file is part of systemd.
-
-  Copyright (C) 2009-2013 Intel Corporation
-
-  Authors:
-    Auke Kok <auke-jan.h.kok@intel.com>
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  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 <dirent.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "alloc-util.h"
-#include "bootchart.h"
-#include "cgroup-util.h"
-#include "dirent-util.h"
-#include "fd-util.h"
-#include "fileio.h"
-#include "parse-util.h"
-#include "store.h"
-#include "string-util.h"
-#include "strxcpyx.h"
-#include "time-util.h"
-#include "util.h"
-
-/*
- * Alloc a static 4k buffer for stdio - primarily used to increase
- * PSS buffering from the default 1k stdin buffer to reduce
- * read() overhead.
- */
-static char smaps_buf[4096];
-static int skip = 0;
-
-double gettime_ns(void) {
-        struct timespec n;
-
-        clock_gettime(CLOCK_MONOTONIC, &n);
-
-        return (n.tv_sec + (n.tv_nsec / (double) NSEC_PER_SEC));
-}
-
-static char *bufgetline(char *buf) {
-        char *c;
-
-        if (!buf)
-                return NULL;
-
-        c = strchr(buf, '\n');
-        if (c)
-                c++;
-
-        return c;
-}
-
-static int pid_cmdline_strscpy(int procfd, char *buffer, size_t buf_len, int pid) {
-        char filename[PATH_MAX];
-        _cleanup_close_ int fd = -1;
-        ssize_t n;
-
-        sprintf(filename, "%d/cmdline", pid);
-        fd = openat(procfd, filename, O_RDONLY|O_CLOEXEC);
-        if (fd < 0)
-                return -errno;
-
-        n = read(fd, buffer, buf_len-1);
-        if (n > 0) {
-                int i;
-                for (i = 0; i < n; i++)
-                        if (buffer[i] == '\0')
-                                buffer[i] = ' ';
-                buffer[n] = '\0';
-        }
-
-        return 0;
-}
-
-int log_sample(DIR *proc,
-               int sample,
-               struct ps_struct *ps_first,
-               struct list_sample_data **ptr,
-               int *pscount,
-               int *cpus) {
-
-        static int vmstat = -1;
-        _cleanup_free_ char *buf_schedstat = NULL;
-        char buf[4096];
-        char key[256];
-        char val[256];
-        char rt[256];
-        char wt[256];
-        char *m;
-        int r;
-        int c;
-        int p;
-        int mod;
-        static int e_fd = -1;
-        ssize_t s;
-        ssize_t n;
-        struct dirent *ent;
-        int fd;
-        struct list_sample_data *sampledata;
-        struct ps_sched_struct *ps_prev = NULL;
-        int procfd;
-        int taskfd = -1;
-
-        sampledata = *ptr;
-
-        procfd = dirfd(proc);
-        if (procfd < 0)
-                return -errno;
-
-        if (vmstat < 0) {
-                /* block stuff */
-                vmstat = openat(procfd, "vmstat", O_RDONLY|O_CLOEXEC);
-                if (vmstat < 0)
-                        return log_error_errno(errno, "Failed to open /proc/vmstat: %m");
-        }
-
-        n = pread(vmstat, buf, sizeof(buf) - 1, 0);
-        if (n <= 0) {
-                vmstat = safe_close(vmstat);
-                if (n < 0)
-                        return -errno;
-                return -ENODATA;
-        }
-
-        buf[n] = '\0';
-
-        m = buf;
-        while (m) {
-                if (sscanf(m, "%s %s", key, val) < 2)
-                        goto vmstat_next;
-                if (streq(key, "pgpgin"))
-                        sampledata->blockstat.bi = atoi(val);
-                if (streq(key, "pgpgout")) {
-                        sampledata->blockstat.bo = atoi(val);
-                        break;
-                }
-vmstat_next:
-                m = bufgetline(m);
-                if (!m)
-                        break;
-        }
-
-        /* Parse "/proc/schedstat" for overall CPU utilization */
-        r = read_full_file("/proc/schedstat", &buf_schedstat, NULL);
-        if (r < 0)
-            return log_error_errno(r, "Unable to read schedstat: %m");
-
-        m = buf_schedstat;
-        while (m) {
-                if (sscanf(m, "%s %*s %*s %*s %*s %*s %*s %s %s", key, rt, wt) < 3)
-                        goto schedstat_next;
-
-                if (strstr(key, "cpu")) {
-                        r = safe_atoi((const char*)(key+3), &c);
-                        if (r < 0 || c > MAXCPUS -1)
-                                /* Oops, we only have room for MAXCPUS data */
-                                break;
-                        sampledata->runtime[c] = atoll(rt);
-                        sampledata->waittime[c] = atoll(wt);
-
-                        if (c == *cpus)
-                                *cpus = c + 1;
-                }
-schedstat_next:
-                m = bufgetline(m);
-                if (!m)
-                        break;
-        }
-
-        if (arg_entropy) {
-                if (e_fd < 0) {
-                        e_fd = openat(procfd, "sys/kernel/random/entropy_avail", O_RDONLY|O_CLOEXEC);
-                        if (e_fd < 0)
-                                return log_error_errno(errno, "Failed to open /proc/sys/kernel/random/entropy_avail: %m");
-                }
-
-                n = pread(e_fd, buf, sizeof(buf) - 1, 0);
-                if (n <= 0) {
-                        e_fd = safe_close(e_fd);
-                } else {
-                        buf[n] = '\0';
-                        sampledata->entropy_avail = atoi(buf);
-                }
-        }
-
-        while ((ent = readdir(proc)) != NULL) {
-                char filename[PATH_MAX];
-                int pid;
-                struct ps_struct *ps;
-
-                if ((ent->d_name[0] < '0') || (ent->d_name[0] > '9'))
-                        continue;
-
-                pid = atoi(ent->d_name);
-
-                if (pid >= MAXPIDS)
-                        continue;
-
-                ps = ps_first;
-                while (ps->next_ps) {
-                        ps = ps->next_ps;
-                        if (ps->pid == pid)
-                                break;
-                }
-
-                /* end of our LL? then append a new record */
-                if (ps->pid != pid) {
-                        _cleanup_fclose_ FILE *st = NULL;
-                        char t[32];
-                        struct ps_struct *parent;
-
-                        ps->next_ps = new0(struct ps_struct, 1);
-                        if (!ps->next_ps)
-                                return log_oom();
-
-                        ps = ps->next_ps;
-                        ps->pid = pid;
-                        ps->sched = -1;
-                        ps->schedstat = -1;
-
-                        ps->sample = new0(struct ps_sched_struct, 1);
-                        if (!ps->sample)
-                                return log_oom();
-
-                        ps->sample->sampledata = sampledata;
-
-                        (*pscount)++;
-
-                        /* mark our first sample */
-                        ps->first = ps->last = ps->sample;
-                        ps->sample->runtime = atoll(rt);
-                        ps->sample->waittime = atoll(wt);
-
-                        /* get name, start time */
-                        if (ps->sched < 0) {
-                                sprintf(filename, "%d/sched", pid);
-                                ps->sched = openat(procfd, filename, O_RDONLY|O_CLOEXEC);
-                                if (ps->sched < 0)
-                                        continue;
-                        }
-
-                        s = pread(ps->sched, buf, sizeof(buf) - 1, 0);
-                        if (s <= 0) {
-                                ps->sched = safe_close(ps->sched);
-                                continue;
-                        }
-                        buf[s] = '\0';
-
-                        if (!sscanf(buf, "%s %*s %*s", key))
-                                continue;
-
-                        strscpy(ps->name, sizeof(ps->name), key);
-
-                        /* cmdline */
-                        if (arg_show_cmdline)
-                                pid_cmdline_strscpy(procfd, ps->name, sizeof(ps->name), pid);
-
-                        /* discard line 2 */
-                        m = bufgetline(buf);
-                        if (!m)
-                                continue;
-
-                        m = bufgetline(m);
-                        if (!m)
-                                continue;
-
-                        if (!sscanf(m, "%*s %*s %s", t))
-                                continue;
-
-                        r = safe_atod(t, &ps->starttime);
-                        if (r < 0)
-                                continue;
-
-                        ps->starttime /= 1000.0;
-
-                        if (arg_show_cgroup)
-                                /* if this fails, that's OK */
-                                cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER,
-                                                ps->pid, &ps->cgroup);
-
-                        /* ppid */
-                        sprintf(filename, "%d/stat", pid);
-                        fd = openat(procfd, filename, O_RDONLY|O_CLOEXEC);
-                        if (fd < 0)
-                                continue;
-
-                        st = fdopen(fd, "re");
-                        if (!st) {
-                                close(fd);
-                                continue;
-                        }
-
-                        if (!fscanf(st, "%*s %*s %*s %i", &p))
-                                continue;
-
-                        ps->ppid = p;
-
-                        /*
-                         * setup child pointers
-                         *
-                         * these are used to paint the tree coherently later
-                         * each parent has a LL of children, and a LL of siblings
-                         */
-                        if (pid == 1)
-                                continue; /* nothing to do for init atm */
-
-                        /* kthreadd has ppid=0, which breaks our tree ordering */
-                        if (ps->ppid == 0)
-                                ps->ppid = 1;
-
-                        parent = ps_first;
-                        while ((parent->next_ps && parent->pid != ps->ppid))
-                                parent = parent->next_ps;
-
-                        if (parent->pid != ps->ppid) {
-                                /* orphan */
-                                ps->ppid = 1;
-                                parent = ps_first->next_ps;
-                        }
-
-                        ps->parent = parent;
-
-                        if (!parent->children) {
-                                /* it's the first child */
-                                parent->children = ps;
-                        } else {
-                                /* walk all children and append */
-                                struct ps_struct *children;
-                                children = parent->children;
-                                while (children->next)
-                                        children = children->next;
-
-                                children->next = ps;
-                        }
-                }
-
-                /* else -> found pid, append data in ps */
-
-                /* below here is all continuous logging parts - we get here on every
-                 * iteration */
-
-                /* rt, wt */
-                if (ps->schedstat < 0) {
-                        sprintf(filename, "%d/schedstat", pid);
-                        ps->schedstat = openat(procfd, filename, O_RDONLY|O_CLOEXEC);
-                        if (ps->schedstat < 0)
-                                continue;
-                }
-
-                s = pread(ps->schedstat, buf, sizeof(buf) - 1, 0);
-                if (s <= 0) {
-                        /* clean up our file descriptors - assume that the process exited */
-                        close(ps->schedstat);
-                        ps->schedstat = -1;
-                        ps->sched = safe_close(ps->sched);
-                        continue;
-                }
-
-                buf[s] = '\0';
-
-                if (!sscanf(buf, "%s %s %*s", rt, wt))
-                        continue;
-
-                ps->sample->next = new0(struct ps_sched_struct, 1);
-                if (!ps->sample->next)
-                        return log_oom();
-
-                ps->sample->next->prev = ps->sample;
-                ps->sample = ps->sample->next;
-                ps->last = ps->sample;
-                ps->sample->runtime = atoll(rt);
-                ps->sample->waittime = atoll(wt);
-                ps->sample->sampledata = sampledata;
-                ps->sample->ps_new = ps;
-                if (ps_prev)
-                        ps_prev->cross = ps->sample;
-
-                ps_prev = ps->sample;
-                ps->total = (ps->last->runtime - ps->first->runtime)
-                            / 1000000000.0;
-
-                /* Take into account CPU runtime/waittime spent in non-main threads of the process
-                 * by parsing "/proc/[pid]/task/[tid]/schedstat" for all [tid] != [pid]
-                 * See https://github.com/systemd/systemd/issues/139
-                 */
-
-                /* Browse directory "/proc/[pid]/task" to know the thread ids of process [pid] */
-                snprintf(filename, sizeof(filename), PID_FMT "/task", pid);
-                taskfd = openat(procfd, filename, O_RDONLY|O_DIRECTORY|O_CLOEXEC);
-                if (taskfd >= 0) {
-                        _cleanup_closedir_ DIR *taskdir = NULL;
-
-                        taskdir = fdopendir(taskfd);
-                        if (!taskdir) {
-                                safe_close(taskfd);
-                                return -errno;
-                        }
-                        FOREACH_DIRENT(ent, taskdir, break) {
-                                int tid = -1;
-                                _cleanup_close_ int tid_schedstat = -1;
-                                long long delta_rt;
-                                long long delta_wt;
-
-                                if ((ent->d_name[0] < '0') || (ent->d_name[0] > '9'))
-                                        continue;
-
-                                /* Skip main thread as it was already accounted */
-                                r = safe_atoi(ent->d_name, &tid);
-                                if (r < 0 || tid == pid)
-                                        continue;
-
-                                /* Parse "/proc/[pid]/task/[tid]/schedstat" */
-                                snprintf(filename, sizeof(filename), PID_FMT "/schedstat", tid);
-                                tid_schedstat = openat(taskfd, filename, O_RDONLY|O_CLOEXEC);
-
-                                if (tid_schedstat == -1)
-                                        continue;
-
-                                s = pread(tid_schedstat, buf, sizeof(buf) - 1, 0);
-                                if (s <= 0)
-                                        continue;
-                                buf[s] = '\0';
-
-                                if (!sscanf(buf, "%s %s %*s", rt, wt))
-                                        continue;
-
-                                r = safe_atolli(rt, &delta_rt);
-                                if (r < 0)
-                                    continue;
-                                r = safe_atolli(rt, &delta_wt);
-                                if (r < 0)
-                                    continue;
-                                ps->sample->runtime  += delta_rt;
-                                ps->sample->waittime += delta_wt;
-                        }
-                }
-
-                if (!arg_pss)
-                        goto catch_rename;
-
-                /* Pss */
-                if (!ps->smaps) {
-                        sprintf(filename, "%d/smaps", pid);
-                        fd = openat(procfd, filename, O_RDONLY|O_CLOEXEC);
-                        if (fd < 0)
-                                continue;
-                        ps->smaps = fdopen(fd, "re");
-                        if (!ps->smaps) {
-                                close(fd);
-                                continue;
-                        }
-                        setvbuf(ps->smaps, smaps_buf, _IOFBF, sizeof(smaps_buf));
-                } else {
-                        rewind(ps->smaps);
-                }
-
-                /* test to see if we need to skip another field */
-                if (skip == 0) {
-                        if (fgets(buf, sizeof(buf), ps->smaps) == NULL) {
-                                continue;
-                        }
-                        if (fread(buf, 1, 28 * 15, ps->smaps) != (28 * 15)) {
-                                continue;
-                        }
-                        if (buf[392] == 'V') {
-                                skip = 2;
-                        }
-                        else {
-                                skip = 1;
-                        }
-                        rewind(ps->smaps);
-                }
-
-                while (1) {
-                        int pss_kb;
-
-                        /* skip one line, this contains the object mapped. */
-                        if (fgets(buf, sizeof(buf), ps->smaps) == NULL) {
-                                break;
-                        }
-                        /* then there's a 28 char 14 line block */
-                        if (fread(buf, 1, 28 * 14, ps->smaps) != 28 * 14) {
-                                break;
-                        }
-                        pss_kb = atoi(&buf[61]);
-                        ps->sample->pss += pss_kb;
-
-                        /* skip one more line if this is a newer kernel */
-                        if (skip == 2) {
-                               if (fgets(buf, sizeof(buf), ps->smaps) == NULL)
-                                       break;
-                        }
-                }
-
-                if (ps->sample->pss > ps->pss_max)
-                        ps->pss_max = ps->sample->pss;
-
-catch_rename:
-                /* catch process rename, try to randomize time */
-                mod = (arg_hz < 4.0) ? 4.0 : (arg_hz / 4.0);
-                if (((sample - ps->pid) + pid) % (int)(mod) == 0) {
-
-                        /* re-fetch name */
-                        /* get name, start time */
-                        if (ps->sched < 0) {
-                                sprintf(filename, "%d/sched", pid);
-                                ps->sched = openat(procfd, filename, O_RDONLY|O_CLOEXEC);
-                                if (ps->sched < 0)
-                                        continue;
-                        }
-
-                        s = pread(ps->sched, buf, sizeof(buf) - 1, 0);
-                        if (s <= 0) {
-                                /* clean up file descriptors */
-                                ps->sched = safe_close(ps->sched);
-                                ps->schedstat = safe_close(ps->schedstat);
-                                continue;
-                        }
-
-                        buf[s] = '\0';
-
-                        if (!sscanf(buf, "%s %*s %*s", key))
-                                continue;
-
-                        strscpy(ps->name, sizeof(ps->name), key);
-
-                        /* cmdline */
-                        if (arg_show_cmdline)
-                                pid_cmdline_strscpy(procfd, ps->name, sizeof(ps->name), pid);
-                }
-        }
-
-        return 0;
-}
diff --git a/src/bootchart/store.h b/src/bootchart/store.h
deleted file mode 100644 (file)
index 6e9acf2..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#pragma once
-
-/***
-  This file is part of systemd.
-
-  Copyright (C) 2009-2013 Intel Corporation
-
-  Authors:
-    Auke Kok <auke-jan.h.kok@intel.com>
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  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 <dirent.h>
-
-#include "bootchart.h"
-
-double gettime_ns(void);
-void log_uptime(void);
-int log_sample(DIR *proc,
-               int sample,
-               struct ps_struct *ps_first,
-               struct list_sample_data **ptr,
-               int *pscount,
-               int *cpus);
diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c
deleted file mode 100644 (file)
index f2af535..0000000
+++ /dev/null
@@ -1,1375 +0,0 @@
-/***
-  This file is part of systemd.
-
-  Copyright (C) 2009-2013 Intel Corporation
-
-  Authors:
-    Auke Kok <auke-jan.h.kok@intel.com>
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  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 <fcntl.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/utsname.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "alloc-util.h"
-#include "architecture.h"
-#include "bootchart.h"
-#include "fd-util.h"
-#include "fileio.h"
-#include "list.h"
-#include "macro.h"
-#include "stdio-util.h"
-#include "store.h"
-#include "svg.h"
-#include "utf8.h"
-#include "util.h"
-
-#define time_to_graph(t) ((t) * arg_scale_x)
-#define ps_to_graph(n) ((n) * arg_scale_y)
-#define kb_to_graph(m) ((m) * arg_scale_y * 0.0001)
-#define to_color(n) (192.0 - ((n) * 192.0))
-
-static const char * const colorwheel[12] = {
-        "rgb(255,32,32)",  // red
-        "rgb(32,192,192)", // cyan
-        "rgb(255,128,32)", // orange
-        "rgb(128,32,192)", // blue-violet
-        "rgb(255,255,32)", // yellow
-        "rgb(192,32,128)", // red-violet
-        "rgb(32,255,32)",  // green
-        "rgb(255,64,32)",  // red-orange
-        "rgb(32,32,255)",  // blue
-        "rgb(255,192,32)", // yellow-orange
-        "rgb(192,32,192)", // violet
-        "rgb(32,192,32)"   // yellow-green
-};
-
-static double idletime = -1.0;
-static int pfiltered = 0;
-static int pcount = 0;
-static int kcount = 0;
-static double psize = 0;
-static double ksize = 0;
-static double esize = 0;
-static struct list_sample_data *sampledata;
-static struct list_sample_data *prev_sampledata;
-
-static void svg_header(FILE *of, struct list_sample_data *head, double graph_start, int n_cpus) {
-        double w;
-        double h;
-        struct list_sample_data *sampledata_last;
-
-        assert(head);
-
-        sampledata_last = head;
-        LIST_FOREACH_BEFORE(link, sampledata, head) {
-                sampledata_last = sampledata;
-        }
-
-        /* min width is about 1600px due to the label */
-        w = 150.0 + 10.0 + time_to_graph(sampledata_last->sampletime - graph_start);
-        w = ((w < 1600.0) ? 1600.0 : w);
-
-        /* height is variable based on pss, psize, ksize */
-        h = 400.0 + (arg_scale_y * 30.0) /* base graphs and title */
-            + (arg_pss ? (100.0 * arg_scale_y) + (arg_scale_y * 7.0) : 0.0) /* pss estimate */
-            + psize + ksize + esize + (n_cpus * 15 * arg_scale_y);
-
-        fprintf(of, "<?xml version=\"1.0\" standalone=\"no\"?>\n");
-        fprintf(of, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" ");
-        fprintf(of, "\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
-
-        //fprintf(of, "<g transform=\"translate(10,%d)\">\n", 1000 + 150 + (pcount * 20));
-        fprintf(of, "<svg width=\"%.0fpx\" height=\"%.0fpx\" version=\"1.1\" ", w, h);
-        fprintf(of, "xmlns=\"http://www.w3.org/2000/svg\">\n\n");
-
-        /* write some basic info as a comment, including some help */
-        fprintf(of, "<!-- This file is a bootchart SVG file. It is best rendered in a browser -->\n");
-        fprintf(of, "<!-- such as Chrome, Chromium, or Firefox. Other applications that       -->\n");
-        fprintf(of, "<!-- render these files properly but more slowly are ImageMagick, gimp,  -->\n");
-        fprintf(of, "<!-- inkscape, etc. To display the files on your system, just point      -->\n");
-        fprintf(of, "<!-- your browser to file:///run/log/ and click. This bootchart was      -->\n\n");
-
-        fprintf(of, "<!-- generated by bootchart version %s, running with options:  -->\n", VERSION);
-        fprintf(of, "<!-- hz=\"%f\" n=\"%d\" -->\n", arg_hz, arg_samples_len);
-        fprintf(of, "<!-- x=\"%f\" y=\"%f\" -->\n", arg_scale_x, arg_scale_y);
-        fprintf(of, "<!-- rel=\"%d\" f=\"%d\" -->\n", arg_relative, arg_filter);
-        fprintf(of, "<!-- p=\"%d\" e=\"%d\" -->\n", arg_pss, arg_entropy);
-        fprintf(of, "<!-- o=\"%s\" i=\"%s\" -->\n\n", arg_output_path, arg_init_path);
-
-        /* style sheet */
-        fprintf(of, "<defs>\n  <style type=\"text/css\">\n    <![CDATA[\n");
-
-        fprintf(of, "      rect       { stroke-width: 1; }\n");
-        fprintf(of, "      rect.bg    { fill: rgb(255,255,255); }\n");
-        fprintf(of, "      rect.cpu   { fill: rgb(64,64,240); stroke-width: 0; fill-opacity: 0.7; }\n");
-        fprintf(of, "      rect.wait  { fill: rgb(240,240,0); stroke-width: 0; fill-opacity: 0.7; }\n");
-        fprintf(of, "      rect.bi    { fill: rgb(240,128,128); stroke-width: 0; fill-opacity: 0.7; }\n");
-        fprintf(of, "      rect.bo    { fill: rgb(192,64,64); stroke-width: 0; fill-opacity: 0.7; }\n");
-        fprintf(of, "      rect.ps    { fill: rgb(192,192,192); stroke: rgb(128,128,128); fill-opacity: 0.7; }\n");
-        fprintf(of, "      rect.krnl  { fill: rgb(240,240,0); stroke: rgb(128,128,128); fill-opacity: 0.7; }\n");
-        fprintf(of, "      rect.box   { fill: rgb(240,240,240); stroke: rgb(192,192,192); }\n");
-        fprintf(of, "      rect.clrw  { stroke-width: 0; fill-opacity: 0.7;}\n");
-        fprintf(of, "      line       { stroke: rgb(64,64,64); stroke-width: 1; }\n");
-        fprintf(of, "//    line.sec1  { }\n");
-        fprintf(of, "      line.sec5  { stroke-width: 2; }\n");
-        fprintf(of, "      line.sec01 { stroke: rgb(224,224,224); stroke-width: 1; }\n");
-        fprintf(of, "      line.dot   { stroke-dasharray: 2 4; }\n");
-        fprintf(of, "      line.idle  { stroke: rgb(64,64,64); stroke-dasharray: 10 6; stroke-opacity: 0.7; }\n");
-
-        fprintf(of, "      .run       { font-size: 8; font-style: italic; }\n");
-        fprintf(of, "      text       { font-family: Verdana, Helvetica; font-size: 10; }\n");
-        fprintf(of, "      text.sec   { font-size: 8; }\n");
-        fprintf(of, "      text.t1    { font-size: 24; }\n");
-        fprintf(of, "      text.t2    { font-size: 12; }\n");
-        fprintf(of, "      text.idle  { font-size: 18; }\n");
-
-        fprintf(of, "    ]]>\n   </style>\n</defs>\n\n");
-}
-
-static int svg_title(FILE *of, const char *build, int pscount, double log_start, int overrun) {
-        _cleanup_free_ char *cmdline = NULL;
-        _cleanup_free_ char *model = NULL;
-        _cleanup_free_ char *buf = NULL;
-        char date[256] = "Unknown";
-        const char *cpu;
-        char *c;
-        time_t t;
-        int r;
-        struct utsname uts;
-
-        r = read_one_line_file("/proc/cmdline", &cmdline);
-        if (r < 0) {
-                log_error_errno(r, "Unable to read cmdline: %m");
-                return r;
-        }
-
-        /* extract root fs so we can find disk model name in sysfs */
-        /* FIXME: this works only in the simple case */
-        c = strstr(cmdline, "root=/dev/");
-        if (c) {
-                char rootbdev[4];
-                char filename[32];
-
-                strncpy(rootbdev, &c[10], sizeof(rootbdev) - 1);
-                rootbdev[3] = '\0';
-                xsprintf(filename, "/sys/block/%s/device/model", rootbdev);
-
-                r = read_one_line_file(filename, &model);
-                if (r < 0)
-                        log_info("Error reading disk model for %s: %m\n", rootbdev);
-        }
-
-        /* various utsname parameters */
-        r = uname(&uts);
-        if (r < 0) {
-                log_error("Error getting uname info\n");
-                return -errno;
-        }
-
-        /* date */
-        t = time(NULL);
-        r = strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %z", localtime(&t));
-        assert_se(r > 0);
-
-        /* CPU type */
-        r = get_proc_field("/proc/cpuinfo", PROC_CPUINFO_MODEL, "\n", &buf);
-        if (r < 0)
-                cpu = "Unknown";
-        else
-                cpu = buf;
-
-        fprintf(of, "<text class=\"t1\" x=\"0\" y=\"30\">Bootchart for %s - %s</text>\n",
-                uts.nodename, date);
-        fprintf(of, "<text class=\"t2\" x=\"20\" y=\"50\">System: %s %s %s %s</text>\n",
-                uts.sysname, uts.release, uts.version, uts.machine);
-        fprintf(of, "<text class=\"t2\" x=\"20\" y=\"65\">CPU: %s</text>\n", cpu);
-        if (model)
-                fprintf(of, "<text class=\"t2\" x=\"20\" y=\"80\">Disk: %s</text>\n", model);
-        fprintf(of, "<text class=\"t2\" x=\"20\" y=\"95\">Boot options: %s</text>\n", cmdline);
-        fprintf(of, "<text class=\"t2\" x=\"20\" y=\"110\">Build: %s</text>\n", build);
-        fprintf(of, "<text class=\"t2\" x=\"20\" y=\"125\">Log start time: %.03fs</text>\n", log_start);
-        fprintf(of, "<text class=\"t2\" x=\"20\" y=\"140\">Idle time: ");
-
-        if (idletime >= 0.0)
-                fprintf(of, "%.03fs", idletime);
-        else
-                fprintf(of, "Not detected");
-
-        fprintf(of, "</text>\n");
-        fprintf(of, "<text class=\"sec\" x=\"20\" y=\"155\">Graph data: %.03f samples/sec, recorded %i total, dropped %i samples, %i processes, %i filtered</text>\n",
-                arg_hz, arg_samples_len, overrun, pscount, pfiltered);
-
-        return 0;
-}
-
-static void svg_graph_box(FILE *of, struct list_sample_data *head, int height, double graph_start) {
-        double d = 0.0;
-        int i = 0;
-        double finalsample = 0.0;
-        struct list_sample_data *sampledata_last;
-
-        sampledata_last = head;
-        LIST_FOREACH_BEFORE(link, sampledata, head) {
-                sampledata_last = sampledata;
-        }
-
-        finalsample = sampledata_last->sampletime;
-
-        /* outside box, fill */
-        fprintf(of, "<rect class=\"box\" x=\"%.03f\" y=\"0\" width=\"%.03f\" height=\"%.03f\" />\n",
-                time_to_graph(0.0),
-                time_to_graph(finalsample - graph_start),
-                ps_to_graph(height));
-
-        for (d = graph_start; d <= finalsample;
-             d += (arg_scale_x < 2.0 ? 60.0 : arg_scale_x < 10.0 ? 1.0 : 0.1)) {
-                /* lines for each second */
-                if (i % 50 == 0)
-                        fprintf(of, "  <line class=\"sec5\" x1=\"%.03f\" y1=\"0\" x2=\"%.03f\" y2=\"%.03f\" />\n",
-                                time_to_graph(d - graph_start),
-                                time_to_graph(d - graph_start),
-                                ps_to_graph(height));
-                else if (i % 10 == 0)
-                        fprintf(of, "  <line class=\"sec1\" x1=\"%.03f\" y1=\"0\" x2=\"%.03f\" y2=\"%.03f\" />\n",
-                                time_to_graph(d - graph_start),
-                                time_to_graph(d - graph_start),
-                                ps_to_graph(height));
-                else
-                        fprintf(of, "  <line class=\"sec01\" x1=\"%.03f\" y1=\"0\" x2=\"%.03f\" y2=\"%.03f\" />\n",
-                                time_to_graph(d - graph_start),
-                                time_to_graph(d - graph_start),
-                                ps_to_graph(height));
-
-                /* time label */
-                if (i % 10 == 0)
-                        fprintf(of, "  <text class=\"sec\" x=\"%.03f\" y=\"%.03f\" >%.01fs</text>\n",
-                                time_to_graph(d - graph_start),
-                                -5.0, d - graph_start);
-
-                i++;
-        }
-}
-
-/* xml comments must not contain "--" */
-static char* xml_comment_encode(const char* name) {
-        char *enc_name, *p;
-
-        enc_name = strdup(name);
-        if (!enc_name)
-                return NULL;
-
-        for (p = enc_name; *p; p++)
-                if (p[0] == '-' && p[1] == '-')
-                        p[1] = '_';
-
-        return enc_name;
-}
-
-static void svg_pss_graph(FILE *of,
-                          struct list_sample_data *head,
-                          struct ps_struct *ps_first,
-                          double graph_start) {
-        struct ps_struct *ps;
-        int i;
-        struct list_sample_data *sampledata_last;
-
-        sampledata_last = head;
-        LIST_FOREACH_BEFORE(link, sampledata, head) {
-                sampledata_last = sampledata;
-        }
-
-
-        fprintf(of, "\n\n<!-- Pss memory size graph -->\n");
-
-        fprintf(of, "\n  <text class=\"t2\" x=\"5\" y=\"-15\">Memory allocation - Pss</text>\n");
-
-        /* vsize 1000 == 1000mb */
-        svg_graph_box(of, head, 100, graph_start);
-        /* draw some hlines for usable memory sizes */
-        for (i = 100000; i < 1000000; i += 100000) {
-                fprintf(of, "  <line class=\"sec01\" x1=\"%.03f\" y1=\"%.0f\" x2=\"%.03f\" y2=\"%.0f\"/>\n",
-                        time_to_graph(.0),
-                        kb_to_graph(i),
-                        time_to_graph(sampledata_last->sampletime - graph_start),
-                        kb_to_graph(i));
-                fprintf(of, "  <text class=\"sec\" x=\"%.03f\" y=\"%.0f\">%dM</text>\n",
-                        time_to_graph(sampledata_last->sampletime - graph_start) + 5,
-                        kb_to_graph(i), (1000000 - i) / 1000);
-        }
-        fprintf(of, "\n");
-
-        /* now plot the graph itself */
-        i = 1;
-        prev_sampledata = head;
-        LIST_FOREACH_BEFORE(link, sampledata, head) {
-                int bottom;
-                int top;
-                struct ps_sched_struct *cross_place;
-
-                bottom = 0;
-                top = 0;
-
-                /* put all the small pss blocks into the bottom */
-                ps = ps_first;
-                while (ps->next_ps) {
-                        ps = ps->next_ps;
-                        if (!ps)
-                                continue;
-                        ps->sample = ps->first;
-                        while (ps->sample->next) {
-                                ps->sample = ps->sample->next;
-                                if (ps->sample->sampledata == sampledata)
-                                        break;
-                        }
-                        if (ps->sample->sampledata == sampledata) {
-                                if (ps->sample->pss <= (100 * arg_scale_y))
-                                        top += ps->sample->pss;
-                                break;
-                        }
-                }
-                while (ps->sample->cross) {
-                        cross_place = ps->sample->cross;
-                        ps = ps->sample->cross->ps_new;
-                        ps->sample = cross_place;
-                        if (ps->sample->pss <= (100 * arg_scale_y))
-                                top += ps->sample->pss;
-                }
-
-                fprintf(of, "    <rect class=\"clrw\" style=\"fill: %s\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
-                        "rgb(64,64,64)",
-                        time_to_graph(prev_sampledata->sampletime - graph_start),
-                        kb_to_graph(1000000.0 - top),
-                        time_to_graph(sampledata->sampletime - prev_sampledata->sampletime),
-                        kb_to_graph(top - bottom));
-                bottom = top;
-
-                /* now plot the ones that are of significant size */
-                ps = ps_first;
-                while (ps->next_ps) {
-                        ps = ps->next_ps;
-                        if (!ps)
-                                continue;
-                        ps->sample = ps->first;
-                        while (ps->sample->next) {
-                                ps->sample = ps->sample->next;
-                                if (ps->sample->sampledata == sampledata)
-                                        break;
-                        }
-                        /* don't draw anything smaller than 2mb */
-                        if (ps->sample->sampledata != sampledata)
-                                continue;
-                        if (ps->sample->pss > (100 * arg_scale_y)) {
-                                top = bottom + ps->sample->pss;
-                                fprintf(of, "    <rect class=\"clrw\" style=\"fill: %s\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
-                                        colorwheel[ps->pid % 12],
-                                        time_to_graph(prev_sampledata->sampletime - graph_start),
-                                        kb_to_graph(1000000.0 - top),
-                                        time_to_graph(sampledata->sampletime - prev_sampledata->sampletime),
-                                        kb_to_graph(top - bottom));
-                                bottom = top;
-                        }
-                        break;
-                }
-
-                while ((cross_place = ps->sample->cross)) {
-                        ps = ps->sample->cross->ps_new;
-                        ps->sample = cross_place;
-                        if (ps->sample->pss > (100 * arg_scale_y)) {
-                                top = bottom + ps->sample->pss;
-                                fprintf(of, "    <rect class=\"clrw\" style=\"fill: %s\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
-                                        colorwheel[ps->pid % 12],
-                                        time_to_graph(prev_sampledata->sampletime - graph_start),
-                                        kb_to_graph(1000000.0 - top),
-                                        time_to_graph(sampledata->sampletime - prev_sampledata->sampletime),
-                                        kb_to_graph(top - bottom));
-                                bottom = top;
-                        }
-                }
-
-                prev_sampledata = sampledata;
-                i++;
-        }
-
-        /* overlay all the text labels */
-        i = 1;
-        LIST_FOREACH_BEFORE(link, sampledata, head) {
-                int bottom;
-                int top = 0;
-                struct ps_sched_struct *prev_sample;
-                struct ps_sched_struct *cross_place;
-
-                /* put all the small pss blocks into the bottom */
-                ps = ps_first->next_ps;
-                while (ps->next_ps) {
-                        ps = ps->next_ps;
-                        if (!ps)
-                                continue;
-
-                        ps->sample = ps->first;
-                        while (ps->sample->next) {
-                                ps->sample = ps->sample->next;
-                                if (ps->sample->sampledata == sampledata)
-                                        break;
-                        }
-
-                        if (ps->sample->sampledata == sampledata) {
-                                if (ps->sample->pss <= (100 * arg_scale_y))
-                                        top += ps->sample->pss;
-
-                                break;
-                        }
-                }
-
-                while ((cross_place = ps->sample->cross)) {
-                        ps = ps->sample->cross->ps_new;
-                        ps->sample = cross_place;
-                        if (ps->sample->pss <= (100 * arg_scale_y))
-                                top += ps->sample->pss;
-                }
-                bottom = top;
-
-                /* now plot the ones that are of significant size */
-                ps = ps_first;
-                while (ps->next_ps) {
-                        prev_sample = ps->sample;
-                        ps = ps->next_ps;
-                        if (!ps)
-                                continue;
-                        ps->sample = ps->first;
-                        while (ps->sample->next) {
-                                prev_sample = ps->sample;
-                                ps->sample = ps->sample->next;
-                                if (ps->sample->sampledata == sampledata)
-                                        break;
-                        }
-                        /* don't draw anything smaller than 2mb */
-                        if (ps->sample->sampledata == sampledata) {
-                                if (ps->sample->pss > (100 * arg_scale_y)) {
-                                        top = bottom + ps->sample->pss;
-                                        /* draw a label with the process / PID */
-                                        if ((i == 1) || (prev_sample->pss <= (100 * arg_scale_y)))
-                                                fprintf(of, "  <text x=\"%.03f\" y=\"%.03f\"><![CDATA[%s]]> [%i]</text>\n",
-                                                        time_to_graph(sampledata->sampletime - graph_start),
-                                                        kb_to_graph(1000000.0 - bottom - ((top -  bottom) / 2)),
-                                                        ps->name, ps->pid);
-                                        bottom = top;
-                                }
-                                break;
-                        }
-                }
-                while ((cross_place = ps->sample->cross)) {
-                        ps = ps->sample->cross->ps_new;
-                        ps->sample = cross_place;
-                        prev_sample = ps->sample->prev;
-                        if (ps->sample->pss > (100 * arg_scale_y)) {
-                                top = bottom + ps->sample->pss;
-                                /* draw a label with the process / PID */
-                                if ((i == 1) || (prev_sample->pss <= (100 * arg_scale_y)))
-                                        fprintf(of, "  <text x=\"%.03f\" y=\"%.03f\"><![CDATA[%s]]> [%i]</text>\n",
-                                                time_to_graph(sampledata->sampletime - graph_start),
-                                                kb_to_graph(1000000.0 - bottom - ((top -  bottom) / 2)),
-                                                ps->name, ps->pid);
-                                bottom = top;
-                        }
-                }
-
-                i++;
-        }
-
-        /* debug output - full data dump */
-        fprintf(of, "\n\n<!-- PSS map - csv format -->\n");
-        ps = ps_first;
-        while (ps->next_ps) {
-                _cleanup_free_ char *enc_name = NULL;
-                ps = ps->next_ps;
-                if (!ps)
-                        continue;
-
-                enc_name = xml_comment_encode(ps->name);
-                if (!enc_name)
-                        continue;
-
-                fprintf(of, "<!-- %s [%d] pss=", enc_name, ps->pid);
-
-                ps->sample = ps->first;
-                while (ps->sample->next) {
-                        ps->sample = ps->sample->next;
-                        fprintf(of, "%d," , ps->sample->pss);
-                }
-
-                fprintf(of, " -->\n");
-        }
-
-}
-
-static void svg_io_bi_bar(FILE *of,
-                          struct list_sample_data *head,
-                          int n_samples,
-                          double graph_start,
-                          double interval) {
-
-        double max = 0.0;
-        double range;
-        int max_here = 0;
-        int i;
-        int k;
-        struct list_sample_data *start_sampledata;
-        struct list_sample_data *stop_sampledata;
-
-        fprintf(of, "<!-- IO utilization graph - In -->\n");
-        fprintf(of, "<text class=\"t2\" x=\"5\" y=\"-15\">IO utilization - read</text>\n");
-
-        /*
-         * calculate rounding range
-         *
-         * We need to round IO data since IO block data is not updated on
-         * each poll. Applying a smoothing function loses some burst data,
-         * so keep the smoothing range short.
-         */
-        range = 0.25 / (1.0 / arg_hz);
-        if (range < 2.0)
-                range = 2.0; /* no smoothing */
-
-        /* surrounding box */
-        svg_graph_box(of, head, 5, graph_start);
-
-        /* find the max IO first */
-        i = 1;
-        LIST_FOREACH_BEFORE(link, sampledata, head) {
-                int start;
-                int stop;
-                int diff;
-                double tot;
-
-                start = MAX(i - ((range / 2) - 1), 0);
-                stop = MIN(i + (range / 2), n_samples - 1);
-                diff = (stop - start);
-
-                start_sampledata = sampledata;
-                stop_sampledata = sampledata;
-
-                for (k = 0; k < ((range/2) - 1) && start_sampledata->link_next; k++)
-                        start_sampledata = start_sampledata->link_next;
-
-                for (k = 0; k < (range/2) && stop_sampledata->link_prev; k++)
-                        stop_sampledata = stop_sampledata->link_prev;
-
-                tot = (double)(stop_sampledata->blockstat.bi - start_sampledata->blockstat.bi) / diff;
-
-                if (tot > max) {
-                        max = tot;
-                        max_here = i;
-                }
-
-                tot = (double)(stop_sampledata->blockstat.bo - start_sampledata->blockstat.bo) / diff;
-
-                if (tot > max)
-                        max = tot;
-
-                i++;
-        }
-
-        /* plot bi */
-        i = 1;
-        prev_sampledata = head;
-        LIST_FOREACH_BEFORE(link, sampledata, head) {
-                int start;
-                int stop;
-                int diff;
-                double tot;
-                double pbi = 0;
-
-                start = MAX(i - ((range / 2) - 1), 0);
-                stop = MIN(i + (range / 2), n_samples);
-                diff = (stop - start);
-
-                start_sampledata = sampledata;
-                stop_sampledata = sampledata;
-
-                for (k = 0; k < ((range/2)-1) && start_sampledata->link_next; k++)
-                        start_sampledata = start_sampledata->link_next;
-
-                for (k = 0; k < (range/2) && stop_sampledata->link_prev; k++)
-                        stop_sampledata = stop_sampledata->link_prev;
-
-                tot = (double)(stop_sampledata->blockstat.bi - start_sampledata->blockstat.bi) / diff;
-
-                if (max > 0)
-                        pbi = tot / max;
-
-                if (pbi > 0.001)
-                        fprintf(of, "<rect class=\"bi\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
-                                time_to_graph(prev_sampledata->sampletime - graph_start),
-                                (arg_scale_y * 5) - (pbi * (arg_scale_y * 5)),
-                                time_to_graph(sampledata->sampletime - prev_sampledata->sampletime),
-                                pbi * (arg_scale_y * 5));
-
-                /* labels around highest value */
-                if (i == max_here)
-                        fprintf(of, "  <text class=\"sec\" x=\"%.03f\" y=\"%.03f\">%0.2fmb/sec</text>\n",
-                                time_to_graph(sampledata->sampletime - graph_start) + 5,
-                                ((arg_scale_y * 5) - (pbi * (arg_scale_y * 5))) + 15,
-                                max / 1024.0 / (interval / 1000000000.0));
-
-                i++;
-                prev_sampledata = sampledata;
-        }
-}
-
-static void svg_io_bo_bar(FILE *of,
-                          struct list_sample_data *head,
-                          int n_samples,
-                          double graph_start,
-                          double interval) {
-        double max = 0.0;
-        double range;
-        int max_here = 0;
-        int i;
-        int k;
-        struct list_sample_data *start_sampledata;
-        struct list_sample_data *stop_sampledata;
-
-        fprintf(of, "<!-- IO utilization graph - out -->\n");
-        fprintf(of, "<text class=\"t2\" x=\"5\" y=\"-15\">IO utilization - write</text>\n");
-
-        /*
-         * calculate rounding range
-         *
-         * We need to round IO data since IO block data is not updated on
-         * each poll. Applying a smoothing function loses some burst data,
-         * so keep the smoothing range short.
-         */
-        range = 0.25 / (1.0 / arg_hz);
-        if (range < 2.0)
-                range = 2.0; /* no smoothing */
-
-        /* surrounding box */
-        svg_graph_box(of, head, 5, graph_start);
-
-        /* find the max IO first */
-        i = 0;
-        LIST_FOREACH_BEFORE(link, sampledata, head) {
-                int start;
-                int stop;
-                int diff;
-                double tot;
-
-                start = MAX(i - ((range / 2) - 1), 0);
-                stop = MIN(i + (range / 2), n_samples - 1);
-                diff = (stop - start);
-
-                start_sampledata = sampledata;
-                stop_sampledata = sampledata;
-
-                for (k = 0; k < (range/2) - 1 && start_sampledata->link_next; k++)
-                        start_sampledata = start_sampledata->link_next;
-
-                for (k = 0; k < (range/2) && stop_sampledata->link_prev; k++)
-                        stop_sampledata = stop_sampledata->link_prev;
-
-                tot = (double)(stop_sampledata->blockstat.bi - start_sampledata->blockstat.bi) / diff;
-                if (tot > max)
-                        max = tot;
-
-                tot = (double)(stop_sampledata->blockstat.bo - start_sampledata->blockstat.bo) / diff;
-                if (tot > max) {
-                        max = tot;
-                        max_here = i;
-                }
-
-                i++;
-        }
-
-        /* plot bo */
-        prev_sampledata = head;
-        i = 1;
-
-        LIST_FOREACH_BEFORE(link, sampledata, head) {
-                int start, stop, diff;
-                double tot, pbo;
-
-                pbo = 0;
-
-                start = MAX(i - ((range / 2) - 1), 0);
-                stop = MIN(i + (range / 2), n_samples);
-                diff = (stop - start);
-
-                start_sampledata = sampledata;
-                stop_sampledata = sampledata;
-
-                for (k = 0; k < ((range/2)-1) && start_sampledata->link_next; k++)
-                        start_sampledata = start_sampledata->link_next;
-
-                for (k = 0; k < (range/2) && stop_sampledata->link_prev; k++)
-                        stop_sampledata = stop_sampledata->link_prev;
-
-                tot = (double)(stop_sampledata->blockstat.bo - start_sampledata->blockstat.bo)
-                        / diff;
-
-                if (max > 0)
-                        pbo = tot / max;
-
-                if (pbo > 0.001)
-                        fprintf(of, "<rect class=\"bo\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
-                                time_to_graph(prev_sampledata->sampletime - graph_start),
-                                (arg_scale_y * 5) - (pbo * (arg_scale_y * 5)),
-                                time_to_graph(sampledata->sampletime - prev_sampledata->sampletime),
-                                pbo * (arg_scale_y * 5));
-
-                /* labels around highest bo value */
-                if (i == max_here)
-                        fprintf(of, "  <text class=\"sec\" x=\"%.03f\" y=\"%.03f\">%0.2fmb/sec</text>\n",
-                                time_to_graph(sampledata->sampletime - graph_start) + 5,
-                                ((arg_scale_y * 5) - (pbo * (arg_scale_y * 5))),
-                                max / 1024.0 / (interval / 1000000000.0));
-
-                i++;
-                prev_sampledata = sampledata;
-        }
-}
-
-static void svg_cpu_bar(FILE *of, struct list_sample_data *head, int n_cpus, int cpu_num, double graph_start) {
-
-        fprintf(of, "<!-- CPU utilization graph -->\n");
-
-        if (cpu_num < 0)
-                fprintf(of, "<text class=\"t2\" x=\"5\" y=\"-15\">CPU[overall] utilization</text>\n");
-        else
-                fprintf(of, "<text class=\"t2\" x=\"5\" y=\"-15\">CPU[%d] utilization</text>\n", cpu_num);
-
-        /* surrounding box */
-        svg_graph_box(of, head, 5, graph_start);
-
-        /* bars for each sample, proportional to the CPU util. */
-        prev_sampledata = head;
-        LIST_FOREACH_BEFORE(link, sampledata, head) {
-                int c;
-                double trt;
-                double ptrt;
-
-                ptrt = trt = 0.0;
-
-                if (cpu_num < 0)
-                        for (c = 0; c < n_cpus; c++)
-                                trt += sampledata->runtime[c] - prev_sampledata->runtime[c];
-                else
-                        trt = sampledata->runtime[cpu_num] - prev_sampledata->runtime[cpu_num];
-
-                trt = trt / 1000000000.0;
-
-                if (cpu_num < 0)
-                        trt = trt / (double)n_cpus;
-
-                if (trt > 0.0)
-                        ptrt = trt / (sampledata->sampletime - prev_sampledata->sampletime);
-
-                if (ptrt > 1.0)
-                        ptrt = 1.0;
-
-                if (ptrt > 0.001)
-                        fprintf(of, "<rect class=\"cpu\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
-                                time_to_graph(prev_sampledata->sampletime - graph_start),
-                                (arg_scale_y * 5) - (ptrt * (arg_scale_y * 5)),
-                                time_to_graph(sampledata->sampletime - prev_sampledata->sampletime),
-                                ptrt * (arg_scale_y * 5));
-
-                prev_sampledata = sampledata;
-        }
-}
-
-static void svg_wait_bar(FILE *of, struct list_sample_data *head, int n_cpus, int cpu_num, double graph_start) {
-
-        fprintf(of, "<!-- Wait time aggregation box -->\n");
-
-        if (cpu_num < 0)
-                fprintf(of, "<text class=\"t2\" x=\"5\" y=\"-15\">CPU[overall] wait</text>\n");
-        else
-                fprintf(of, "<text class=\"t2\" x=\"5\" y=\"-15\">CPU[%d] wait</text>\n", cpu_num);
-
-        /* surrounding box */
-        svg_graph_box(of, head, 5, graph_start);
-
-        /* bars for each sample, proportional to the CPU util. */
-        prev_sampledata = head;
-        LIST_FOREACH_BEFORE(link, sampledata, head) {
-                int c;
-                double twt;
-                double ptwt;
-
-                ptwt = twt = 0.0;
-
-                if (cpu_num < 0)
-                        for (c = 0; c < n_cpus; c++)
-                                twt += sampledata->waittime[c] - prev_sampledata->waittime[c];
-                else
-                        twt = sampledata->waittime[cpu_num] - prev_sampledata->waittime[cpu_num];
-
-                twt = twt / 1000000000.0;
-
-                if (cpu_num < 0)
-                        twt = twt / (double)n_cpus;
-
-                if (twt > 0.0)
-                        ptwt = twt / (sampledata->sampletime - prev_sampledata->sampletime);
-
-                if (ptwt > 1.0)
-                        ptwt = 1.0;
-
-                if (ptwt > 0.001)
-                        fprintf(of, "<rect class=\"wait\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
-                                time_to_graph(prev_sampledata->sampletime - graph_start),
-                                ((arg_scale_y * 5) - (ptwt * (arg_scale_y * 5))),
-                                time_to_graph(sampledata->sampletime - prev_sampledata->sampletime),
-                                ptwt * (arg_scale_y * 5));
-
-                prev_sampledata = sampledata;
-        }
-}
-
-static void svg_entropy_bar(FILE *of, struct list_sample_data *head, double graph_start) {
-
-        fprintf(of, "<!-- entropy pool graph -->\n");
-
-        fprintf(of, "<text class=\"t2\" x=\"5\" y=\"-15\">Entropy pool size</text>\n");
-        /* surrounding box */
-        svg_graph_box(of, head, 5, graph_start);
-
-        /* bars for each sample, scale 0-4096 */
-        prev_sampledata = head;
-        LIST_FOREACH_BEFORE(link, sampledata, head) {
-                fprintf(of, "<rect class=\"cpu\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
-                        time_to_graph(prev_sampledata->sampletime - graph_start),
-                        ((arg_scale_y * 5) - ((sampledata->entropy_avail / 4096.) * (arg_scale_y * 5))),
-                        time_to_graph(sampledata->sampletime - prev_sampledata->sampletime),
-                        (sampledata->entropy_avail / 4096.) * (arg_scale_y * 5));
-                prev_sampledata = sampledata;
-        }
-}
-
-static struct ps_struct *get_next_ps(struct ps_struct *ps, struct ps_struct *ps_first) {
-        /*
-         * walk the list of processes and return the next one to be
-         * painted
-         */
-        if (ps == ps_first)
-                return ps->next_ps;
-
-        /* go deep */
-        if (ps->children)
-                return ps->children;
-
-        /* find siblings */
-        if (ps->next)
-                return ps->next;
-
-        /* go back for parent siblings */
-        for (;;) {
-                if (ps->parent && ps->parent->next)
-                        return ps->parent->next;
-
-                ps = ps->parent;
-                if (!ps)
-                        return ps;
-        }
-
-        return NULL;
-}
-
-static bool ps_filter(struct ps_struct *ps) {
-        if (!arg_filter)
-                return false;
-
-        /* can't draw data when there is only 1 sample (need start + stop) */
-        if (ps->first == ps->last)
-                return true;
-
-        /* don't filter kthreadd */
-        if (ps->pid == 2)
-                return false;
-
-        /* drop stuff that doesn't use any real CPU time */
-        if (ps->total <= 0.001)
-                return true;
-
-        return 0;
-}
-
-static void svg_do_initcall(FILE *of, struct list_sample_data *head, int count_only, double graph_start) {
-        _cleanup_pclose_ FILE *f = NULL;
-        double t;
-        char func[256];
-        int ret;
-        int usecs;
-
-        /* can't plot initcall when disabled or in relative mode */
-        if (!arg_initcall || arg_relative) {
-                kcount = 0;
-                return;
-        }
-
-        if (!count_only) {
-                fprintf(of, "<!-- initcall -->\n");
-                fprintf(of, "<text class=\"t2\" x=\"5\" y=\"-15\">Kernel init threads</text>\n");
-                /* surrounding box */
-                svg_graph_box(of, head, kcount, graph_start);
-        }
-
-        kcount = 0;
-
-        /*
-         * Initcall graphing - parses dmesg buffer and displays kernel threads
-         * This somewhat uses the same methods and scaling to show processes
-         * but looks a lot simpler. It's overlaid entirely onto the PS graph
-         * when appropriate.
-         */
-
-        f = popen("dmesg", "r");
-        if (!f)
-                return;
-
-        while (!feof(f)) {
-                int c;
-                int z = 0;
-                char l[256];
-
-                if (fgets(l, sizeof(l) - 1, f) == NULL)
-                        continue;
-
-                c = sscanf(l, "[%lf] initcall %s %*s %d %*s %d %*s",
-                           &t, func, &ret, &usecs);
-                if (c != 4) {
-                        /* also parse initcalls done by module loading */
-                        c = sscanf(l, "[%lf] initcall %s %*s %*s %d %*s %d %*s",
-                                   &t, func, &ret, &usecs);
-                        if (c != 4)
-                                continue;
-                }
-
-                /* chop the +0xXX/0xXX stuff */
-                while(func[z] != '+')
-                        z++;
-                func[z] = 0;
-
-                if (count_only) {
-                        /* filter out irrelevant stuff */
-                        if (usecs >= 1000)
-                                kcount++;
-                        continue;
-                }
-
-                fprintf(of, "<!-- thread=\"%s\" time=\"%.3f\" elapsed=\"%d\" result=\"%d\" -->\n",
-                        func, t, usecs, ret);
-
-                if (usecs < 1000)
-                        continue;
-
-                /* rect */
-                fprintf(of, "  <rect class=\"krnl\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
-                        time_to_graph(t - (usecs / 1000000.0)),
-                        ps_to_graph(kcount),
-                        time_to_graph(usecs / 1000000.0),
-                        ps_to_graph(1));
-
-                /* label */
-                fprintf(of, "  <text x=\"%.03f\" y=\"%.03f\">%s <tspan class=\"run\">%.03fs</tspan></text>\n",
-                        time_to_graph(t - (usecs / 1000000.0)) + 5,
-                        ps_to_graph(kcount) + 15,
-                        func, usecs / 1000000.0);
-
-                kcount++;
-        }
-}
-
-static void svg_ps_bars(FILE *of,
-                        struct list_sample_data *head,
-                        int n_samples,
-                        int n_cpus,
-                        struct ps_struct *ps_first,
-                        double graph_start,
-                        double interval) {
-
-        struct ps_struct *ps;
-        int i = 0;
-        int j = 0;
-        int pid;
-        double w = 0.0;
-
-        fprintf(of, "<!-- Process graph -->\n");
-        fprintf(of, "<text class=\"t2\" x=\"5\" y=\"-15\">Processes</text>\n");
-
-        /* surrounding box */
-        svg_graph_box(of, head, pcount, graph_start);
-
-        /* pass 2 - ps boxes */
-        ps = ps_first;
-        while ((ps = get_next_ps(ps, ps_first))) {
-                _cleanup_free_ char *enc_name = NULL, *escaped = NULL;
-                double endtime;
-                double starttime;
-                int t;
-
-                if (!utf8_is_printable(ps->name, strlen(ps->name)))
-                        escaped = utf8_escape_non_printable(ps->name);
-
-                enc_name = xml_comment_encode(escaped ? escaped : ps->name);
-                if (!enc_name)
-                        continue;
-
-                /* leave some trace of what we actually filtered etc. */
-                fprintf(of, "<!-- %s [%i] ppid=%i runtime=%.03fs -->\n", enc_name, ps->pid,
-                        ps->ppid, ps->total);
-
-                starttime = ps->first->sampledata->sampletime;
-
-                if (!ps_filter(ps)) {
-                        /* remember where _to_ our children need to draw a line */
-                        ps->pos_x = time_to_graph(starttime - graph_start);
-                        ps->pos_y = ps_to_graph(j+1); /* bottom left corner */
-                } else if (ps->parent){
-                        /* hook children to our parent coords instead */
-                        ps->pos_x = ps->parent->pos_x;
-                        ps->pos_y = ps->parent->pos_y;
-
-                        /* if this is the last child, we might still need to draw a connecting line */
-                        if ((!ps->next) && (ps->parent))
-                                fprintf(of, "  <line class=\"dot\" x1=\"%.03f\" y1=\"%.03f\" x2=\"%.03f\" y2=\"%.03f\" />\n",
-                                        ps->parent->pos_x,
-                                        ps_to_graph(j-1) + 10.0, /* whee, use the last value here */
-                                        ps->parent->pos_x,
-                                        ps->parent->pos_y);
-                        continue;
-                }
-
-                endtime = ps->last->sampledata->sampletime;
-                fprintf(of, "  <rect class=\"ps\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
-                        time_to_graph(starttime - graph_start),
-                        ps_to_graph(j),
-                        time_to_graph(ps->last->sampledata->sampletime - starttime),
-                        ps_to_graph(1));
-
-                /* paint cpu load over these */
-                ps->sample = ps->first;
-                t = 1;
-                while (ps->sample->next) {
-                        double rt, prt;
-                        double wt, wrt;
-                        struct ps_sched_struct *prev;
-
-                        prev = ps->sample;
-                        ps->sample = ps->sample->next;
-
-                        /* calculate over interval */
-                        rt = ps->sample->runtime - prev->runtime;
-                        wt = ps->sample->waittime - prev->waittime;
-
-                        prt = (rt / 1000000000) / (ps->sample->sampledata->sampletime - prev->sampledata->sampletime);
-                        wrt = (wt / 1000000000) / (ps->sample->sampledata->sampletime - prev->sampledata->sampletime);
-
-                        /* this can happen if timekeeping isn't accurate enough */
-                        if (prt > 1.0)
-                                prt = 1.0;
-                        if (wrt > 1.0)
-                                wrt = 1.0;
-
-                        if ((prt < 0.1) && (wrt < 0.1)) /* =~ 26 (color threshold) */
-                                continue;
-
-                        fprintf(of, "    <rect class=\"wait\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
-                                time_to_graph(prev->sampledata->sampletime - graph_start),
-                                ps_to_graph(j),
-                                time_to_graph(ps->sample->sampledata->sampletime - prev->sampledata->sampletime),
-                                ps_to_graph(wrt));
-
-                        /* draw cpu over wait - TODO figure out how/why run + wait > interval */
-                        fprintf(of, "    <rect class=\"cpu\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
-                                time_to_graph(prev->sampledata->sampletime - graph_start),
-                                ps_to_graph(j + (1.0 - prt)),
-                                time_to_graph(ps->sample->sampledata->sampletime - prev->sampledata->sampletime),
-                                ps_to_graph(prt));
-                        t++;
-                }
-
-                /* determine where to display the process name */
-                if ((endtime - starttime) < 1.5)
-                        /* too small to fit label inside the box */
-                        w = endtime;
-                else
-                        w = starttime;
-
-                /* text label of process name */
-                fprintf(of, "  <text x=\"%.03f\" y=\"%.03f\"><![CDATA[%s]]> [%i]<tspan class=\"run\">%.03fs</tspan> %s</text>\n",
-                        time_to_graph(w - graph_start) + 5.0,
-                        ps_to_graph(j) + 14.0,
-                        escaped ? escaped : ps->name,
-                        ps->pid,
-                        (ps->last->runtime - ps->first->runtime) / 1000000000.0,
-                        arg_show_cgroup ? ps->cgroup : "");
-                /* paint lines to the parent process */
-                if (ps->parent) {
-                        /* horizontal part */
-                        fprintf(of, "  <line class=\"dot\" x1=\"%.03f\" y1=\"%.03f\" x2=\"%.03f\" y2=\"%.03f\" />\n",
-                                time_to_graph(starttime - graph_start),
-                                ps_to_graph(j) + 10.0,
-                                ps->parent->pos_x,
-                                ps_to_graph(j) + 10.0);
-
-                        /* one vertical line connecting all the horizontal ones up */
-                        if (!ps->next)
-                                fprintf(of, "  <line class=\"dot\" x1=\"%.03f\" y1=\"%.03f\" x2=\"%.03f\" y2=\"%.03f\" />\n",
-                                        ps->parent->pos_x,
-                                        ps_to_graph(j) + 10.0,
-                                        ps->parent->pos_x,
-                                        ps->parent->pos_y);
-                }
-
-                j++; /* count boxes */
-
-                fprintf(of, "\n");
-        }
-
-        /* last pass - determine when idle */
-        pid = getpid();
-        /* make sure we start counting from the point where we actually have
-         * data: assume that bootchart's first sample is when data started
-         */
-
-        ps = ps_first;
-        while (ps->next_ps) {
-                ps = ps->next_ps;
-                if (ps->pid == pid)
-                        break;
-        }
-
-        /* need to know last node first */
-        ps->sample = ps->first;
-        i = ps->sample->next->sampledata->counter;
-
-        while (ps->sample->next && i<(n_samples-(arg_hz/2))) {
-                double crt;
-                double brt;
-                int c;
-                int ii;
-                struct ps_sched_struct *sample_hz;
-
-                ps->sample = ps->sample->next;
-                sample_hz = ps->sample;
-                for (ii = 0; (ii < (int)arg_hz/2) && sample_hz->next; ii++)
-                        sample_hz = sample_hz->next;
-
-                /* subtract bootchart cpu utilization from total */
-                crt = 0.0;
-                for (c = 0; c < n_cpus; c++)
-                        crt += sample_hz->sampledata->runtime[c] - ps->sample->sampledata->runtime[c];
-
-                brt = sample_hz->runtime - ps->sample->runtime;
-                /*
-                 * our definition of "idle":
-                 *
-                 * if for (hz / 2) we've used less CPU than (interval / 2) ...
-                 * defaults to 4.0%, which experimentally, is where atom idles
-                 */
-                if ((crt - brt) < (interval / 2.0)) {
-                        idletime = ps->sample->sampledata->sampletime - graph_start;
-                        fprintf(of, "\n<!-- idle detected at %.03f seconds -->\n", idletime);
-                        fprintf(of, "<line class=\"idle\" x1=\"%.03f\" y1=\"%.03f\" x2=\"%.03f\" y2=\"%.03f\" />\n",
-                                time_to_graph(idletime),
-                                -arg_scale_y,
-                                time_to_graph(idletime),
-                                ps_to_graph(pcount) + arg_scale_y);
-                        fprintf(of, "<text class=\"idle\" x=\"%.03f\" y=\"%.03f\">%.01fs</text>\n",
-                                time_to_graph(idletime) + 5.0,
-                                ps_to_graph(pcount) + arg_scale_y,
-                                idletime);
-                        break;
-                }
-
-                i++;
-        }
-}
-
-static void svg_top_ten_cpu(FILE *of, struct ps_struct *ps_first) {
-        struct ps_struct *top[10];
-        struct ps_struct emptyps = {};
-        struct ps_struct *ps;
-        int n, m;
-
-        for (n = 0; n < (int) ELEMENTSOF(top); n++)
-                top[n] = &emptyps;
-
-        /* walk all ps's and setup ptrs */
-        ps = ps_first;
-        while ((ps = get_next_ps(ps, ps_first))) {
-                for (n = 0; n < 10; n++) {
-                        if (ps->total <= top[n]->total)
-                                continue;
-                        /* cascade insert */
-                        for (m = 9; m > n; m--)
-                                top[m] = top[m-1];
-                        top[n] = ps;
-                        break;
-                }
-        }
-
-        fprintf(of, "<text class=\"t2\" x=\"20\" y=\"0\">Top CPU consumers:</text>\n");
-        for (n = 0; n < 10; n++)
-                fprintf(of, "<text class=\"t3\" x=\"20\" y=\"%d\">%3.03fs - <![CDATA[%s]]> [%d]</text>\n",
-                        20 + (n * 13),
-                        top[n]->total,
-                        top[n]->name,
-                        top[n]->pid);
-}
-
-static void svg_top_ten_pss(FILE *of, struct ps_struct *ps_first) {
-        struct ps_struct *top[10];
-        struct ps_struct emptyps = {};
-        struct ps_struct *ps;
-        int n, m;
-
-        for (n = 0; n < (int) ELEMENTSOF(top); n++)
-                top[n] = &emptyps;
-
-        /* walk all ps's and setup ptrs */
-        ps = ps_first;
-        while ((ps = get_next_ps(ps, ps_first))) {
-                for (n = 0; n < 10; n++) {
-                        if (ps->pss_max <= top[n]->pss_max)
-                                continue;
-
-                        /* cascade insert */
-                        for (m = 9; m > n; m--)
-                                top[m] = top[m-1];
-                        top[n] = ps;
-                        break;
-                }
-        }
-
-        fprintf(of, "<text class=\"t2\" x=\"20\" y=\"0\">Top PSS consumers:</text>\n");
-        for (n = 0; n < 10; n++)
-                fprintf(of, "<text class=\"t3\" x=\"20\" y=\"%d\">%dK - <![CDATA[%s]]> [%d]</text>\n",
-                        20 + (n * 13),
-                        top[n]->pss_max,
-                        top[n]->name,
-                        top[n]->pid);
-}
-
-int svg_do(FILE *of,
-           const char *build,
-           struct list_sample_data *head,
-           struct ps_struct *ps_first,
-           int n_samples,
-           int pscount,
-           int n_cpus,
-           double graph_start,
-           double log_start,
-           double interval,
-           int overrun) {
-
-        struct ps_struct *ps;
-        double offset = 7;
-        int r, c;
-
-        sampledata = head;
-        LIST_FIND_TAIL(link, sampledata, head);
-        ps = ps_first;
-
-        /* count initcall thread count first */
-        svg_do_initcall(of, head, 1, graph_start);
-        ksize = kcount ? ps_to_graph(kcount) + (arg_scale_y * 2) : 0;
-
-        /* then count processes */
-        while ((ps = get_next_ps(ps, ps_first))) {
-                if (!ps_filter(ps))
-                        pcount++;
-                else
-                        pfiltered++;
-        }
-        psize = ps_to_graph(pcount) + (arg_scale_y * 2);
-
-        esize = (arg_entropy ? arg_scale_y * 7 : 0);
-
-        /* after this, we can draw the header with proper sizing */
-        svg_header(of, head, graph_start, arg_percpu ? n_cpus : 0);
-        fprintf(of, "<rect class=\"bg\" width=\"100%%\" height=\"100%%\" />\n\n");
-
-        fprintf(of, "<g transform=\"translate(10,400)\">\n");
-        svg_io_bi_bar(of, head, n_samples, graph_start, interval);
-        fprintf(of, "</g>\n\n");
-
-        fprintf(of, "<g transform=\"translate(10,%.03f)\">\n", 400.0 + (arg_scale_y * offset));
-        svg_io_bo_bar(of, head, n_samples, graph_start, interval);
-        fprintf(of, "</g>\n\n");
-
-        for (c = -1; c < (arg_percpu ? n_cpus : 0); c++) {
-                offset += 7;
-                fprintf(of, "<g transform=\"translate(10,%.03f)\">\n", 400.0 + (arg_scale_y * offset));
-                svg_cpu_bar(of, head, n_cpus, c, graph_start);
-                fprintf(of, "</g>\n\n");
-
-                offset += 7;
-                fprintf(of, "<g transform=\"translate(10,%.03f)\">\n", 400.0 + (arg_scale_y * offset));
-                svg_wait_bar(of, head, n_cpus, c, graph_start);
-                fprintf(of, "</g>\n\n");
-        }
-
-        if (kcount) {
-                offset += 7;
-                fprintf(of, "<g transform=\"translate(10,%.03f)\">\n", 400.0 + (arg_scale_y * offset));
-                svg_do_initcall(of, head, 0, graph_start);
-                fprintf(of, "</g>\n\n");
-        }
-
-        offset += 7;
-        fprintf(of, "<g transform=\"translate(10,%.03f)\">\n", 400.0 + (arg_scale_y * offset) + ksize);
-        svg_ps_bars(of, head, n_samples, n_cpus, ps_first, graph_start, interval);
-        fprintf(of, "</g>\n\n");
-
-        fprintf(of, "<g transform=\"translate(10,  0)\">\n");
-        r = svg_title(of, build, pscount, log_start, overrun);
-        fprintf(of, "</g>\n\n");
-
-        if (r < 0)
-                return r;
-
-        fprintf(of, "<g transform=\"translate(10,200)\">\n");
-        svg_top_ten_cpu(of, ps_first);
-        fprintf(of, "</g>\n\n");
-
-        if (arg_entropy) {
-                fprintf(of, "<g transform=\"translate(10,%.03f)\">\n", 400.0 + (arg_scale_y * offset) + ksize + psize);
-                svg_entropy_bar(of, head, graph_start);
-                fprintf(of, "</g>\n\n");
-        }
-
-        if (arg_pss) {
-                fprintf(of, "<g transform=\"translate(10,%.03f)\">\n", 400.0 + (arg_scale_y * offset) + ksize + psize + esize);
-                svg_pss_graph(of, head, ps_first, graph_start);
-                fprintf(of, "</g>\n\n");
-
-                fprintf(of, "<g transform=\"translate(410,200)\">\n");
-                svg_top_ten_pss(of, ps_first);
-                fprintf(of, "</g>\n\n");
-        }
-
-        /* fprintf footer */
-        fprintf(of, "\n</svg>\n");
-
-        return 0;
-}
diff --git a/src/bootchart/svg.h b/src/bootchart/svg.h
deleted file mode 100644 (file)
index 6e06b5a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#pragma once
-
-/***
-  This file is part of systemd.
-
-  Copyright (C) 2009-2013 Intel Corporation
-
-  Authors:
-    Auke Kok <auke-jan.h.kok@intel.com>
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-int svg_do(FILE *of,
-           const char *build,
-           struct list_sample_data *head,
-           struct ps_struct *ps_first,
-           int n_samples,
-           int pscount,
-           int n_cpus,
-           double graph_start,
-           double log_start,
-           double interval,
-           int overrun);
index 184c72dbe7ec98541440d69c23893f1a2530ec43..8ede9e9afbcc5460f195294333763b06bd02095a 100644 (file)
@@ -2237,7 +2237,7 @@ int exec_context_load_environment(Unit *unit, const ExecContext *c, char ***l) {
 
                 if (fn[0] == '-') {
                         ignore = true;
-                        fn ++;
+                        fn++;
                 }
 
                 if (!path_is_absolute(fn)) {
index 97304c4d05911bac59749eda4b30930fab7d4220..012cf72d1fa1f59968329512fce0d47139e0d4c2 100644 (file)
@@ -222,7 +222,7 @@ Job* job_install(Job *j) {
         *pj = j;
         j->installed = true;
 
-        j->manager->n_installed_jobs ++;
+        j->manager->n_installed_jobs++;
         log_unit_debug(j->unit,
                        "Installed new job %s/%s as %u",
                        j->unit->id, job_type_to_string(j->type), (unsigned) j->id);
@@ -856,7 +856,7 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive) {
         }
 
         if (result == JOB_FAILED || result == JOB_INVALID)
-                j->manager->n_failed_jobs ++;
+                j->manager->n_failed_jobs++;
 
         job_uninstall(j);
         job_free(j);
index 4a65d174b8b8bc4486aa926c138062fee5d1d70d..e1bfdccbca0435759bf58eff186e5ec692bd9621 100644 (file)
@@ -119,7 +119,7 @@ int config_parse_unit_deps(
         assert(rvalue);
 
         p = rvalue;
-        for(;;) {
+        for (;;) {
                 _cleanup_free_ char *word = NULL, *k = NULL;
                 int r;
 
@@ -620,7 +620,7 @@ int config_parse_exec(
                                 separate_argv0 = true;
                         else
                                 break;
-                        f ++;
+                        f++;
                 }
 
                 if (isempty(f)) {
@@ -668,7 +668,7 @@ int config_parse_exec(
                         /* Check explicitly for an unquoted semicolon as
                          * command separator token.  */
                         if (p[0] == ';' && (!p[1] || strchr(WHITESPACE, p[1]))) {
-                                p ++;
+                                p++;
                                 p += strspn(p, WHITESPACE);
                                 semicolon = true;
                                 break;
@@ -1599,7 +1599,7 @@ int config_parse_service_sockets(
         assert(data);
 
         p = rvalue;
-        for(;;) {
+        for (;;) {
                 _cleanup_free_ char *word = NULL, *k = NULL;
 
                 r = extract_first_word(&p, &word, NULL, 0);
@@ -3361,7 +3361,7 @@ int config_parse_protect_home(
                 ProtectHome h;
 
                 h = protect_home_from_string(rvalue);
-                if (h < 0){
+                if (h < 0) {
                         log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse protect home value, ignoring: %s", rvalue);
                         return 0;
                 }
@@ -3404,7 +3404,7 @@ int config_parse_protect_system(
                 ProtectSystem s;
 
                 s = protect_system_from_string(rvalue);
-                if (s < 0){
+                if (s < 0) {
                         log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse protect system value, ignoring: %s", rvalue);
                         return 0;
                 }
index 3499c2a3d0a1ec416ea5f3de5e2e9cc0b13dbdcf..b4e96fd6f427a16340e7e5829044b420c92c20ae 100644 (file)
@@ -1061,7 +1061,7 @@ static int prepare_reexecute(Manager *m, FILE **_f, FDSet **_fds, bool switching
                 return log_error_errno(r, "Failed to create serialization file: %m");
 
         /* Make sure nothing is really destructed when we shut down */
-        m->n_reloading ++;
+        m->n_reloading++;
         bus_manager_send_reloading(m, true);
 
         fds = fdset_new();
index f36cf5e320b8a7bfe3e4b27d0d342592fdd2f6e1..f13e9335789601ea6074365608d29095a874b017 100644 (file)
@@ -1137,7 +1137,7 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
          * this is already known, so we increase the counter here
          * already */
         if (serialization)
-                m->n_reloading ++;
+                m->n_reloading++;
 
         /* First, enumerate what we can from all config files */
         dual_timestamp_get(&m->units_load_start_timestamp);
@@ -1171,7 +1171,7 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
 
         if (serialization) {
                 assert(m->n_reloading > 0);
-                m->n_reloading --;
+                m->n_reloading--;
 
                 /* Let's wait for the UnitNew/JobNew messages being
                  * sent, before we notify that the reload is
@@ -2231,7 +2231,7 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool switching_root) {
         assert(f);
         assert(fds);
 
-        m->n_reloading ++;
+        m->n_reloading++;
 
         fprintf(f, "current-job-id=%"PRIu32"\n", m->current_job_id);
         fprintf(f, "taint-usr=%s\n", yes_no(m->taint_usr));
@@ -2301,13 +2301,13 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool switching_root) {
 
                 r = unit_serialize(u, f, fds, !switching_root);
                 if (r < 0) {
-                        m->n_reloading --;
+                        m->n_reloading--;
                         return r;
                 }
         }
 
         assert(m->n_reloading > 0);
-        m->n_reloading --;
+        m->n_reloading--;
 
         if (ferror(f))
                 return -EIO;
@@ -2327,7 +2327,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
 
         log_debug("Deserializing state...");
 
-        m->n_reloading ++;
+        m->n_reloading++;
 
         for (;;) {
                 char line[LINE_MAX], *l;
@@ -2495,7 +2495,7 @@ finish:
                 r = -EIO;
 
         assert(m->n_reloading > 0);
-        m->n_reloading --;
+        m->n_reloading--;
 
         return r;
 }
@@ -2511,23 +2511,23 @@ int manager_reload(Manager *m) {
         if (r < 0)
                 return r;
 
-        m->n_reloading ++;
+        m->n_reloading++;
         bus_manager_send_reloading(m, true);
 
         fds = fdset_new();
         if (!fds) {
-                m->n_reloading --;
+                m->n_reloading--;
                 return -ENOMEM;
         }
 
         r = manager_serialize(m, f, fds, false);
         if (r < 0) {
-                m->n_reloading --;
+                m->n_reloading--;
                 return r;
         }
 
         if (fseeko(f, 0, SEEK_SET) < 0) {
-                m->n_reloading --;
+                m->n_reloading--;
                 return -errno;
         }
 
index 1f6d821db3868f90f5c389a65a78f23c131128fd..5d58b0b752a5925f8ab409fbd6d47f2812331c74 100644 (file)
@@ -942,7 +942,7 @@ static void service_set_state(Service *s, ServiceState state) {
                 if (ec && exec_context_may_touch_console(ec)) {
                         Manager *m = UNIT(s)->manager;
 
-                        m->n_on_console --;
+                        m->n_on_console--;
                         if (m->n_on_console == 0)
                                 /* unset no_console_output flag, since the console is free */
                                 m->no_console_output = false;
index a1cb54d77ae3af9f3234dfde68b9fa8ce76291b3..87586c1c2e3587fd1ca0dc5aa71b647fdd997d68 100644 (file)
@@ -1979,7 +1979,7 @@ static void socket_enter_running(Socket *s, int cfd) {
 
                 service = SERVICE(UNIT_DEREF(s->service));
                 unit_ref_unset(&s->service);
-                s->n_accepted ++;
+                s->n_accepted++;
 
                 UNIT(service)->no_gc = false;
 
@@ -1990,7 +1990,7 @@ static void socket_enter_running(Socket *s, int cfd) {
                         goto fail;
 
                 cfd = -1;
-                s->n_connections ++;
+                s->n_connections++;
 
                 r = manager_add_job(UNIT(s)->manager, JOB_START, UNIT(service), JOB_REPLACE, &error, NULL);
                 if (r < 0)
index a458768e7d9f6c4e2230e9471a71b69483eca53b..b953fcc152f4d5f77d338be1feb426d43f0dbab7 100644 (file)
@@ -472,7 +472,7 @@ static int loopback_points_list_detach(MountPoint **head, bool *changed) {
                     major(root_st.st_dev) != 0 &&
                     lstat(m->path, &loopback_st) >= 0 &&
                     root_st.st_dev == loopback_st.st_rdev) {
-                        n_failed ++;
+                        n_failed++;
                         continue;
                 }
 
@@ -507,7 +507,7 @@ static int dm_points_list_detach(MountPoint **head, bool *changed) {
                 if (k >= 0 &&
                     major(root_st.st_dev) != 0 &&
                     root_st.st_dev == m->devnum) {
-                        n_failed ++;
+                        n_failed++;
                         continue;
                 }
 
index 3c4f85e744967ef4cebb11037cf1f8388be4c4b3..af38beb0c3cc9c9f3bc6e10c7fdc26a69b07f63f 100644 (file)
@@ -364,7 +364,7 @@ void unit_add_to_gc_queue(Unit *u) {
         LIST_PREPEND(gc_queue, u->manager->gc_queue, u);
         u->in_gc_queue = true;
 
-        u->manager->n_in_gc_queue ++;
+        u->manager->n_in_gc_queue++;
 }
 
 void unit_add_to_dbus_queue(Unit *u) {
@@ -1864,13 +1864,13 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
                 ec = unit_get_exec_context(u);
                 if (ec && exec_context_may_touch_console(ec)) {
                         if (UNIT_IS_INACTIVE_OR_FAILED(ns)) {
-                                m->n_on_console --;
+                                m->n_on_console--;
 
                                 if (m->n_on_console == 0)
                                         /* unset no_console_output flag, since the console is free */
                                         m->no_console_output = false;
                         } else
-                                m->n_on_console ++;
+                                m->n_on_console++;
                 }
         }
 
index 68806992fc6b63506d1aa11029f32741b86948f6..cc4dad946556d02c32b5c85088b342fd0db0c0d8 100644 (file)
@@ -91,7 +91,7 @@ static int frame_callback(Dwfl_Frame *frame, void *userdata) {
         }
 
         fprintf(c->f, "#%-2u 0x%016" PRIx64 " %s (%s)\n", c->n_frame, (uint64_t) pc, strna(symbol), strna(fname));
-        c->n_frame ++;
+        c->n_frame++;
 
         return DWARF_CB_OK;
 }
@@ -117,7 +117,7 @@ static int thread_callback(Dwfl_Thread *thread, void *userdata) {
         if (dwfl_thread_getframes(thread, frame_callback, c) < 0)
                 return DWARF_CB_ABORT;
 
-        c->n_thread ++;
+        c->n_thread++;
 
         return DWARF_CB_OK;
 }
index b055075e55af5e9980174ee60b9170087c4aeb8f..b4f0ecff2d48308b6b3d472018e4c2fdba7c2d29 100644 (file)
@@ -423,7 +423,7 @@ finish:
         hashmap_free_free(top);
         hashmap_free_free(bottom);
 
-        HASHMAP_FOREACH_KEY(h, key, drops, i){
+        HASHMAP_FOREACH_KEY(h, key, drops, i) {
                 hashmap_free_free(hashmap_remove(drops, key));
                 hashmap_remove(drops, key);
                 free(key);
index 3e57afb9971c02e124270e0678adf033aff8db7e..41b2237d1699a44d289308cf0bac4213b3b57dfc 100644 (file)
@@ -314,7 +314,7 @@ static int server_init(Server *s, unsigned n_sockets) {
                 f->fd = fd;
                 LIST_PREPEND(fifo, s->fifos, f);
                 f->server = s;
-                s->n_fifos ++;
+                s->n_fifos++;
         }
 
         r = bus_connect_system_systemd(&s->bus);
index 3594f70c8728c3919fdda83d141783b728352ffb..32848c767387fb0d59775ada7fd0416d7ceb31d6 100644 (file)
                         entry = document.getElementById("tableentry");
 
                         var buf = "";
-                        for (var key in d){
+                        for (var key in d) {
                                 var data = d[key];
 
                                 if (data == null)
index 44f9a9b44f49e6c69dde926b5ac84b0a8ad68644..35a1e55f9ee2e98e68c1fee305b11d20ec078168 100644 (file)
@@ -434,7 +434,7 @@ static int add_raw_socket(RemoteServer *s, int fd) {
                 return r;
 
         fd_ = -1;
-        s->active ++;
+        s->active++;
         return 0;
 }
 
@@ -742,7 +742,7 @@ static int setup_microhttpd_server(RemoteServer *s,
                 goto error;
         }
 
-        s->active ++;
+        s->active++;
         return 0;
 
 error:
index fc8f63c9e3b79a61c89b2c4d2398d8659645812c..e61b6bc68f5ed12b8ab0282dcc44d21e64aff284 100644 (file)
@@ -52,7 +52,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                                 /* not enough space */
                                 return pos;
 
-                        u->entry_state ++;
+                        u->entry_state++;
 
                         if (pos + r == size) {
                                 /* exactly one character short, but we don't need it */
@@ -76,7 +76,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                                 /* not enough space */
                                 return pos;
 
-                        u->entry_state ++;
+                        u->entry_state++;
 
                         if (r + pos == size) {
                                 /* exactly one character short, but we don't need it */
@@ -101,7 +101,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                                 /* not enough space */
                                 return pos;
 
-                        u->entry_state ++;
+                        u->entry_state++;
 
                         if (r + pos == size) {
                                 /* exactly one character short, but we don't need it */
@@ -126,7 +126,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                                 /* not enough space */
                                 return pos;
 
-                        u->entry_state ++;
+                        u->entry_state++;
 
                         if (r + pos == size) {
                                 /* exactly one character short, but we don't need it */
@@ -156,7 +156,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                                 continue;
                         }
 
-                        u->entry_state ++;
+                        u->entry_state++;
                 }       /* fall through */
 
                 case ENTRY_TEXT_FIELD:
@@ -206,7 +206,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                         pos += len + 1;
 
                         u->field_pos = len + 1;
-                        u->entry_state ++;
+                        u->entry_state++;
                 }       /* fall through */
 
                 case ENTRY_BINARY_FIELD_SIZE: {
@@ -220,7 +220,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                         memcpy(buf + pos, &le64, 8);
                         pos += 8;
 
-                        u->entry_state ++;
+                        u->entry_state++;
                         continue;
                 }
 
@@ -230,8 +230,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                                 return pos;
 
                         buf[pos++] = '\n';
-                        u->entry_state ++;
-                        u->entries_sent ++;
+                        u->entry_state++;
+                        u->entries_sent++;
 
                         return pos;
 
index 440563e7d3a56e151543d4ffedd38a37e42cc970..6e1c3bb9ef45bb78adcdbdb3b79760d415582c40 100644 (file)
@@ -75,7 +75,7 @@ static void close_fd_input(Uploader *u);
                                   curl_easy_strerror(code));            \
                         cmd;                                            \
                 }                                                       \
-        } while(0)
+        } while (0)
 
 static size_t output_callback(char *buf,
                               size_t size,
index 72c2da10f15d4921e1d0a1453d3c9cb491a9ceda..886f6efd8bd2da917f24b75c36c6843accdfd56a 100644 (file)
@@ -217,7 +217,7 @@ int catalog_file_lang(const char* filename, char **lang) {
 
         beg = end - 1;
         while (beg > filename && *beg != '.' && *beg != '/' && end - beg < 32)
-                beg --;
+                beg--;
 
         if (*beg != '.' || end <= beg + 1)
                 return 0;
index f5e2952c997a7ab4f2143fc266e2a6291e71ef46..bed825cdc39f8dad479c413ddce1688efc13326b 100644 (file)
@@ -238,8 +238,10 @@ int journal_file_set_offline(JournalFile *f, bool wait) {
                 journal_file_set_offline_internal(f);
         else {
                 r = pthread_create(&f->offline_thread, NULL, journal_file_set_offline_thread, f);
-                if (r > 0)
+                if (r > 0) {
+                        f->offline_state = OFFLINE_JOINED;
                         return -r;
+                }
         }
 
         return 0;
@@ -2170,7 +2172,7 @@ static int generic_array_bisect_plus_one(
                 goto found;
 
         if (r > 0 && idx)
-                (*idx) ++;
+                (*idx)++;
 
         return r;
 
index c7d670f4fff912430d0d4f32b7ab45cfbad19086..a79846146a3c9175a972f7e94564e778dbad893d 100644 (file)
@@ -50,7 +50,7 @@
                 *_f = alloca(_fl + 10);           \
                 memcpy(*_f, "CODE_FUNC=", 10);    \
                 memcpy(*_f + 10, _func, _fl);     \
-        } while(false)
+        } while (false)
 
 /* We open a single fd, and we'll share it with the current process,
  * all its threads, and all its subprocesses. This means we need to
index 05e97620aee61c744ff6a42c28339238632968db..f09dc66e03cc35a948ebb3cec258f42fd67847a3 100644 (file)
@@ -239,13 +239,13 @@ int journal_directory_vacuum(
                         /* Vacuum corrupted files */
 
                         if (q < 1 + 16 + 1 + 16 + 8 + 1) {
-                                n_active_files ++;
+                                n_active_files++;
                                 continue;
                         }
 
                         if (de->d_name[q-1-8-16-1] != '-' ||
                             de->d_name[q-1-8-16-1-16-1] != '@') {
-                                n_active_files ++;
+                                n_active_files++;
                                 continue;
                         }
 
@@ -256,7 +256,7 @@ int journal_directory_vacuum(
                         }
 
                         if (sscanf(de->d_name + q-1-8-16-1-16, "%16llx-%16llx.journal~", &realtime, &tmp) != 2) {
-                                n_active_files ++;
+                                n_active_files++;
                                 continue;
                         }
 
@@ -302,7 +302,7 @@ int journal_directory_vacuum(
                 list[n_list].realtime = realtime;
                 list[n_list].seqnum_id = seqnum_id;
                 list[n_list].have_seqnum = have_seqnum;
-                n_list ++;
+                n_list++;
 
                 p = NULL;
                 sum += size;
index b968e89bb8db8383add452cb6bbb4da42dcec8c8..a1241c9bcf0a2efdf6a1303a7f7762161838384f 100644 (file)
@@ -97,20 +97,20 @@ static void flush_progress(void) {
         fflush(stdout);
 }
 
-#define debug(_offset, _fmt, ...) do                                  \
+#define debug(_offset, _fmt, ...) do {                                  \
                 flush_progress();                                       \
                 log_debug(OFSfmt": " _fmt, _offset, ##__VA_ARGS__);     \
-        } while(0)
+        } while (0)
 
-#define warning(_offset, _fmt, ...) do                                \
+#define warning(_offset, _fmt, ...) do {                                \
                 flush_progress();                                       \
                 log_warning(OFSfmt": " _fmt, _offset, ##__VA_ARGS__);   \
-        } while(0)
+        } while (0)
 
-#define error(_offset, _fmt, ...) do                                  \
+#define error(_offset, _fmt, ...) do {                                  \
                 flush_progress();                                       \
                 log_error(OFSfmt": " _fmt, (uint64_t)_offset, ##__VA_ARGS__); \
-        } while(0)
+        } while (0)
 
 static int journal_file_object_verify(JournalFile *f, uint64_t offset, Object *o) {
         uint64_t i;
@@ -894,7 +894,7 @@ int journal_file_verify(
                         goto fail;
                 }
 
-                n_objects ++;
+                n_objects++;
 
                 r = journal_file_object_verify(f, p, o);
                 if (r < 0) {
@@ -991,7 +991,7 @@ int journal_file_verify(
                         entry_realtime = le64toh(o->entry.realtime);
                         entry_realtime_set = true;
 
-                        n_entries ++;
+                        n_entries++;
                         break;
 
                 case OBJECT_DATA_HASH_TABLE:
@@ -1131,11 +1131,11 @@ int journal_file_verify(
 
                         last_epoch = le64toh(o->tag.epoch);
 
-                        n_tags ++;
+                        n_tags++;
                         break;
 
                 default:
-                        n_weird ++;
+                        n_weird++;
                 }
 
                 if (p == le64toh(f->header->tail_object_offset)) {
index c111b1f0e12392e5f95c8888785e343b61ec0624..fd2cb99410b43492e06dfbf85526697f4da12319 100644 (file)
@@ -1355,7 +1355,7 @@ static int add_units(sd_journal *j) {
                         r = sd_journal_add_disjunction(j);
                         if (r < 0)
                                 return r;
-                        count ++;
+                        count++;
                 }
         }
 
@@ -1375,7 +1375,7 @@ static int add_units(sd_journal *j) {
                         r = sd_journal_add_disjunction(j);
                         if (r < 0)
                                 return r;
-                        count ++;
+                        count++;
                 }
         }
 
@@ -1400,7 +1400,7 @@ static int add_units(sd_journal *j) {
                         r = sd_journal_add_disjunction(j);
                         if (r < 0)
                                 return r;
-                        count ++;
+                        count++;
                 }
         }
 
@@ -1420,7 +1420,7 @@ static int add_units(sd_journal *j) {
                         r = sd_journal_add_disjunction(j);
                         if (r < 0)
                                 return r;
-                        count ++;
+                        count++;
                 }
         }
 
@@ -2173,7 +2173,7 @@ int main(int argc, char *argv[]) {
 
                 SD_JOURNAL_FOREACH_FIELD(j, field) {
                         printf("%s\n", field);
-                        n_shown ++;
+                        n_shown++;
                 }
 
                 r = 0;
@@ -2265,7 +2265,7 @@ int main(int argc, char *argv[]) {
                         else
                                 printf("%.*s\n", (int) size, (const char*) data);
 
-                        n_shown ++;
+                        n_shown++;
                 }
 
                 r = 0;
index b2eb8a33ef627b038775fd70beeb137fb9376617..a433c91c54a1d960bd8905ca016de252b5dd28b8 100644 (file)
@@ -63,7 +63,7 @@ static int map_simple_field(const char *field, const char **p, struct iovec **io
 
         (*iov)[*n_iov].iov_base = c;
         (*iov)[*n_iov].iov_len = l;
-        (*n_iov) ++;
+        (*n_iov)++;
 
         *p = e;
         c = NULL;
@@ -142,7 +142,7 @@ static int map_string_field_internal(const char *field, const char **p, struct i
 
         (*iov)[*n_iov].iov_base = c;
         (*iov)[*n_iov].iov_len = l;
-        (*n_iov) ++;
+        (*n_iov)++;
 
         *p = e;
         c = NULL;
@@ -200,7 +200,7 @@ static int map_generic_field(const char *prefix, const char **p, struct iovec **
         }
         strcpy(t, "=");
 
-        e ++;
+        e++;
 
         r = map_simple_field(c, &e, iov, n_iov_allocated, n_iov);
         if (r < 0)
index eb1ac90e98b2956a2becc179cb2c79204a686af6..f64abdd43199d346056da537006372eb1f4cdd2b 100644 (file)
@@ -201,7 +201,7 @@ static void dev_kmsg_record(Server *s, const char *p, size_t l) {
                 if (*k != ' ')
                         break;
 
-                k ++, l --;
+                k++, l--;
 
                 e = memchr(k, '\n', l);
                 if (!e)
index 6f6a90fe4e21b44f977cda9903cc8a14d20ba869..fce799a6ce0f3b1e9d5f060d48ce6ad65fffb461 100644 (file)
@@ -104,7 +104,7 @@ static void journal_rate_limit_group_free(JournalRateLimitGroup *g) {
                 LIST_REMOVE(lru, g->parent->lru, g);
                 LIST_REMOVE(bucket, g->parent->buckets[g->hash % BUCKETS_MAX], g);
 
-                g->parent->n_groups --;
+                g->parent->n_groups--;
         }
 
         free(g->id);
@@ -168,7 +168,7 @@ static JournalRateLimitGroup* journal_rate_limit_group_new(JournalRateLimit *r,
         LIST_PREPEND(lru, r->lru, g);
         if (!g->lru_next)
                 r->lru_tail = g;
-        r->n_groups ++;
+        r->n_groups++;
 
         g->parent = r;
         return g;
index d5937bd013c88515b17ac1da4fc54f6f3daebb2b..2939322925f79244b0a61fa6f0d6e2b320642923 100644 (file)
@@ -1407,7 +1407,7 @@ static int server_parse_proc_cmdline(Server *s) {
         }
 
         p = line;
-        for(;;) {
+        for (;;) {
                 _cleanup_free_ char *word = NULL;
 
                 r = extract_first_word(&p, &word, NULL, 0);
index 6e8b405b538e5a9d0e64ae3319c3af4b8a660405..59352bcb3fdabdd5c6a4a7b18902aed63a4212fa 100644 (file)
@@ -96,7 +96,7 @@ void stdout_stream_free(StdoutStream *s) {
 
         if (s->server) {
                 assert(s->server->n_stdout_streams > 0);
-                s->server->n_stdout_streams --;
+                s->server->n_stdout_streams--;
                 LIST_REMOVE(stdout_stream, s->server->stdout_streams, s);
 
                 if (s->in_notify_queue)
@@ -511,7 +511,7 @@ static int stdout_stream_install(Server *s, int fd, StdoutStream **ret) {
 
         stream->server = s;
         LIST_PREPEND(stdout_stream, s->stdout_streams, stream);
-        s->n_stdout_streams ++;
+        s->n_stdout_streams++;
 
         if (ret)
                 *ret = stream;
index 9c0ce8ccbff9e3477a52cabc1241f27de460232c..6bcd9b6ac84782a6c8d77732f32a00d0dd04394a 100644 (file)
@@ -107,7 +107,7 @@ MMapCache* mmap_cache_ref(MMapCache *m) {
         assert(m);
         assert(m->n_ref > 0);
 
-        m->n_ref ++;
+        m->n_ref++;
         return m;
 }
 
@@ -361,7 +361,7 @@ MMapCache* mmap_cache_unref(MMapCache *m) {
 
         assert(m->n_ref > 0);
 
-        m->n_ref --;
+        m->n_ref--;
         if (m->n_ref == 0)
                 mmap_cache_free(m);
 
@@ -598,14 +598,14 @@ int mmap_cache_get(
         /* Check whether the current context is the right one already */
         r = try_context(m, fd, prot, context, keep_always, offset, size, ret);
         if (r != 0) {
-                m->n_hit ++;
+                m->n_hit++;
                 return r;
         }
 
         /* Search for a matching mmap */
         r = find_mmap(m, fd, prot, context, keep_always, offset, size, ret);
         if (r != 0) {
-                m->n_hit ++;
+                m->n_hit++;
                 return r;
         }
 
index 6ff1c67f5fce1c59a296a5a27cc65a4c610e54be..ac75e3931263328e4297b97f9db7fe534360c2c7 100644 (file)
@@ -1063,7 +1063,7 @@ _public_ int sd_journal_test_cursor(sd_journal *j, const char *cursor) {
         if (r < 0)
                 return r;
 
-        for(;;) {
+        for (;;) {
                 _cleanup_free_ char *item = NULL;
                 unsigned long long ll;
                 sd_id128_t id;
@@ -1266,7 +1266,7 @@ static int add_any_file(sd_journal *j, const char *path) {
 
         check_network(j, f->fd);
 
-        j->current_invalidate_counter ++;
+        j->current_invalidate_counter++;
 
         return 0;
 
@@ -1345,7 +1345,7 @@ static void remove_file_real(sd_journal *j, JournalFile *f) {
 
         (void) journal_file_close(f);
 
-        j->current_invalidate_counter ++;
+        j->current_invalidate_counter++;
 }
 
 static int dirname_is_machine_id(const char *fn) {
@@ -1410,7 +1410,7 @@ static int add_directory(sd_journal *j, const char *prefix, const char *dirname)
                 }
 
                 path = NULL; /* avoid freeing in cleanup */
-                j->current_invalidate_counter ++;
+                j->current_invalidate_counter++;
 
                 log_debug("Directory %s added.", m->path);
 
@@ -1495,7 +1495,7 @@ static int add_root_directory(sd_journal *j, const char *p, bool missing_ok) {
                         goto fail;
                 }
 
-                j->current_invalidate_counter ++;
+                j->current_invalidate_counter++;
 
                 log_debug("Root directory %s added.", m->path);
 
@@ -2078,7 +2078,7 @@ _public_ int sd_journal_enumerate_data(sd_journal *j, const void **data, size_t
         if (r < 0)
                 return r;
 
-        j->current_field ++;
+        j->current_field++;
 
         return 1;
 }
index e5e9d9dcb3a6a32ffaf72a6ce51a394b121dfa5c..354c2c3c004b9c5c1ff750640e1c090200b751bc 100644 (file)
@@ -44,7 +44,7 @@ int main(int argc, char *argv[]) {
 
                 printf("%.*s\n", (int) l, (char*) d);
 
-                n ++;
+                n++;
                 if (n >= 10)
                         break;
         }
index 531b80eb0817893d7242c5632952ea54351e3b64..c105196334f24e6ef72f1d655c787a481b6d3c98 100644 (file)
@@ -34,7 +34,7 @@ static int option_append(uint8_t options[], size_t size, size_t *offset,
 
         if (code != SD_DHCP_OPTION_END)
                 /* always make sure there is space for an END option */
-                size --;
+                size--;
 
         switch (code) {
 
index 8d75d4969179d06e76a20f0feb8341d49a280b47..8be774061d67ff7f542c126c0a93a6e206ce5bb9 100644 (file)
@@ -66,7 +66,7 @@ uint16_t dhcp_packet_checksum(uint8_t *buf, size_t len) {
                         /* wrap around in one's complement */
                         sum++;
 
-                buf_64 ++;
+                buf_64++;
         }
 
         if (len % sizeof(uint64_t)) {
index fdafcd84d82a67af2e6641cdf1883d550afdaadb..cb7252bbeb90657252151151cf168c2992cf8937 100644 (file)
@@ -375,7 +375,7 @@ int deserialize_in_addrs(struct in_addr **ret, const char *string) {
                 if (r <= 0)
                         continue;
 
-                size ++;
+                size++;
         }
 
         *ret = addresses;
@@ -482,7 +482,7 @@ int deserialize_dhcp_routes(struct sd_dhcp_route **ret, size_t *ret_size, size_t
                         return -ENOMEM;
 
                 entry = strndup(word, len);
-                if(!entry)
+                if (!entry)
                         return -ENOMEM;
 
                 tok = entry;
index 1c408aaaac8ec663724af914c07b281865ff13f3..9adf8ec19d894701535170ca4797d17c2d0f487b 100644 (file)
@@ -280,10 +280,11 @@ static int dhcp_server_send_unicast_raw(sd_dhcp_server *server,
 }
 
 static int dhcp_server_send_udp(sd_dhcp_server *server, be32_t destination,
+                                uint16_t destination_port,
                                 DHCPMessage *message, size_t len) {
         union sockaddr_union dest = {
                 .in.sin_family = AF_INET,
-                .in.sin_port = htobe16(DHCP_PORT_CLIENT),
+                .in.sin_port = htobe16(destination_port),
                 .in.sin_addr.s_addr = destination,
         };
         struct iovec iov = {
@@ -342,6 +343,7 @@ int dhcp_server_send_packet(sd_dhcp_server *server,
                             DHCPRequest *req, DHCPPacket *packet,
                             int type, size_t optoffset) {
         be32_t destination = INADDR_ANY;
+        uint16_t destination_port = DHCP_PORT_CLIENT;
         int r;
 
         assert(server);
@@ -386,17 +388,19 @@ int dhcp_server_send_packet(sd_dhcp_server *server,
          */
         if (req->message->giaddr) {
                 destination = req->message->giaddr;
+                destination_port = DHCP_PORT_SERVER;
                 if (type == DHCP_NAK)
                         packet->dhcp.flags = htobe16(0x8000);
         } else if (req->message->ciaddr && type != DHCP_NAK)
                 destination = req->message->ciaddr;
 
         if (destination != INADDR_ANY)
-                return dhcp_server_send_udp(server, destination, &packet->dhcp,
+                return dhcp_server_send_udp(server, destination,
+                                            destination_port, &packet->dhcp,
                                             sizeof(DHCPMessage) + optoffset);
         else if (requested_broadcast(req) || type == DHCP_NAK)
                 return dhcp_server_send_udp(server, INADDR_BROADCAST,
-                                            &packet->dhcp,
+                                            destination_port, &packet->dhcp,
                                             sizeof(DHCPMessage) + optoffset);
         else
                 /* we cannot send UDP packet to specific MAC address when the
@@ -579,7 +583,8 @@ static int server_send_forcerenew(sd_dhcp_server *server, be32_t address,
 
         memcpy(&packet->dhcp.chaddr, chaddr, ETH_ALEN);
 
-        r = dhcp_server_send_udp(server, address, &packet->dhcp,
+        r = dhcp_server_send_udp(server, address, DHCP_PORT_CLIENT,
+                                 &packet->dhcp,
                                  sizeof(DHCPMessage) + optoffset);
         if (r < 0)
                 return r;
index 8a26cb877090ee08790160383ccf6d1644efc6a2..cc7436db6bee8db4385b4111a4aff6274cbafe19 100644 (file)
@@ -456,7 +456,7 @@ int sd_ipv4acd_set_callback(sd_ipv4acd *ll, sd_ipv4acd_callback_t cb, void *user
         return 0;
 }
 
-int sd_ipv4acd_set_address(sd_ipv4acd *ll, const struct in_addr *address){
+int sd_ipv4acd_set_address(sd_ipv4acd *ll, const struct in_addr *address) {
         assert_return(ll, -EINVAL);
         assert_return(address, -EINVAL);
         assert_return(ll->state == IPV4ACD_STATE_INIT, -EBUSY);
index aca393aa5e61178c756e646a21088f0be80b1f54..2a06418c53d50e1c0938aee7d2a10c188f76c98d 100644 (file)
@@ -181,7 +181,7 @@ int sd_ipv4ll_set_callback(sd_ipv4ll *ll, sd_ipv4ll_callback_t cb, void *userdat
         return 0;
 }
 
-int sd_ipv4ll_get_address(sd_ipv4ll *ll, struct in_addr *address){
+int sd_ipv4ll_get_address(sd_ipv4ll *ll, struct in_addr *address) {
         assert_return(ll, -EINVAL);
         assert_return(address, -EINVAL);
 
index 7c81e7a25dbaacbb97764b1ad0ae7c9df2833f49..5964a01c4f17e17242041ad992bcb2558fe4b112 100644 (file)
@@ -198,7 +198,7 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
                         else if (type == SD_BUS_TYPE_DICT_ENTRY)
                                 fprintf(f, "%sDICT_ENTRY \"%s\" {\n", prefix, contents);
 
-                        level ++;
+                        level++;
 
                         continue;
                 }
index c2e913f62a63a6cb6d8171cecf5717836437ed0a..542c37e41b58148cda33c51a2bc6d7149cc69c9f 100644 (file)
@@ -1198,7 +1198,7 @@ struct bus_body_part *message_append_part(sd_bus_message *m) {
 
         part->memfd = -1;
         m->body_end = part;
-        m->n_body_parts ++;
+        m->n_body_parts++;
 
         return part;
 }
@@ -1643,7 +1643,7 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void
         }
 
         if (type == SD_BUS_TYPE_UNIX_FD)
-                m->n_fds ++;
+                m->n_fds++;
 
         if (c->enclosing != SD_BUS_TYPE_ARRAY)
                 c->index++;
@@ -2387,9 +2387,9 @@ int bus_message_append_ap(
 
                 t = types;
                 if (n_array != (unsigned) -1)
-                        n_array --;
+                        n_array--;
                 else {
-                        types ++;
+                        types++;
                         n_struct--;
                 }
 
@@ -3866,7 +3866,7 @@ static int build_struct_offsets(
                 if (r < 0)
                         return r;
                 if (r == 0 && p[n] != 0) /* except the last item */
-                        n_variable ++;
+                        n_variable++;
                 n_total++;
 
                 p += n;
@@ -4466,9 +4466,9 @@ static int message_read_ap(
 
                 t = types;
                 if (n_array != (unsigned) -1)
-                        n_array --;
+                        n_array--;
                 else {
-                        types ++;
+                        types++;
                         n_struct--;
                 }
 
index 1f285ae8a667de7b6408495536a90a94804575a3..9bd07ffcabbac14d7b21b7de95959b88e4c65895 100644 (file)
@@ -145,7 +145,7 @@ static int add_enumerated_to_set(
                                 continue;
                         }
 
-                        if (!object_path_is_valid(*k)){
+                        if (!object_path_is_valid(*k)) {
                                 free(*k);
                                 r = -EINVAL;
                                 continue;
@@ -337,7 +337,7 @@ static int check_access(sd_bus *bus, sd_bus_message *m, struct vtable_member *c,
         if (cap == 0)
                 cap = CAP_SYS_ADMIN;
         else
-                cap --;
+                cap--;
 
         r = sd_bus_query_sender_privilege(m, cap);
         if (r < 0)
index a8c74011bf9baa6b4ed22ffb1d7c506612879f06..8e9074c7dfb44e4d45690aa0f74a40a106aff869 100644 (file)
@@ -206,7 +206,7 @@ _public_ sd_bus_slot* sd_bus_slot_unref(sd_bus_slot *slot) {
         assert(slot->n_ref > 0);
 
         if (slot->n_ref > 1) {
-                slot->n_ref --;
+                slot->n_ref--;
                 return NULL;
         }
 
index 13d0aef4b525bc318326b43d29c76b4193611385..f1e2a06050153732f5c56b3ca5095d757b3ff87c 100644 (file)
@@ -60,7 +60,7 @@ static void iovec_advance(struct iovec iov[], unsigned *idx, size_t size) {
                 i->iov_base = NULL;
                 i->iov_len = 0;
 
-                (*idx) ++;
+                (*idx)++;
         }
 }
 
index bdbf7d4a85af2a9c01c326e2d2373068403dd32c..1f436fe5605540bde005979bd60452ab5fac0e93 100644 (file)
@@ -129,7 +129,7 @@ _public_ sd_bus_track* sd_bus_track_unref(sd_bus_track *track) {
         assert(track->n_ref > 0);
 
         if (track->n_ref > 1) {
-                track->n_ref --;
+                track->n_ref--;
                 return NULL;
         }
 
index c6f626d8aac203dea2fd25fb33fb534398fa4a66..cc15afeb1cd8263a9e3175793cb886baee1e7179 100644 (file)
@@ -530,7 +530,7 @@ static void skip_address_key(const char **p) {
         *p += strcspn(*p, ",");
 
         if (**p == ',')
-                (*p) ++;
+                (*p)++;
 }
 
 static int parse_unix_address(sd_bus *b, const char **p, char **guid) {
@@ -695,7 +695,7 @@ static int parse_exec_address(sd_bus *b, const char **p, char **guid) {
                                 goto fail;
                         }
 
-                        (*p) ++;
+                        (*p)++;
 
                         if (ul >= n_argv) {
                                 if (!GREEDY_REALLOC0(argv, allocated, ul + 2)) {
@@ -1668,7 +1668,7 @@ static int dispatch_wqueue(sd_bus *bus) {
                          * it got full, then all bets are off
                          * anyway. */
 
-                        bus->wqueue_size --;
+                        bus->wqueue_size--;
                         sd_bus_message_unref(bus->wqueue[0]);
                         memmove(bus->wqueue, bus->wqueue + 1, sizeof(sd_bus_message*) * bus->wqueue_size);
                         bus->windex = 0;
@@ -1717,7 +1717,7 @@ static int dispatch_rqueue(sd_bus *bus, bool hint_priority, int64_t priority, sd
                         /* Dispatch a queued message */
 
                         *m = bus->rqueue[0];
-                        bus->rqueue_size --;
+                        bus->rqueue_size--;
                         memmove(bus->rqueue, bus->rqueue + 1, sizeof(sd_bus_message*) * bus->rqueue_size);
                         return 1;
                 }
@@ -1809,7 +1809,7 @@ static int bus_send_internal(sd_bus *bus, sd_bus_message *_m, uint64_t *cookie,
                 if (!GREEDY_REALLOC(bus->wqueue, bus->wqueue_allocated, bus->wqueue_size + 1))
                         return -ENOMEM;
 
-                bus->wqueue[bus->wqueue_size ++] = sd_bus_message_ref(m);
+                bus->wqueue[bus->wqueue_size++] = sd_bus_message_ref(m);
         }
 
 finish:
@@ -2257,7 +2257,7 @@ static int process_timeout(sd_bus *bus) {
 
         slot = container_of(c, sd_bus_slot, reply_callback);
 
-        bus->iteration_counter ++;
+        bus->iteration_counter++;
 
         bus->current_message = m;
         bus->current_slot = sd_bus_slot_ref(slot);
index 46d18abd29d61c2351ddd622d2ae5f229925381e..66a3874f10f92b9e799cc645d94d1db35b8163f8 100644 (file)
@@ -146,7 +146,7 @@ static void dump_mapping_table(void) {
                 }
 
                 printf("%s -> %i/%s\n", strna(m->name), m->code, strna(errno_to_name(m->code)));
-                m ++;
+                m++;
         }
         printf("---------------------------\n");
 }
index 4e50b61979a0b74c41ad210e5094ffa7bbf274c8..bd1c7f15ff4a7b986444ce375db13349deea6a40 100644 (file)
@@ -465,7 +465,7 @@ _public_ int sd_pid_notify_with_fds(pid_t pid, int unset_environment, const char
         have_pid = pid != 0 && pid != getpid();
 
         if (n_fds > 0 || have_pid) {
-                /* CMSG_SPACE(0) may return value different then zero, which results in miscalculated controllen. */
+                /* CMSG_SPACE(0) may return value different than zero, which results in miscalculated controllen. */
                 msghdr.msg_controllen =
                         (n_fds > 0 ? CMSG_SPACE(sizeof(int) * n_fds) : 0) +
                         (have_pid ? CMSG_SPACE(sizeof(struct ucred)) : 0);
index f2af3ab3ae3a7878b771ba132c9acd787edd86f6..9082d377f4d12a9f84157d45efb3718e23539c5b 100644 (file)
@@ -890,7 +890,7 @@ void device_cleanup_tags(sd_device *device) {
         set_free_free(device->tags);
         device->tags = NULL;
         device->property_tags_outdated = true;
-        device->tags_generation ++;
+        device->tags_generation++;
 }
 
 void device_cleanup_devlinks(sd_device *device) {
@@ -899,7 +899,7 @@ void device_cleanup_devlinks(sd_device *device) {
         set_free_free(device->devlinks);
         device->devlinks = NULL;
         device->property_devlinks_outdated = true;
-        device->devlinks_generation ++;
+        device->devlinks_generation++;
 }
 
 void device_remove_tag(sd_device *device, const char *tag) {
@@ -908,7 +908,7 @@ void device_remove_tag(sd_device *device, const char *tag) {
 
         free(set_remove(device->tags, tag));
         device->property_tags_outdated = true;
-        device->tags_generation ++;
+        device->tags_generation++;
 }
 
 static int device_tag(sd_device *device, const char *tag, bool add) {
index fdd8c05e9c5af35783d6666b86217c0cc6b15270..8657e61cd9ee9f97047a90538ee396b65bf17f4f 100644 (file)
@@ -136,7 +136,7 @@ int device_add_property_aux(sd_device *device, const char *_key, const char *_va
         }
 
         if (!db) {
-                device->properties_generation ++;
+                device->properties_generation++;
                 device->properties_buf_outdated = true;
         }
 
@@ -309,7 +309,7 @@ _public_ int sd_device_new_from_subsystem_sysname(sd_device **ret, const char *s
                         if (name[len] == '/')
                                 name[len] = '!';
 
-                        len ++;
+                        len++;
                 }
 
                 syspath = strjoina("/sys/subsystem/", subsystem, "/devices/", name);
@@ -669,7 +669,7 @@ _public_ int sd_device_new_from_device_id(sd_device **ret, const char *id) {
                         return -EINVAL;
 
                 sysname[0] = '\0';
-                sysname ++;
+                sysname++;
 
                 return sd_device_new_from_subsystem_sysname(ret, subsys, sysname);
         }
@@ -971,7 +971,7 @@ static int device_set_sysname(sd_device *device) {
         pos = strrchr(device->devpath, '/');
         if (!pos)
                 return -EINVAL;
-        pos ++;
+        pos++;
 
         /* devpath is not a root directory */
         if (*pos == '\0' || pos <= device->devpath)
@@ -986,7 +986,7 @@ static int device_set_sysname(sd_device *device) {
                 if (sysname[len] == '!')
                         sysname[len] = '/';
 
-                len ++;
+                len++;
         }
 
         /* trailing number */
@@ -1066,7 +1066,7 @@ int device_add_tag(sd_device *device, const char *tag) {
         if (r < 0)
                 return r;
 
-        device->tags_generation ++;
+        device->tags_generation++;
         device->property_tags_outdated = true;
 
         return 0;
@@ -1086,7 +1086,7 @@ int device_add_devlink(sd_device *device, const char *devlink) {
         if (r < 0)
                 return r;
 
-        device->devlinks_generation ++;
+        device->devlinks_generation++;
         device->property_devlinks_outdated = true;
 
         return 0;
index 2b46a1ff06f724a264321edf0bdf0507a2c51528..841358ed03c73a9a0cb32136b5a0bfe1baeeffa7 100644 (file)
@@ -951,7 +951,7 @@ static sd_event_source *source_new(sd_event *e, bool floating, EventSourceType t
                 sd_event_ref(e);
 
         LIST_PREPEND(sources, e->sources, s);
-        e->n_sources ++;
+        e->n_sources++;
 
         return s;
 }
@@ -1235,7 +1235,7 @@ _public_ int sd_event_add_child(
                 return r;
         }
 
-        e->n_enabled_child_sources ++;
+        e->n_enabled_child_sources++;
 
         r = event_make_signal_data(e, SIGCHLD, NULL);
         if (r < 0) {
index daea4126f863b6981347ddeb75197d222cfa2935..fd31588b8f2ba1d47144ba07ef8453b63ad835b7 100644 (file)
@@ -291,7 +291,7 @@ static int n_rtqueue = 0;
 
 static int rtqueue_handler(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
         last_rtqueue_sigval = si->ssi_int;
-        n_rtqueue ++;
+        n_rtqueue++;
         return 0;
 }
 
index 3a866fdafe0104469c72801bf0b9f0f227302e73..3924300817835c54b87aa43e434d9327c128c547 100644 (file)
@@ -34,7 +34,7 @@
 #include "util.h"
 
 #define GET_CONTAINER(m, i) ((i) < (m)->n_containers ? (struct rtattr*)((uint8_t*)(m)->hdr + (m)->containers[i].offset) : NULL)
-#define PUSH_CONTAINER(m, new) (m)->container_offsets[(m)->n_containers ++] = (uint8_t*)(new) - (uint8_t*)(m)->hdr;
+#define PUSH_CONTAINER(m, new) (m)->container_offsets[(m)->n_containers++] = (uint8_t*)(new) - (uint8_t*)(m)->hdr;
 
 #define RTA_TYPE(rta) ((rta)->rta_type & NLA_TYPE_MASK)
 #define RTA_FLAGS(rta) ((rta)->rta_type & ~NLA_TYPE_MASK)
@@ -467,7 +467,7 @@ int sd_netlink_message_open_container(sd_netlink_message *m, unsigned short type
         if (r < 0)
                 return r;
 
-        m->containers[m->n_containers ++].offset = r;
+        m->containers[m->n_containers++].offset = r;
 
         return 0;
 }
@@ -498,7 +498,7 @@ int sd_netlink_message_open_container_union(sd_netlink_message *m, unsigned shor
         if (r < 0)
                 return r;
 
-        m->containers[m->n_containers ++].offset = r;
+        m->containers[m->n_containers++].offset = r;
 
         return 0;
 }
@@ -510,7 +510,7 @@ int sd_netlink_message_close_container(sd_netlink_message *m) {
         assert_return(m->n_containers > 0, -EINVAL);
 
         m->containers[m->n_containers].type_system = NULL;
-        m->n_containers --;
+        m->n_containers--;
 
         return 0;
 }
@@ -528,7 +528,7 @@ static int netlink_message_read_internal(sd_netlink_message *m, unsigned short t
 
         attribute = &m->containers[m->n_containers].attributes[type];
 
-        if(!attribute->offset)
+        if (!attribute->offset)
                 return -ENODATA;
 
         rta = (struct rtattr*)((uint8_t *) m->hdr + attribute->offset);
@@ -735,7 +735,7 @@ static int netlink_container_parse(sd_netlink_message *m,
         _cleanup_free_ struct netlink_attribute *attributes = NULL;
 
         attributes = new0(struct netlink_attribute, count);
-        if(!attributes)
+        if (!attributes)
                 return -ENOMEM;
 
         for (; RTA_OK(rta, rt_len); rta = RTA_NEXT(rta, rt_len)) {
@@ -842,7 +842,7 @@ int sd_netlink_message_enter_container(sd_netlink_message *m, unsigned short typ
         else
                 size = (size_t)r;
 
-        m->n_containers ++;
+        m->n_containers++;
 
         r = netlink_container_parse(m,
                                     &m->containers[m->n_containers],
@@ -850,7 +850,7 @@ int sd_netlink_message_enter_container(sd_netlink_message *m, unsigned short typ
                                     container,
                                     size);
         if (r < 0) {
-                m->n_containers --;
+                m->n_containers--;
                 return r;
         }
 
@@ -867,7 +867,7 @@ int sd_netlink_message_exit_container(sd_netlink_message *m) {
         m->containers[m->n_containers].attributes = mfree(m->containers[m->n_containers].attributes);
         m->containers[m->n_containers].type_system = NULL;
 
-        m->n_containers --;
+        m->n_containers--;
 
         return 0;
 }
index 590fc53fc78cf02c0bc5ce4598518e550de6da3e..c165fa33592710a62c2835023f09977e3f464853 100644 (file)
@@ -82,7 +82,7 @@ static int broadcast_groups_get(sd_netlink *nl) {
                 return r;
 
         for (i = 0; i < len; i++) {
-                for (j = 0; j < sizeof(uint32_t) * 8; j ++) {
+                for (j = 0; j < sizeof(uint32_t) * 8; j++) {
                         uint32_t offset;
                         unsigned group;
 
@@ -168,7 +168,7 @@ int socket_broadcast_group_ref(sd_netlink *nl, unsigned group) {
 
         n_ref = broadcast_group_get_ref(nl, group);
 
-        n_ref ++;
+        n_ref++;
 
         r = hashmap_ensure_allocated(&nl->broadcast_group_refs, NULL);
         if (r < 0)
@@ -216,7 +216,7 @@ int socket_broadcast_group_unref(sd_netlink *nl, unsigned group) {
 
         assert(n_ref > 0);
 
-        n_ref --;
+        n_ref--;
 
         r = broadcast_group_set_ref(nl, group, n_ref);
         if (r < 0)
@@ -444,14 +444,14 @@ int socket_read_message(sd_netlink *rtnl) {
                 if (r < 0)
                         return r;
 
-                rtnl->rqueue[rtnl->rqueue_size ++] = first;
+                rtnl->rqueue[rtnl->rqueue_size++] = first;
                 first = NULL;
 
                 if (multi_part && (i < rtnl->rqueue_partial_size)) {
                         /* remove the message form the partial read queue */
                         memmove(rtnl->rqueue_partial + i,rtnl->rqueue_partial + i + 1,
                                 sizeof(sd_netlink_message*) * (rtnl->rqueue_partial_size - i - 1));
-                        rtnl->rqueue_partial_size --;
+                        rtnl->rqueue_partial_size--;
                 }
 
                 return 1;
@@ -465,7 +465,7 @@ int socket_read_message(sd_netlink *rtnl) {
                         if (r < 0)
                                 return r;
 
-                        rtnl->rqueue_partial[rtnl->rqueue_partial_size ++] = first;
+                        rtnl->rqueue_partial[rtnl->rqueue_partial_size++] = first;
                 }
                 first = NULL;
 
index f5c2b33f460d5811a3803bcf30dcfb612a6735d6..91701405a59ee0628461900cbfc87e82d2d18193 100644 (file)
@@ -279,7 +279,7 @@ static int dispatch_rqueue(sd_netlink *rtnl, sd_netlink_message **message) {
 
         /* Dispatch a queued message */
         *message = rtnl->rqueue[0];
-        rtnl->rqueue_size --;
+        rtnl->rqueue_size--;
         memmove(rtnl->rqueue, rtnl->rqueue + 1, sizeof(sd_netlink_message*) * rtnl->rqueue_size);
 
         return 1;
index de5e0ffc8fc89fca3ba55fc3872929eb901de5dc..f9b6787187744cf47410f248067542abaeb4222a 100644 (file)
@@ -234,7 +234,7 @@ static int pipe_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata)
         int *counter = userdata;
         int r;
 
-        (*counter) --;
+        (*counter)--;
 
         r = sd_netlink_message_get_errno(m);
 
@@ -276,10 +276,10 @@ static void test_pipe(int ifindex) {
         assert_se(sd_rtnl_message_new_link(rtnl, &m1, RTM_GETLINK, ifindex) >= 0);
         assert_se(sd_rtnl_message_new_link(rtnl, &m2, RTM_GETLINK, ifindex) >= 0);
 
-        counter ++;
+        counter++;
         assert_se(sd_netlink_call_async(rtnl, m1, &pipe_handler, &counter, 0, NULL) >= 0);
 
-        counter ++;
+        counter++;
         assert_se(sd_netlink_call_async(rtnl, m2, &pipe_handler, &counter, 0, NULL) >= 0);
 
         while (counter > 0) {
index 580047d3ab58e1c6625f2b11b9e06c3dceae4554..f8e18f23fdd49e84e142e2f99b272d209edc1292 100644 (file)
@@ -209,7 +209,6 @@ _public_ int sd_network_link_get_route_domains(int ifindex, char ***ret) {
 
 static int network_link_get_ifindexes(int ifindex, const char *key, int **ret) {
         char path[strlen("/run/systemd/netif/links/") + DECIMAL_STR_MAX(ifindex) + 1];
-        _cleanup_strv_free_ char **a = NULL;
         _cleanup_free_ int *ifis = NULL;
         _cleanup_free_ char *s = NULL;
         size_t allocated = 0, c = 0;
index 910e75441f5794db578b632c7143d11a906aa9d7..37585048b818c32da552304a25cb08a2804180d7 100644 (file)
@@ -447,7 +447,7 @@ static int start_threads(sd_resolve *resolve, unsigned extra) {
                 if (r != 0)
                         return -r;
 
-                resolve->n_valid_workers ++;
+                resolve->n_valid_workers++;
         }
 
         return 0;
@@ -657,7 +657,7 @@ static int complete_query(sd_resolve *resolve, sd_resolve_query *q) {
         assert(q->resolve == resolve);
 
         q->done = true;
-        resolve->n_done ++;
+        resolve->n_done++;
 
         resolve->current = sd_resolve_query_ref(q);
 
index e416e178b4fa057c5d78374a644ef1367cf8701f..3b8abfb2607ba4ead4a0991b684689f8bb8cec7d 100644 (file)
@@ -112,7 +112,7 @@ _public_ struct udev_enumerate *udev_enumerate_new(struct udev *udev) {
  **/
 _public_ struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) {
         if (udev_enumerate)
-                udev_enumerate->refcount ++;
+                udev_enumerate->refcount++;
 
         return udev_enumerate;
 }
index f0fe59cc675ba461b5ae5cc378be1a670a05ff07..cc86c61edb8a7e71f34628b127334ac4a0147cc0 100644 (file)
@@ -542,7 +542,7 @@ static int read_next_mapping(const char* filename,
                         return 0;
                 }
 
-                (*n) ++;
+                (*n)++;
 
                 l = strstrip(line);
                 if (l[0] == 0 || l[0] == '#')
index 7a7a1bb42b8551c5bd442d154e0cb86091504289..7d4270a8fffe350737f398e2ce3acf701c834270 100644 (file)
@@ -310,7 +310,7 @@ int machine_load(Machine *m) {
                 int *ni = NULL;
 
                 p = netif;
-                for(;;) {
+                for (;;) {
                         _cleanup_free_ char *word = NULL;
                         int ifi;
 
index b756603f3d8a3a22b3dff5ad758c8840a985e00d..e49c90fd1b28b87a659f05f6e4653ff95618a84f 100644 (file)
@@ -172,7 +172,7 @@ static int list_machines(int argc, char *argv[], void *userdata) {
                 if (l > max_service)
                         max_service = l;
 
-                n_machines ++;
+                n_machines++;
         }
         if (r < 0)
                 return bus_log_parse_error(r);
@@ -1755,7 +1755,7 @@ static int transfer_image_common(sd_bus *bus, sd_bus_message *m) {
 
         r = sd_bus_call(bus, m, 0, &error, &reply);
         if (r < 0) {
-                log_error("Failed transfer image: %s", bus_error_message(&error, -r));
+                log_error("Failed to transfer image: %s", bus_error_message(&error, -r));
                 return r;
         }
 
@@ -2228,7 +2228,7 @@ static int list_transfers(int argc, char *argv[], void *userdata) {
                 if (id > max_id)
                         max_id = id;
 
-                n_transfers ++;
+                n_transfers++;
         }
         if (r < 0)
                 return bus_log_parse_error(r);
index b9330993304b78ec012740ddda3c73c9b241ddff..20894433e7d7f826935acd88a5d898e620f28723 100644 (file)
@@ -1212,7 +1212,7 @@ int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_err
         r = unit_name_from_dbus_path(path, &unit);
         if (r == -EINVAL) /* not for a unit */
                 return 0;
-        if (r < 0){
+        if (r < 0) {
                 log_oom();
                 return 0;
         }
index 1eaaeb60095bb38fcaf40aedac23ce1e4f2d4fe3..0679114f74bbde8acfe0dedf11025cbe9af6c360 100644 (file)
@@ -893,10 +893,43 @@ static char *lldp_capabilities_to_string(uint16_t x) {
         return ret;
 }
 
+static void lldp_capabilities_legend(uint16_t x) {
+        unsigned w, i, cols = columns();
+        static const char* const table[] = {
+                "o - Other",
+                "p - Repeater",
+                "b - Bridge",
+                "w - WLAN Access Point",
+                "r - Router",
+                "t - Telephone",
+                "d - DOCSIS cable device",
+                "a - Station",
+                "c - Customer VLAN",
+                "s - Service VLAN",
+                "m - Two-port MAC Relay (TPMR)",
+        };
+
+        if (x == 0)
+                return;
+
+        printf("\nCapability Flags:\n");
+        for (w = 0, i = 0; i < ELEMENTSOF(table); i++)
+                if (x & (1U << i) || arg_all) {
+                        bool newline;
+
+                        newline = w + strlen(table[i]) + (w == 0 ? 0 : 2) > cols;
+                        if (newline)
+                                w = 0;
+                        w += printf("%s%s%s", newline ? "\n" : "", w == 0 ? "" : "; ", table[i]);
+                }
+        puts("");
+}
+
 static int link_lldp_status(int argc, char *argv[], void *userdata) {
         _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
         _cleanup_free_ LinkInfo *links = NULL;
         int i, r, c, m = 0;
+        uint16_t all = 0;
 
         r = sd_netlink_open(&rtnl);
         if (r < 0)
@@ -974,8 +1007,10 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
                                         port_description = pdesc;
                         }
 
-                        if (sd_lldp_neighbor_get_enabled_capabilities(n, &cc) >= 0)
+                        if (sd_lldp_neighbor_get_enabled_capabilities(n, &cc) >= 0) {
                                 capabilities = lldp_capabilities_to_string(cc);
+                                all |= cc;
+                        }
 
                         printf("%-16s %-17s %-16s %-11s %-17s %-16s\n",
                                links[i].name,
@@ -989,12 +1024,10 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
                 }
         }
 
-        if (arg_legend)
-                printf("\nCapability Flags:\n"
-                       "o - Other; p - Repeater;  b - Bridge; w - WLAN Access Point; r - Router;\n"
-                       "t - Telephone; d - DOCSIS cable device; a - Station; c - Customer VLAN;\n"
-                       "s - Service VLAN, m - Two-port MAC Relay (TPMR)\n\n"
-                       "%i neighbors listed.\n", m);
+        if (arg_legend) {
+                lldp_capabilities_legend(all);
+                printf("\n%i neighbors listed.\n", m);
+        }
 
         return 0;
 }
index 03c28bbcb613527ef8d41ce07946ea365ca73152..68998eabf2dd65767411f472e83eb8be67e13785 100644 (file)
@@ -34,7 +34,7 @@ static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m,
         assert(link);
         assert(link->dhcp4_messages > 0);
 
-        link->dhcp4_messages --;
+        link->dhcp4_messages--;
 
         r = sd_netlink_message_get_errno(m);
         if (r < 0 && r != -EEXIST) {
@@ -96,7 +96,7 @@ static int link_set_dhcp_routes(Link *link) {
                 if (r < 0)
                         return log_link_warning_errno(link, r, "Could not set host route: %m");
 
-                link->dhcp4_messages ++;
+                link->dhcp4_messages++;
 
                 route->family = AF_INET;
                 route->gw.in = gateway;
@@ -110,7 +110,7 @@ static int link_set_dhcp_routes(Link *link) {
                         return r;
                 }
 
-                link->dhcp4_messages ++;
+                link->dhcp4_messages++;
         }
 
         n = sd_dhcp_lease_get_routes(link->dhcp_lease, &static_routes);
@@ -137,7 +137,7 @@ static int link_set_dhcp_routes(Link *link) {
                 if (r < 0)
                         return log_link_warning_errno(link, r, "Could not set host route: %m");
 
-                link->dhcp4_messages ++;
+                link->dhcp4_messages++;
         }
 
         return 0;
index 1538caa204ddba5b8d2b5ce2916202f2fbf824ea..241f4862117d4e4f4064eda5ab9ee466037feb2f 100644 (file)
@@ -37,7 +37,7 @@ int fdb_entry_new_static(Network *const network,
         assert(network);
 
         /* search entry in hashmap first. */
-        if(section) {
+        if (section) {
                 fdb_entry = hashmap_get(network->fdb_entries_by_section, UINT_TO_PTR(section));
                 if (fdb_entry) {
                         *ret = fdb_entry;
@@ -141,10 +141,10 @@ int fdb_entry_configure(Link *const link, FdbEntry *const fdb_entry) {
 
 /* remove and FDB entry. */
 void fdb_entry_free(FdbEntry *fdb_entry) {
-        if(!fdb_entry)
+        if (!fdb_entry)
                 return;
 
-        if(fdb_entry->network) {
+        if (fdb_entry->network) {
                 LIST_REMOVE(static_fdb_entries, fdb_entry->network->static_fdb_entries,
                             fdb_entry);
 
index 949c75337cd449afcf649a74ae3fc78f5c6fe6f6..e05fd3eea7bbbb61b0dc0ddb996de094f339587f 100644 (file)
@@ -165,7 +165,7 @@ static int ipv4ll_address_claimed(sd_ipv4ll *ll, Link *link) {
         return 0;
 }
 
-static void ipv4ll_handler(sd_ipv4ll *ll, int event, void *userdata){
+static void ipv4ll_handler(sd_ipv4ll *ll, int event, void *userdata) {
         Link *link = userdata;
         int r;
 
index 85a439b2a5d2a2cd4ba6d6d1a87b952de7367de6..ff4bd76554f56c8d00065d581443d9896cf94880 100644 (file)
@@ -473,7 +473,7 @@ Link *link_unref(Link *link) {
 
         assert(link->n_ref > 0);
 
-        link->n_ref --;
+        link->n_ref--;
 
         if (link->n_ref > 0)
                 return NULL;
@@ -489,7 +489,7 @@ Link *link_ref(Link *link) {
 
         assert(link->n_ref > 0);
 
-        link->n_ref ++;
+        link->n_ref++;
 
         return link;
 }
@@ -677,7 +677,7 @@ static int route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata
                       LINK_STATE_SETTING_ROUTES, LINK_STATE_FAILED,
                       LINK_STATE_LINGER));
 
-        link->link_messages --;
+        link->link_messages--;
 
         if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
                 return 1;
@@ -713,7 +713,7 @@ static int link_enter_set_routes(Link *link) {
                         return r;
                 }
 
-                link->link_messages ++;
+                link->link_messages++;
         }
 
         if (link->link_messages == 0) {
@@ -755,7 +755,7 @@ static int address_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userda
         assert(IN_SET(link->state, LINK_STATE_SETTING_ADDRESSES,
                LINK_STATE_FAILED, LINK_STATE_LINGER));
 
-        link->link_messages --;
+        link->link_messages--;
 
         if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
                 return 1;
@@ -882,7 +882,7 @@ static int link_enter_set_addresses(Link *link) {
                         return r;
                 }
 
-                link->link_messages ++;
+                link->link_messages++;
         }
 
         /* now that we can figure out a default address for the dhcp server,
@@ -1031,7 +1031,7 @@ static int link_set_bridge_fdb(Link *const link) {
 
         LIST_FOREACH(static_fdb_entries, fdb_entry, link->network->static_fdb_entries) {
                 r = fdb_entry_configure(link, fdb_entry);
-                if(r < 0) {
+                if (r < 0) {
                         log_link_error_errno(link, r, "Failed to add MAC entry to static MAC table: %m");
                         break;
                 }
@@ -1836,7 +1836,7 @@ static int link_joined(Link *link) {
                 }
         }
 
-        if(link->network->bridge) {
+        if (link->network->bridge) {
                 r = link_set_bridge(link);
                 if (r < 0)
                         log_link_error_errno(link, r, "Could not set bridge message: %m");
@@ -1852,7 +1852,7 @@ static int netdev_join_handler(sd_netlink *rtnl, sd_netlink_message *m, void *us
         assert(link);
         assert(link->network);
 
-        link->enslaving --;
+        link->enslaving--;
 
         if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
                 return 1;
@@ -1908,7 +1908,7 @@ static int link_enter_join_netdev(Link *link) {
                         return r;
                 }
 
-                link->enslaving ++;
+                link->enslaving++;
         }
 
         if (link->network->bridge) {
@@ -1929,7 +1929,7 @@ static int link_enter_join_netdev(Link *link) {
                         return r;
                 }
 
-                link->enslaving ++;
+                link->enslaving++;
         }
 
         HASHMAP_FOREACH(netdev, link->network->stacked_netdevs, i) {
@@ -1951,7 +1951,7 @@ static int link_enter_join_netdev(Link *link) {
                         return r;
                 }
 
-                link->enslaving ++;
+                link->enslaving++;
         }
 
         return 0;
@@ -2440,7 +2440,7 @@ network_file_fail:
                                 continue;
                         }
 
-                        *prefixlen_str ++ = '\0';
+                        *prefixlen_str++ = '\0';
 
                         r = sscanf(prefixlen_str, "%hhu", &prefixlen);
                         if (r != 1) {
@@ -2487,7 +2487,7 @@ network_file_fail:
                                 continue;
                         }
 
-                        *prefixlen_str ++ = '\0';
+                        *prefixlen_str++ = '\0';
 
                         r = sscanf(prefixlen_str, "%hhu/%hhu/%"SCNu32"/%hhu/"USEC_FMT, &prefixlen, &tos, &priority, &table, &lifetime);
                         if (r != 5) {
index 3e8932e160468809fe9a00599cefce3286e0a040..4577292e444b2f3543531a181b4e11bb69912ba3 100644 (file)
@@ -33,7 +33,7 @@ static int ndisc_netlink_handler(sd_netlink *rtnl, sd_netlink_message *m, void *
         assert(link);
         assert(link->ndisc_messages > 0);
 
-        link->ndisc_messages --;
+        link->ndisc_messages--;
 
         r = sd_netlink_message_get_errno(m);
         if (r < 0 && r != -EEXIST) {
@@ -99,7 +99,7 @@ static void ndisc_prefix_autonomous_handler(sd_ndisc *nd, const struct in6_addr
                 return;
         }
 
-        link->ndisc_messages ++;
+        link->ndisc_messages++;
 }
 
 static void ndisc_prefix_onlink_handler(sd_ndisc *nd, const struct in6_addr *prefix, unsigned prefixlen, unsigned lifetime, void *userdata) {
@@ -137,7 +137,7 @@ static void ndisc_prefix_onlink_handler(sd_ndisc *nd, const struct in6_addr *pre
                 return;
         }
 
-        link->ndisc_messages ++;
+        link->ndisc_messages++;
 }
 
 static void ndisc_router_handler(sd_ndisc *nd, uint8_t flags, const struct in6_addr *gateway, unsigned lifetime, int pref, void *userdata) {
@@ -187,7 +187,7 @@ static void ndisc_router_handler(sd_ndisc *nd, uint8_t flags, const struct in6_a
                 return;
         }
 
-        link->ndisc_messages ++;
+        link->ndisc_messages++;
 }
 
 static void ndisc_handler(sd_ndisc *nd, int event, void *userdata) {
index 106f15fabc420ec55a0f60a6d35372d34b07b072..6b9cbcded6ba7bb4e260256108dd9dc8319b3c1d 100644 (file)
@@ -375,7 +375,7 @@ int config_parse_arp_ip_target_address(const char *unit,
                 }
 
                 LIST_PREPEND(arp_ip_target, b->arp_ip_targets, buffer);
-                b->n_arp_ip_targets ++;
+                b->n_arp_ip_targets++;
 
                 buffer = NULL;
         }
index cdf443862d617d9485ef2416cba1d2a4e4ee97fa..32917fe6d5e44282d1b2eb6f3a72ce2a202fc400 100644 (file)
@@ -88,7 +88,7 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
 
         assert(t);
 
-        if(t->user_name) {
+        if (t->user_name) {
 
                 user = t->user_name;
 
@@ -127,7 +127,7 @@ static int netdev_create_tuntap(NetDev *netdev) {
         int r;
 
         r = netdev_fill_tuntap_message(netdev, &ifr);
-        if(r < 0)
+        if (r < 0)
                 return r;
 
         return netdev_tuntap_add(netdev, &ifr);
index eb9a2c06b338eff165812aeff1c7c3a72da69f2a..dabbd97c87da24f30aa897abb1942e942178777a 100644 (file)
@@ -54,13 +54,13 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli
         if (r < 0)
                 return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LINK attribute: %m");
 
-        if(v->ttl) {
+        if (v->ttl) {
                 r = sd_netlink_message_append_u8(m, IFLA_VXLAN_TTL, v->ttl);
                 if (r < 0)
                         return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TTL attribute: %m");
         }
 
-        if(v->tos) {
+        if (v->tos) {
                 r = sd_netlink_message_append_u8(m, IFLA_VXLAN_TOS, v->tos);
                 if (r < 0)
                         return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TOS attribute: %m");
@@ -86,7 +86,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli
         if (r < 0)
                 return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_L3MISS attribute: %m");
 
-        if(v->fdb_ageing) {
+        if (v->fdb_ageing) {
                 r = sd_netlink_message_append_u32(m, IFLA_VXLAN_AGEING, v->fdb_ageing / USEC_PER_SEC);
                 if (r < 0)
                         return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_AGEING attribute: %m");
index fcb1efaa740e7a267a384f1bb3007f3c1028932f..74a0ae865b40f929c36865d5917b9bcf20da9747 100644 (file)
@@ -232,7 +232,7 @@ int setup_veth_extra(
                 if (r < 0)
                         return r;
 
-                idx ++;
+                idx++;
         }
 
         return 0;
index 5a68fec6038184185760fe0a6a2fe9bcb80a4615..4851c439c97f94b4349df16185bb92350c5ae739 100644 (file)
@@ -561,7 +561,7 @@ static int parse_argv(int argc, char *argv[]) {
                 case ARG_CAPABILITY:
                 case ARG_DROP_CAPABILITY: {
                         p = optarg;
-                        for(;;) {
+                        for (;;) {
                                 _cleanup_free_ char *t = NULL;
 
                                 r = extract_first_word(&p, &t, ",", 0);
@@ -2560,7 +2560,7 @@ static int inner_child(
 
         envp[n_env] = strv_find_prefix(environ, "TERM=");
         if (envp[n_env])
-                n_env ++;
+                n_env++;
 
         if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: "/root") < 0) ||
             (asprintf((char**)(envp + n_env++), "USER=%s", arg_user ? arg_user : "root") < 0) ||
@@ -3618,7 +3618,7 @@ int main(int argc, char *argv[]) {
                         /* We failed to wait for the container, or the
                          * container exited abnormally */
                         goto finish;
-                else if (r > 0 || container_status == CONTAINER_TERMINATED){
+                else if (r > 0 || container_status == CONTAINER_TERMINATED) {
                         /* The container exited with a non-zero
                          * status, or with zero status and no reboot
                          * was requested. */
index 1582d702f8ccad43cf4aad3ca8f3f143203b425c..8d57b26cbc5ee8826c52da0fafed7b1fcf9ea498 100644 (file)
@@ -66,7 +66,7 @@ static int count_addresses(sd_bus_message *m, int af, unsigned *ret) {
                 if (af != AF_UNSPEC && family != af)
                         continue;
 
-                c ++;
+                c++;
         }
         if (r < 0)
                 return r;
index 69c0d9bdc13169aa9af1de41725b40d780bc31a2..0de6bd2241066501b07dc3d931d9030a28e2ce3f 100644 (file)
@@ -90,7 +90,7 @@ static int count_addresses(sd_bus_message *m, int af, const char **canonical) {
                 if (af != AF_UNSPEC && family != af)
                         continue;
 
-                c ++;
+                c++;
         }
         if (r < 0)
                 return r;
index a138be2421e9104918cd4ffc2f4b13797e0b729f..16cae8c1e599e1ac140fa77f2afcadffcf6aefc4 100644 (file)
@@ -188,7 +188,7 @@ static void bus_method_resolve_hostname_complete(DnsQuery *q) {
                 if (!canonical)
                         canonical = dns_resource_record_ref(rr);
 
-                added ++;
+                added++;
         }
 
         if (added <= 0) {
@@ -418,7 +418,7 @@ static void bus_method_resolve_address_complete(DnsQuery *q) {
                 if (r < 0)
                         goto finish;
 
-                added ++;
+                added++;
         }
 
         if (added <= 0) {
@@ -587,7 +587,7 @@ static void bus_method_resolve_record_complete(DnsQuery *q) {
                 if (r < 0)
                         goto finish;
 
-                added ++;
+                added++;
         }
 
         if (added <= 0) {
@@ -1094,9 +1094,9 @@ static void bus_method_resolve_service_complete(DnsQuery *q) {
                 }
 
                 if ((q->flags & SD_RESOLVED_NO_ADDRESS) == 0) {
-                        q->block_all_complete ++;
+                        q->block_all_complete++;
                         r = resolve_service_hostname(q, rr, ifindex);
-                        q->block_all_complete --;
+                        q->block_all_complete--;
 
                         if (r < 0)
                                 goto finish;
@@ -1137,7 +1137,6 @@ finish:
 static int bus_method_resolve_service(sd_bus_message *message, void *userdata, sd_bus_error *error) {
         _cleanup_(dns_question_unrefp) DnsQuestion *question_idna = NULL, *question_utf8 = NULL;
         const char *name, *type, *domain;
-        _cleanup_free_ char *n = NULL;
         Manager *m = userdata;
         int family, ifindex;
         uint64_t flags;
index bb93fbfda2d49e2ef382b320fc8c53f6bddd91f3..990dc03b60b1a2a6f813f487e1083984863824a3 100644 (file)
@@ -59,7 +59,7 @@ int manager_parse_dns_server_string_and_warn(Manager *m, DnsServerType type, con
         assert(m);
         assert(string);
 
-        for(;;) {
+        for (;;) {
                 _cleanup_free_ char *word = NULL;
 
                 r = extract_first_word(&string, &word, NULL, 0);
@@ -114,7 +114,7 @@ int manager_parse_search_domains_and_warn(Manager *m, const char *string) {
         assert(m);
         assert(string);
 
-        for(;;) {
+        for (;;) {
                 _cleanup_free_ char *word = NULL;
 
                 r = extract_first_word(&string, &word, NULL, EXTRACT_QUOTES);
index c08f7a7eddad6be243cea572f8747af279016e68..0dadf8b1dd14a6e2a384870aebeea4a66a0f9cbc 100644 (file)
@@ -538,7 +538,7 @@ int dns_answer_remove_by_key(DnsAnswer **a, const DnsResourceKey *key) {
 
                         dns_resource_record_unref((*a)->items[i].rr);
                         memmove((*a)->items + i, (*a)->items + i + 1, sizeof(DnsAnswerItem) * ((*a)->n_rrs - i - 1));
-                        (*a)->n_rrs --;
+                        (*a)->n_rrs--;
                         continue;
 
                 } else
@@ -624,7 +624,7 @@ int dns_answer_remove_by_rr(DnsAnswer **a, DnsResourceRecord *rm) {
 
                         dns_resource_record_unref((*a)->items[i].rr);
                         memmove((*a)->items + i, (*a)->items + i + 1, sizeof(DnsAnswerItem) * ((*a)->n_rrs - i - 1));
-                        (*a)->n_rrs --;
+                        (*a)->n_rrs--;
                         continue;
 
                 } else
@@ -757,7 +757,7 @@ int dns_answer_reserve_or_clone(DnsAnswer **a, unsigned n_free) {
         assert(a);
 
         /* Tries to extend the DnsAnswer object. And if that's not
-         * possibly, since we are not the sole owner, then allocate a
+         * possible, since we are not the sole owner, then allocate a
          * new, appropriately sized one. Either way, after this call
          * the object will only have a single reference, and has room
          * for at least the specified number of RRs. */
index fb957db9efdd4990a8e4197ff0b73922a42e6cac..77c42d7aad8d7c7454ef6324606221d129d4761d 100644 (file)
@@ -640,7 +640,7 @@ int dns_cache_put(
 
         cache_keys = dns_answer_size(answer);
         if (key)
-                cache_keys ++;
+                cache_keys++;
 
         /* Make some space for our new entries */
         dns_cache_make_space(c, cache_keys);
@@ -987,7 +987,7 @@ int dns_cache_export_shared_to_packet(DnsCache *cache, DnsPacket *p) {
                         if (r < 0)
                                 return r;
 
-                        ancount ++;
+                        ancount++;
                 }
         }
 
index 2e41dae6562577d23ac858431c568c3048d23ba6..b7907bb5114426235f914b0d953065a2e037ee20 100644 (file)
@@ -38,8 +38,8 @@ static void rewind_dns_packet(DnsPacketRewinder *rewinder) {
                 dns_packet_rewind(rewinder->packet, rewinder->saved_rindex);
 }
 
-#define INIT_REWINDER(rewinder, p) do { rewinder.packet = p; rewinder.saved_rindex = p->rindex; } while(0)
-#define CANCEL_REWINDER(rewinder) do { rewinder.packet = NULL; } while(0)
+#define INIT_REWINDER(rewinder, p) do { rewinder.packet = p; rewinder.saved_rindex = p->rindex; } while (0)
+#define CANCEL_REWINDER(rewinder) do { rewinder.packet = NULL; } while (0)
 
 int dns_packet_new(DnsPacket **ret, DnsProtocol protocol, size_t mtu) {
         DnsPacket *p;
@@ -1469,7 +1469,7 @@ static int dns_packet_read_type_window(DnsPacket *p, Bitmap **types, size_t *sta
                                         return r;
                         }
 
-                        bit ++;
+                        bit++;
                         bitmask >>= 1;
                 }
         }
index a7496aa586d9cd0eee4eca131bcf522bc87f25b4..a46674f6feb7de757a0aa2f38b7b16836c741663 100644 (file)
@@ -927,7 +927,7 @@ static int dns_query_cname_redirect(DnsQuery *q, const DnsResourceRecord *cname)
 
         assert(q);
 
-        q->n_cname_redirects ++;
+        q->n_cname_redirects++;
         if (q->n_cname_redirects > CNAME_MAX)
                 return -ELOOP;
 
index 646e34598dad930f51a576fc17020e8d8c7c985c..020a2abd77c7965502ce9ea5bc95bafd9104177b 100644 (file)
@@ -82,7 +82,7 @@ enum {
 struct DnsResourceKey {
         unsigned n_ref; /* (unsigned -1) for const keys, see below */
         uint16_t class, type;
-        char *_name; /* don't access directy, use dns_resource_key_name()! */
+        char *_name; /* don't access directly, use dns_resource_key_name()! */
 };
 
 /* Creates a temporary resource key. This is only useful to quickly
index 27342a0e04ce5ad1a42763303368d6cccdb0a911..49d488cec5ead9240d15cd7ce82f4c1fdf66c5ba 100644 (file)
@@ -120,7 +120,7 @@ DnsServer* dns_server_ref(DnsServer *s)  {
                 return NULL;
 
         assert(s->n_ref > 0);
-        s->n_ref ++;
+        s->n_ref++;
 
         return s;
 }
@@ -130,7 +130,7 @@ DnsServer* dns_server_unref(DnsServer *s)  {
                 return NULL;
 
         assert(s->n_ref > 0);
-        s->n_ref --;
+        s->n_ref--;
 
         if (s->n_ref > 0)
                 return NULL;
@@ -290,9 +290,9 @@ void dns_server_packet_lost(DnsServer *s, int protocol, DnsServerFeatureLevel le
 
         if (s->possible_feature_level == level) {
                 if (protocol == IPPROTO_UDP)
-                        s->n_failed_udp ++;
+                        s->n_failed_udp++;
                 else if (protocol == IPPROTO_TCP)
-                        s->n_failed_tcp ++;
+                        s->n_failed_tcp++;
         }
 
         if (s->resend_timeout > usec)
index 3443f71976b20c33ba38a67aac1a2a99ffa8cbec..57f9455131e224f3cc96cff3e53bea87ca94c228 100644 (file)
@@ -209,7 +209,7 @@ int dns_transaction_new(DnsTransaction **ret, DnsScope *s, DnsResourceKey *key)
         LIST_PREPEND(transactions_by_scope, s->transactions, t);
         t->scope = s;
 
-        s->manager->n_transactions_total ++;
+        s->manager->n_transactions_total++;
 
         if (ret)
                 *ret = t;
@@ -1375,7 +1375,7 @@ static int dns_transaction_make_packet_mdns(DnsTransaction *t) {
                 other->state = DNS_TRANSACTION_PENDING;
                 other->next_attempt_after = ts;
 
-                qdcount ++;
+                qdcount++;
 
                 if (dns_key_is_shared(other->key))
                         add_known_answers = true;
index 6ccbdca20ebdbbfd7720455326aa1ecb54a9effa..40d650949db4b3b8b87d5c5613a2b4a496a93293 100644 (file)
@@ -301,7 +301,7 @@ int manager_etc_hosts_read(Manager *m) {
         FOREACH_LINE(line, f, return log_error_errno(errno, "Failed to read /etc/hosts: %m")) {
                 char *l;
 
-                nr ++;
+                nr++;
 
                 l = strstrip(line);
                 if (isempty(l))
index 065427b69091f6b64e66a0ae5823d2270684ed22..ff03acc772b40a68bdc7d1b9a88fd9a8386314da 100644 (file)
@@ -158,7 +158,7 @@ static void write_resolv_conf_server(DnsServer *s, FILE *f, unsigned *count) {
 
         if (*count == MAXNS)
                 fputs("# Too many DNS servers configured, the following entries may be ignored.\n", f);
-        (*count) ++;
+        (*count)++;
 
         fprintf(f, "nameserver %s\n", s->server_string);
 }
@@ -184,7 +184,7 @@ static void write_resolv_conf_search(
         }
 
         (*length) += strlen(domain);
-        (*count) ++;
+        (*count)++;
 
         fputc(' ', f);
         fputs(domain, f);
index 1abbd3fa2e0f7f22f06bfe871c4b397a416258da..c232a69ce121c9ec8a32537c9cd18aae07e9d009 100644 (file)
@@ -89,7 +89,6 @@ static void test_packet_from_file(const char* filename, bool canonical) {
 int main(int argc, char **argv) {
         int i, N;
         _cleanup_globfree_ glob_t g = {};
-        _cleanup_strv_free_ char **globs = NULL;
         char **fnames;
 
         log_parse_environment();
index a093d86a91054aaedb62348a7fad82bf6ec2735e..c9b5ffa62b3f1d6447e9bc1199e653b2e16a8b2b 100644 (file)
@@ -327,10 +327,12 @@ static void test_dnssec_nsec3_hash(void) {
 int main(int argc, char*argv[]) {
 
         test_dnssec_canonicalize();
+#ifdef HAVE_GCRYPT
         test_dnssec_verify_dns_key();
         test_dnssec_verify_rrset();
         test_dnssec_verify_rrset2();
         test_dnssec_nsec3_hash();
+#endif
 
         return 0;
 }
index c87eaf63d843eeb4b1bacf023db131798dd8f58a..b102a79da8f8c7da5c14cada364bb45214402a73 100644 (file)
@@ -843,7 +843,7 @@ int bus_print_property(const char *name, sd_bus_message *property, bool all) {
                         if (r < 0)
                                 return r;
 
-                        while((r = sd_bus_message_read_basic(property, SD_BUS_TYPE_STRING, &str)) > 0) {
+                        while ((r = sd_bus_message_read_basic(property, SD_BUS_TYPE_STRING, &str)) > 0) {
                                 _cleanup_free_ char *escaped = NULL;
 
                                 if (first)
@@ -1412,7 +1412,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
                 return bus_log_create_error(r);
 
         field = strndupa(assignment, eq - assignment);
-        eq ++;
+        eq++;
 
         if (streq(field, "CPUQuota")) {
 
index f93785865ef8b5c807997e04460cc1afa26d938c..3a45ed265c6ec0996a48859b6e18a9e42e8910b4 100644 (file)
@@ -295,7 +295,7 @@ static int condition_test_needs_update(Condition *c) {
                 return false;
 
         /* Any other failure means we should allow the condition to be true,
-         * so that we rather invoke too many update tools then too
+         * so that we rather invoke too many update tools than too
          * few. */
 
         if (!path_is_absolute(c->parameter))
index a91c94c322eb8fb5c6844ba687b8e1a92c5c08a4..73fb1324134411b3dd3e5aad3d2df9245b8d12a0 100644 (file)
@@ -178,7 +178,7 @@ int config_parse_personality(const char *unit, const char *filename, unsigned li
                 assert(data);                                                  \
                                                                                \
                 xs = new0(type, 1);                                            \
-                if(!xs)                                                        \
+                if (!xs)                                                       \
                         return -ENOMEM;                                        \
                                                                                \
                 *xs = invalid;                                                 \
index 0fc2a31f04624b6e15a9b89765b702a0180fae07..835557c6b2c67ed4e6ffba61e810c8ba4d391f81 100644 (file)
@@ -180,7 +180,7 @@ int dns_label_unescape_suffix(const char *name, const char **label_terminal, cha
                         unsigned slashes = 0;
 
                         for (y = terminal - 1; y >= name && *y == '\\'; y--)
-                                slashes ++;
+                                slashes++;
 
                         if (slashes % 2 == 0) {
                                 /* The '.' was not escaped */
@@ -192,7 +192,7 @@ int dns_label_unescape_suffix(const char *name, const char **label_terminal, cha
                         }
                 }
 
-                terminal --;
+                terminal--;
         }
 
         r = dns_label_unescape(&name, dest, sz);
@@ -1172,7 +1172,7 @@ int dns_name_skip(const char *a, unsigned n_labels, const char **ret) {
         assert(a);
         assert(ret);
 
-        for (; n_labels > 0; n_labels --) {
+        for (; n_labels > 0; n_labels--) {
                 r = dns_name_parent(&a);
                 if (r < 0)
                         return r;
index b88724384930d7242fb00cebc4368c0efb62f613..4ff94520c357ea582b1d90ce2e69669f4552170a 100644 (file)
@@ -32,7 +32,7 @@ void initialize_libgcrypt(bool secmem) {
         p = gcry_check_version("1.4.5");
         assert(p);
 
-        /* Turn off "secmem". Clients which whish to make use of this
+        /* Turn off "secmem". Clients which wish to make use of this
          * feature should initialize the library manually */
         if (!secmem)
                 gcry_control(GCRYCTL_DISABLE_SECMEM);
index 5eb3bd35c79c6e4b5bf6d9b1b52fb352ed0b06d2..e2d2931c51a773a9c15b13496e4cab50b9a3fca7 100644 (file)
@@ -997,7 +997,7 @@ static int show_journal(FILE *f,
                                         continue;
                         }
 
-                        line ++;
+                        line++;
                         maybe_print_begin_newline(f, &flags);
 
                         r = output_journal(f, j, mode, n_columns, flags, ellipsized);
index a0aef66bc820bc3cac8e6fb95a2b5c1c3842d102..35aa60101fb033947609a29ebe36fc2787c40a44 100644 (file)
@@ -37,7 +37,7 @@
 #include "string-util.h"
 #include "strv.h"
 
-#define USE(x, y) do{ (x) = (y); (y) = NULL; } while(0)
+#define USE(x, y) do { (x) = (y); (y) = NULL; } while (0)
 
 int parse_sleep_config(const char *verb, char ***_modes, char ***_states) {
 
index eb251492c3719dc91aa2e6b707e53d6dbb9a8bf7..b6ec47439084cedcefd488a147c34f4a94c8174c 100644 (file)
@@ -54,7 +54,7 @@ static void uid_range_coalesce(UidRange **p, unsigned *n) {
                                 if (*n > j+1)
                                         memmove(y, y+1, sizeof(UidRange) * (*n - j -1));
 
-                                (*n) --;
+                                (*n)--;
                                 j--;
                         }
                 }
index 99d4b62139b8ebc5307dc03a3fc5fd0464f31c41..1157a0c72e4bfffa57badfe98000268f7b52134e 100644 (file)
@@ -427,7 +427,7 @@ static int resolve_remote(Connection *c) {
         service = strrchr(arg_remote_host, ':');
         if (service) {
                 node = strndupa(arg_remote_host, service - arg_remote_host);
-                service ++;
+                service++;
         } else {
                 node = arg_remote_host;
                 service = "80";
index 4ef4dc280e40f1487cafb45000bed65df4992fab..a4491692a92ffe2e2ce52bfa76b0a6bd3a52af5f 100644 (file)
@@ -1428,7 +1428,7 @@ static int list_unit_files(int argc, char *argv[], void *userdata) {
                         };
 
                         if (output_show_unit_file(&units[c], strv_skip(argv, 1)))
-                                c ++;
+                                c++;
 
                 }
                 if (r < 0)
@@ -1476,7 +1476,7 @@ static int list_dependencies_print(const char *name, int level, unsigned int bra
                 printf("%s", draw_special_char(last ? DRAW_TREE_RIGHT : DRAW_TREE_BRANCH));
         }
 
-        if (arg_full){
+        if (arg_full) {
                 printf("%s\n", name);
                 return 0;
         }
@@ -6542,7 +6542,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                         }
 
                         p = optarg;
-                        for(;;) {
+                        for (;;) {
                                 _cleanup_free_ char *type = NULL;
 
                                 r = extract_first_word(&p, &type, ",", 0);
@@ -6592,7 +6592,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                                         return log_oom();
                         } else {
                                 p = optarg;
-                                for(;;) {
+                                for (;;) {
                                         _cleanup_free_ char *prop = NULL;
 
                                         r = extract_first_word(&p, &prop, ",", 0);
@@ -6702,11 +6702,11 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                         break;
 
                 case ARG_FORCE:
-                        arg_force ++;
+                        arg_force++;
                         break;
 
                 case 'f':
-                        arg_force ++;
+                        arg_force++;
                         break;
 
                 case ARG_NO_RELOAD:
@@ -6777,7 +6777,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                         }
 
                         p = optarg;
-                        for(;;) {
+                        for (;;) {
                                 _cleanup_free_ char *s = NULL;
 
                                 r = extract_first_word(&p, &s, ",", 0);
@@ -7172,7 +7172,7 @@ static int telinit_parse_argv(int argc, char *argv[]) {
 
         arg_action = table[i].to;
 
-        optind ++;
+        optind++;
 
         return 1;
 }
index 8a72576ec8327ae9d69c38e10dab2985293e646d..3c44d63021bce5ebf69cc12eeca6474d6a328264 100644 (file)
@@ -82,8 +82,6 @@ _SD_BEGIN_DECLARATIONS;
 
 #define SD_MESSAGE_INVALID_CONFIGURATION SD_ID128_MAKE(c7,72,d2,4e,9a,88,4c,be,b9,ea,12,62,5c,30,6c,01)
 
-#define SD_MESSAGE_BOOTCHART        SD_ID128_MAKE(9f,26,aa,56,2c,f4,40,c2,b1,6c,77,3d,04,79,b5,18)
-
 #define SD_MESSAGE_DNSSEC_FAILURE   SD_ID128_MAKE(16,75,d7,f1,72,17,40,98,b1,10,8b,f8,c7,dc,8f,5d)
 #define SD_MESSAGE_DNSSEC_TRUST_ANCHOR_REVOKED SD_ID128_MAKE(4d,44,08,cf,d0,d1,44,85,91,84,d1,e6,5d,7c,8a,65)
 #define SD_MESSAGE_DNSSEC_DOWNGRADE SD_ID128_MAKE(36,db,2d,fa,5a,90,45,e1,bd,4a,f5,f9,3e,1c,f0,57)
index b5925a47dc9bf03f2e326d5806dc501a6982eadb..59e1a3e92199e9f00a865cf486d3d1443816241b 100644 (file)
@@ -864,7 +864,7 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic
                                 }
 
                                 service = hashmap_get(all_services, name);
-                                if (!service){
+                                if (!service) {
                                         log_debug("Ignoring %s symlink in %s, not generating %s.", de->d_name, rcnd_table[i].path, name);
                                         continue;
                                 }
index d021be4671a3da853cb7f6ff1a74646d46c2a81b..0d2e4bfc1513d2ccf1f88b26f38bdeb0e6fd3990 100644 (file)
@@ -91,7 +91,7 @@ static void test_exec_personality(Manager *m) {
 #elif defined(__s390__)
         test(m, "exec-personality-s390.service", 0, CLD_EXITED);
 
-#else
+#elif defined(__i386__)
         test(m, "exec-personality-x86.service", 0, CLD_EXITED);
 #endif
 }
index 79ff6ae74db6e7099507ce256b54fb507b1143be..bc6dd0926c12220923a3c4ca11be9ada1f98f498 100644 (file)
@@ -68,10 +68,10 @@ static int test_tunnel_configure(sd_netlink *rtnl) {
 
         /* skip test if module cannot be loaded */
         r = load_module("ipip");
-        if(r < 0)
+        if (r < 0)
                 return EXIT_TEST_SKIP;
 
-        if(getuid() != 0)
+        if (getuid() != 0)
                 return EXIT_TEST_SKIP;
 
         /* IPIP tunnel */
@@ -99,7 +99,7 @@ static int test_tunnel_configure(sd_netlink *rtnl) {
         assert_se((m = sd_netlink_message_unref(m)) == NULL);
 
         r = load_module("sit");
-        if(r < 0)
+        if (r < 0)
                 return EXIT_TEST_SKIP;
 
         /* sit */
index 7a3b145414900b6740417c2a4a67d24b1fbe5a33..1e704a03dc1d8b4f1a5a1d77afdd898ad6ed0bba 100644 (file)
@@ -93,7 +93,7 @@ static void check_stop_unlink(Manager *m, Unit *unit, const char *test_path, con
 
         ts = now(CLOCK_MONOTONIC);
         /* We process events until the service related to the path has been successfully started */
-        while(service->result != SERVICE_SUCCESS || service->state != SERVICE_START) {
+        while (service->result != SERVICE_SUCCESS || service->state != SERVICE_START) {
                 usec_t n;
                 int r;
 
index 9062c3f3c1cbc22c1615fbd74e205c69f1b3b5c6..ee7d55c5ab6e265820bd268f90a0513a3fd3b986 100644 (file)
@@ -220,7 +220,7 @@ int main(int argc, char *argv[]) {
 
         /* Ensure TIME_T_MAX works correctly */
         x = (uintmax_t) TIME_T_MAX;
-        x ++;
+        x++;
         assert((time_t) x < 0);
 
         return 0;
index b0c343590d86d21a836bcabc1024bb23b90dc1d5..cc6c61ba634cd3d632ac374e8392e9c14e428a76 100644 (file)
@@ -606,7 +606,7 @@ static void test_install_printf(void) {
                 } else assert_se(t == NULL);                            \
                 strcpy(i.name, d1);                                     \
                 strcpy(i.path, d2);                                     \
-        } while(false)
+        } while (false)
 
         expect(i, "%n", "name.service");
         expect(i, "%N", "name");
index 6a6c5522a765365cefac3f9acad75d0c8ba537d2..2a7ba17637bb59ffe8f77b2b8f20567ee337d014 100644 (file)
@@ -73,7 +73,7 @@ void probe_smart_media(int mtd_fd, mtd_info_t* info)
         for (offset = 0 ; offset < block_size * spare_count ;
                                                 offset += sector_size) {
                 lseek(mtd_fd, SEEK_SET, offset);
-                if (read(mtd_fd, cis_buffer, SM_SECTOR_SIZE) == SM_SECTOR_SIZE){
+                if (read(mtd_fd, cis_buffer, SM_SECTOR_SIZE) == SM_SECTOR_SIZE) {
                         cis_found = 1;
                         break;
                 }
index 3a3d8a1770038ae11316c2ec845e21c031311c85..51a55cdbc4b6abc3c054b807c2bc898fb11dc43c 100644 (file)
@@ -177,7 +177,7 @@ static bool test_pointers(struct udev_device *dev,
         has_mt_coordinates = test_bit(ABS_MT_POSITION_X, bitmask_abs) && test_bit(ABS_MT_POSITION_Y, bitmask_abs);
 
         /* unset has_mt_coordinates if devices claims to have all abs axis */
-        if(has_mt_coordinates && test_bit(ABS_MT_SLOT, bitmask_abs) && test_bit(ABS_MT_SLOT - 1, bitmask_abs))
+        if (has_mt_coordinates && test_bit(ABS_MT_SLOT, bitmask_abs) && test_bit(ABS_MT_SLOT - 1, bitmask_abs))
                 has_mt_coordinates = false;
         is_direct = test_bit(INPUT_PROP_DIRECT, bitmask_props);
         has_touch = test_bit(BTN_TOUCH, bitmask_key);
index f9cb5e63a2497e7e91aa62de382fb2898938feeb..b5f7f0d512df7e6de94120b8a36561bdcc8a01a8 100644 (file)
@@ -100,7 +100,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) {
         udev_list_init(udev, &subsystem_match_list, true);
         udev_list_init(udev, &tag_match_list, true);
 
-        while((c = getopt_long(argc, argv, "pekus:t:h", options, NULL)) >= 0)
+        while ((c = getopt_long(argc, argv, "pekus:t:h", options, NULL)) >= 0)
                 switch (c) {
                 case 'p':
                 case 'e':
index ff427cf29217e125d96b0f9c3bd330847d823ec4..702dbe528299234f178b8f18a8efe460280be9e8 100644 (file)
@@ -61,7 +61,7 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) {
 
         log_debug("version %s", VERSION);
 
-        while((c = getopt_long(argc, argv, "a:N:h", options, NULL)) >= 0)
+        while ((c = getopt_long(argc, argv, "a:N:h", options, NULL)) >= 0)
                 switch (c) {
                 case 'a':
                         action = optarg;
index 8091683feed9a572dcf1ec5adc1c9b6d4f539b4d..256ff3dc5daec3fb5cab9cf5a75aeb524ca50c5f 100755 (executable)
@@ -131,15 +131,6 @@ TEMPLATE = '''\
                 <variablelist id='systemd-directives' />
         </refsect1>
 
-        <refsect1>
-                <title>bootchart.conf directives</title>
-
-                <para>Directives for configuring the behaviour of the
-                systemd-bootchart process.</para>
-
-                <variablelist id='bootchart-directives' />
-        </refsect1>
-
         <refsect1>
                 <title>command line options</title>
 
index e62fd0146614844799a27bb9be540139e283f0fa..47e99154ee8ef831641271477fe1f7bbe38731f6 100644 (file)
@@ -22,7 +22,6 @@
 /systemd-ask-password-wall.service
 /systemd-backlight@.service
 /systemd-binfmt.service
-/systemd-bootchart.service
 /systemd-coredump@.service
 /systemd-firstboot.service
 /systemd-fsck-root.service
diff --git a/units/systemd-bootchart.service.in b/units/systemd-bootchart.service.in
deleted file mode 100644 (file)
index 396817f..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-# Note: it's usually a better idea to run systemd-bootchart via the
-# init= kernel command line switch. See the man page for details.
-
-[Unit]
-Description=Boot Process Profiler
-Documentation=man:systemd-bootchart.service(1) man:bootchart.conf(5)
-DefaultDependencies=no
-
-[Service]
-ExecStart=@rootlibexecdir@/systemd-bootchart -r
-
-[Install]
-WantedBy=sysinit.target
index d3238cf8f55e0dbb2684a68cc4a814256ec0d82c..b74ad72cdcd90105248bdf4e9425621461bc232c 100644 (file)
@@ -8,6 +8,7 @@
 [Unit]
 Description=Virtual Machine and Container Download Service
 Documentation=man:systemd-importd.service(8)
+Documentation=http://www.freedesktop.org/wiki/Software/systemd/importd
 
 [Service]
 ExecStart=@rootlibexecdir@/systemd-importd
index c674b27cedb2f19ffd928013efbae266f0dbefa1..8e1c1dea794c3f869b2e6e0cb99dc3ea513ff477 100644 (file)
@@ -8,6 +8,9 @@
 [Unit]
 Description=Network Name Resolution
 Documentation=man:systemd-resolved.service(8)
+Documentation=http://www.freedesktop.org/wiki/Software/systemd/resolved
+Documentation=http://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
+Documentation=http://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
 After=systemd-networkd.service network.target
 
 # On kdbus systems we pull in the busname explicitly, because it