Commit Graph

589 Commits

Author SHA1 Message Date
Lennart Poettering b2b33eb064 Revert "build: install /etc/systemd/{system,user}-generators"
This reverts commit 509276f2b7.
2019-04-02 21:09:35 +02:00
Lennart Poettering bfe6bb2007 meson: bump so versions
Since we aren't quite ready for release v242 yet, let's not bump the
package version yet, but let's already bump the soversion.
2019-04-02 17:31:41 +02:00
Topi Miettinen 509276f2b7 build: install /etc/systemd/{system,user}-generators
Manual page systemd.generators refers to /etc/systemd/{system,user}-generators,
but the paths do not exist, so let's install them.
2019-04-02 07:53:32 +02:00
Zbigniew Jędrzejewski-Szmek a73f621384 meson: disable warnings about unused variables for NDEBUG builds
With assertions disabled, we'd get a bunch of warnings that really bring no
value. With this change, a default meson build with -Db_ndebug=true generates
no warnings.
2019-03-28 09:45:19 +01:00
Lennart Poettering 63a3b3cb70 systemctl: split out some SysV compat stuff into its own C file
systemctl.c is way to large already. Let's split out some stuff out that
is easy to split out.
2019-03-25 15:23:08 +01:00
Franck Bui 8238423095 meson: add libseccomp as a nspawn dep (#12067)
Due to this specific change: d0b6a10#diff-0203416587516c224c8fcfe8129e7caeR8,
systemd-nspawn uses libseccomp now if it is available. We we need to pass -I/usr/include
/libseccomp (or wherever seccomp.h is located) when compiling systemd-nspawn because
nspawn-settings.h does #include <seccomp.h>.

Fixes: #12060
2019-03-22 11:09:08 +01:00
Michael Biebl 055a083a47 Re-add uaccess tag for /dev/dri/renderD*
Setting an access mode != 0666 is explicitly supported via -Dgroup-render-mode
In such a case, re-add the uaccess tag.

This is basically the same change that was done for /dev/kvm in
commit fa53e24130 and
ace5e3111c
and partially reverts the changes from
4e15a7343c
2019-03-14 11:08:58 +01:00
Davide Cavalca 1485aacb16 meson: scope more git invocations with current_source_dir() 2019-03-12 15:01:47 +01:00
Zbigniew Jędrzejewski-Szmek eed336233c build-sys: disable -Wstring-plus-int
clang-8 warns about constructs like "foobar"+3 (to get "bar"). We
like to use patterns like this, so let's just disable the warning.
2019-03-07 10:58:49 +01:00
Lennart Poettering c03f9cec42
Merge pull request #11898 from keszybz/meson-conv-lib
Use a convenience library for the sources shared between core/ and shutdown/
2019-03-06 10:46:18 +01:00
Zbigniew Jędrzejewski-Szmek 53f79e125d meson: use a convenience library for the sources shared between core/ and the outside
This avoids double compilation. Those files are tiny, so it doesn't save time,
but we avoid repeated warnings and errors, and it's generally cleaner to it
this way.

The number of commands in 'ninja -C build clean && ninja -C build' drops from
1462 to 1455 for me.
2019-03-05 21:01:17 +01:00
Zbigniew Jędrzejewski-Szmek 23bdba61b1 pkgconfig: avoid double slash with split-usr configuration
By defining rootprefix= we avoid a double slash in $systemdsystemunitdir and
other variables. This fixes a regression introduced in
1c2c7c6cb3 where the variables using rootprefix=/
would start with a double slash. This should be interpreted the same, but is
certainly ugly.

The rootprefix variable was added to systemd.pc in
1c2c7c6cb3, so there is no question of backwards
compatiblity. If people try to "override" the prefix and specify
--define-variable=rootprefix=/, they will get a double slash, which should be
OK, and is the same as --define-variable=rootprefix=/something/, which also
results in a double slash somewhere in the strings.
2019-03-05 18:49:28 +01:00
Lennart Poettering 9e71f5d983 shutdown: rearrange shutdown sources in source tree
Let's move the shutdown binary into its own subdirectory in
src/shutdown, after all it is relatively isolated from the normal PID 1
sources, being a different binary and all.

Unfortunately it's not possible to move some of the code, since it is
shared with PID 1, that I wished we could move, but I still think it's
worth it.
2019-03-05 12:21:17 +01:00
Lennart Poettering 9a43fc6a2a
Merge pull request #11827 from keszybz/pkgconfig-variables
Allow overriding pkgconfig prefixes
2019-02-26 18:58:03 +01:00
Michael Olbrich 416d7d4648 meson: declare version.h as dependency for systemd
This is a followup to #11815 and adds the last missing dependency.
With this #11565 is hopefully really fixed.
2019-02-25 15:55:38 +01:00
Lennart Poettering c55a447ab4
Merge pull request #11798 from keszybz/mem-sanitizer-fix
meson: make sure preprocesor warnings are not treated as errors
2019-02-25 13:50:56 +01:00
Zbigniew Jędrzejewski-Szmek 60722ad778 meson: declare version.h as dep for various targets that include build.h
Should fix #11565.
2019-02-25 10:41:41 +01:00
Zbigniew Jędrzejewski-Szmek 3b8951c1dc meson: make sure preprocesor warnings are not treated as errors
Clang includes -W#warning in -Werror, so the #warning used for msan would
be an error.

v2:
- use -Wno-error=... so that the warning is still emitted, but not as an error.
2019-02-25 10:06:47 +01:00
Lennart Poettering bde06abd4f
Merge pull request #10408 from keszybz/analyze-cat-presets
systemd-analyze cat-presets
2019-02-18 16:02:45 +01:00
Yu Watanabe 3d61d3a03f meson: drop unused HAVE_STRUCT_FIB_RULE_{UID,PORT}_RANGE 2019-02-18 13:00:45 +01:00
Zbigniew Jędrzejewski-Szmek f32c79ca50 meson: drop unused "udevhomedir" 2019-02-18 10:29:33 +01:00
Zbigniew Jędrzejewski-Szmek 064605ef56 build-sys: bump package/library versions
We added sd_bus_close_unref().
2019-01-26 15:02:38 +01:00
Louis Taylor d1084aa2f8 meson: make version a dependency and use it in libbasic
This should hopefully ensure it gets generated before basic build
happens.

Fixes #11483.
2019-01-22 14:39:38 +01:00
Fabrice Fontaine 6a9eb11b8a missing_if_link.h: add IFLA_BOND_MODE
systemd fails to build on kernel without IFLA_BOND_MODE (< 3.13) since
9714c020fc

So put back IFLA_BOND_MODE definition

Fixes:
 - http://autobuild.buildroot.org/results/699c078aa078240c6741da4dbd0871450ceeca92

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2019-01-11 17:37:36 +01:00
Michael Biebl 4e4bbc439e meson: stop setting -fPIE globally
Setting -fPIE globally can lead to miscompilations on certain
architectures.
This is caused by both -fPIE and -fPIC options being added to various
compilation commands. Only -fPIC is being recorded in the LTO options
section of the object. The gcc-8 LTO plugin merges -fPIC + -fPIE to
nothing. So, the compilations done by the plugin are not
position-independent and fail to link with -pie.

The simplest solution is to stop setting -fPIE globally and instead
using meson's b_pie=true option. This requires meson 0.49 or later.

Since we don't set this option in meson.build but leave it up to the
distro maintainer to set this option, do not bump the meson version
requirement.

Fixes: #10548
2019-01-10 16:00:10 +01:00
Lennart Poettering 2004fce186
Merge pull request #11337 from keszybz/build-version-h
meson: declare version.h as dep for libbasic
2019-01-06 13:55:10 +01:00
James Hilliard 50f2fc77d7 Disable tools/choose-default-locale.sh when cross compiling 2019-01-06 13:51:18 +01:00
Zbigniew Jędrzejewski-Szmek 63058f432b Revert "meson: declare version.h as dep for fuzzers"
This reverts commit 0c2e93b863.

This should not be necessary anymore after previous commit.
I don't quite remember what sequence of steps was failing, but right now
"meson build -Dslow-tests=true && ninja -C build fuzzers" work fine.
2019-01-05 13:30:24 +01:00
Zbigniew Jędrzejewski-Szmek d27d60b3bc
Merge pull request #11317 from filbranden/docs1
Improvements to systemd.io generation
2019-01-03 18:38:57 +01:00
Yu Watanabe d25e127dbe sleep: install default sleep.conf
Closes #11310.
2019-01-03 14:43:15 +01:00
Yu Watanabe a92f2af28a
Merge pull request #11230 from keszybz/version-string-alt
Generate version string from git describe (alternative approach)
2019-01-03 21:33:55 +09:00
Filipe Brandenburger 357211a426 docs: generate index.md in Jekyll
This uses a {% for %} loop in Jekyll to render the page, from the "title"
information in the Front Matter of the actual page files.

This also makes `make-index-md` build rule unnecessary, since generation is
done by the template engine itself.

Tested this by running Jekyll locally.
2019-01-02 14:23:18 -08:00
Yu Watanabe 03475e2232 meson: check whether C.UTF-8 exists or not and use it if exists
If C.UTF-8 does not exist, then fallback to en_US.UTF-8 or C.
2019-01-02 03:41:36 +09:00
Dave Reisner 8ca9e92c74 Make default locale a compile time option
Default to a locale that's guaranteed to exist everywhere, but let
distros override this with something more exotic if they choose to.

Closes #11259.
2018-12-29 21:43:04 +09:00
James Hilliard 46e63a2a3e meson: use cross compilation compatible c++ check 2018-12-28 12:17:06 +09:00
Lennart Poettering 67bee56fd5 build-sys: bump package/library versions 2018-12-21 14:58:49 +01:00
Zbigniew Jędrzejewski-Szmek 0c2e93b863 meson: declare version.h as dep for fuzzers
This is supposed an error when building fuzzers for sanitization (that is a
nested build with the sanitization options):

In file included from ../../../../src/basic/util.c:21:0:
../../../../src/basic/build.h:4:21: fatal error: version.h: No such file or directory
 #include "version.h"
                     ^
compilation terminated.

Internally we do 'ninja -C test/fuzz/sanitize-address-fuzzers fuzzers'.
I'm not quite sure why version.h is not built in this case. But declaring
version_h as the dependency forces it to be built and solves the issue.

It would be better to define the dependency on individual exe's, but this
doesn't work:

meson.build:2884:8: ERROR:  Argument is of an unacceptable type 'CustomTarget'.
Must be either an external dependency (returned by find_library() or
dependency()) or an internal dependency (returned by declare_dependency()).

Let's treat this a hack for another hack, which the nested build is.
2018-12-21 13:43:20 +01:00
Zbigniew Jędrzejewski-Szmek e1ca734edd meson: allow setting the version string during configuration
This will be useful when building distro packages, because we can set the
version string to the rpm/dpkg/whatever version string, and getter reports
from end users.
2018-12-21 13:43:20 +01:00
Zbigniew Jędrzejewski-Szmek e4d5753bd0 meson-vcs-tag: add work-around for git bug 2018-12-21 13:43:20 +01:00
Zbigniew Jędrzejewski-Szmek 681bd2c524 meson: generate version tag from git
$ build/systemctl --version
systemd 239-3555-g6178cbb5b5
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid
$ git tag v240 -m 'v240'
$ ninja -C build
ninja: Entering directory `build'
[76/76] Linking target fuzz-unit-file.
$ build/systemctl --version
systemd 240
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid

This is very useful during development, because a precise version string is
embedded in the build product and displayed during boot, so we don't have to
guess answers for questions like "did I just boot the latest version or the one
from before?".

This change creates an overhead for "noop" builds. On my laptop, 'ninja -C
build' that does nothing goes from 0.1 to 0.5 s. It would be nice to avoid
this, but I think that <1 s is still acceptable.

Fixes #7183.

PACKAGE_VERSION is renamed to GIT_VERSION, to make it obvious that this is the
more dynamically changing version string.

Why save to a file? It would be easy to generate the version tag using
run_command(), but we want to go through a file so that stuff gets rebuilt when
this file changes. If we just defined an variable in meson, ninja wouldn't know
it needs to rebuild things.
2018-12-21 13:43:20 +01:00
Zbigniew Jędrzejewski-Szmek a67c318df8 meson: define PROJECT_VERSION as the "bare" project version
Let's not use atoi() if we can simply provide the project version as a number.

In C code, this is the numerical project version. In substitutions in other
files, this is just the bare substitution.

The "PACKAGE_" prefix is from autotools, and is strange. We call systemd a
"project", and "package" is something that distros build. Let's rename.

PACKAGE_URL is renamed to PROJECT_URL for the same reasons and for consistency.

(This leave PACKAGE_VERSION as the stringified define for C code.)
2018-12-20 21:35:29 +01:00
Zbigniew Jędrzejewski-Szmek d2aaf13099 Remove use of PACKAGE_STRING
PACKAGE_VERSION is more explicit, and also, we don't pretend that changing the
project name in meson.build has any real effect. "systemd" is embedded in a
thousand different places, so let's just use the hardcoded string consistently.
This is mostly in preparation for future changes.
2018-12-19 09:29:32 +01:00
Lennart Poettering e4abfc77c4
Merge pull request #11197 from keszybz/various-fixups
Various fixups
2018-12-18 14:35:00 +01:00
Zbigniew Jędrzejewski-Szmek c512dfb9ac meson: print EFI CC configuration nicely
In 595343fb4c it was converted to an array.
This doesn't look good in the output. Let's convert it back to a string.
2018-12-18 12:20:01 +01:00
Yu Watanabe ceb26cdbc2 sd-resolve: add sd_resolve_get{addr,info}_with_destroy_callback() and typesafe macros 2018-12-17 10:02:36 +09:00
Zbigniew Jędrzejewski-Szmek 06da5c63dd meson: make net.naming-scheme= default configurable
This is useful for distributions, where the stability of interface names should
be preseved after an upgrade of systemd. So when some specific release of the
distro is made available, systemd defaults to the latest & greatest naming
scheme, and subsequent updates set the same default. This default may still
be overriden through the kernel and env var options.

A special value "latest" is also allowed. Without a specific name, it is harder
to verride from meson. In case of 'combo' options, meson reads the default
during the initial configuration, and "remembers" this choice. When systemd is
updated, old build/ directories could keep the old default, which would be
annoying. Hence, "latest" is introduced to make it explicit, yet follow the
upstream. This is actually useful for the user too, because it may be used
as an override, without having to actually specify a version.
2018-12-12 10:09:36 +01:00
Yu Watanabe b9683baffe missing: move btrfs related entries to missing_btrfs.h and missing_btrfs_tree.h 2018-12-04 07:46:59 +01:00
Yu Watanabe b6459df80f missing: re-add mistakenly dropped entries
These entries are mistakenly dropped by 9714c020fc.

Fixes #11036.
2018-12-04 01:45:14 +01:00
Yu Watanabe 9714c020fc missing: split network related entries
Also adds comments which kernel version added the entries.

Closes #10553.
2018-12-03 10:31:05 +01:00
Fabrice Fontaine 38c1c96db1 meson.build: fix detection of -Werror=shadow
Pass -Werror=shadow in args of cc.compiles otherwise test will always
succeed
This fix a build failure with gcc 4.7.3

Fixes:
 - http://autobuild.buildroot.org/results/ffd71c473d3b29618c18cd2e04705370266696f2

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2018-11-30 08:45:22 +01:00
Zbigniew Jędrzejewski-Szmek 401faa3533
Merge pull request #10357 from poettering/import-fs
machinectl import-fs command and other fixes
2018-11-29 16:38:46 +01:00
Zbigniew Jędrzejewski-Szmek 8b4e51a60e
Merge pull request #10797 from poettering/run-generator
add new "systemd-run-generator" for running arbitrary commands from the kernel command line as system services using the "systemd.run=" kernel command line switch
2018-11-28 22:40:55 +01:00
Yu Watanabe 50ae773f85
Merge pull request #10970 from yuwata/from-name-return-negative-errno
util: make *_from_name() returns negative errno on error
2018-11-29 03:18:03 +09:00
Yu Watanabe fab57f7f13
Merge pull request #10948 from ssahani/iprule-port-proto
networkd: add support to configure ip rule port range and protocol.
2018-11-29 03:17:36 +09:00
Lennart Poettering 09dad04c49 meson: let's bump RLIMIT_NOFILE hard limit to 512K
Prompted by:

https://lists.freedesktop.org/archives/systemd-devel/2018-October/041578.html
2018-11-28 17:08:27 +01:00
Susant Sahani 926062f083 networkd: add support to configure ip rule port range and protocol.
Please see:

iprule: support for ip_proto, sport and dport match options
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=f686f764682745daf6a93b0a6330ba42a961f858

Closes 10622
2018-11-28 20:06:28 +05:30
Yu Watanabe 6ec439fd4b tools: move generate-gperfs.py to tools/ 2018-11-28 20:19:41 +09:00
Lennart Poettering 59a2a18e27 missing.h: remove duplicate definition of 'struct ethtool_link_settings'
Fixes: #10966
2018-11-28 10:37:03 +01:00
Lennart Poettering 35a1ff4cfe add new run-generator
This is really useful for running commands like this:

        # systemd-run -i someimage.raw -b systemd.run='"some command line"'

This will now run the command line inside a small Type=oneshot service
and even propagate the exit code of the command back to the parent. And
all that with the full system booted up.

By default this causes the system to shutdown right after the command
completed, but this can be tweaked with systemd.run_success_action= and
systemd.run_failure_action=.

Note that when used in VMs the exit status can of course not be
propagate, as VMs don't really know a concept for that.
2018-11-27 09:44:40 +01:00
Susant Sahani 2266864b04 networkd: Add support for ERSPAN tunnel
Please see: https://patchwork.ozlabs.org/patch/800327/
```
[NetDev]
Name=erspan-test
Kind=erspan

[Tunnel]
Independent=true
ERSPANIndex=123
Local = 172.16.1.200
Remote = 172.16.1.100
Key=101
SerializeTunneledPackets=true
```
2018-11-27 11:04:42 +09:00
Lennart Poettering 1d7579c473 machine: add support for importing containers from plain directories
Fixes: #2728

This is also supposed to be preparation for doing #10234 eventually,
where a very similar operation is requested: instead of importing a tree
to /var/lib/machines it would need to be imported into
/var/lib/portables/.
2018-11-26 18:09:01 +01:00
Yu Watanabe d6601495be meson: also add option for debugging siphash 2018-11-23 00:36:35 +09:00
Yu Watanabe 20e97dd3de meson: add option for debugging udev 2018-11-23 00:28:27 +09:00
Zbigniew Jędrzejewski-Szmek d284b82b3e Move various files that don't need to be in basic/ to shared/
This doesn't have much effect on the final build, because we link libbasic.a
into libsystemd-shared.so, so in the end, all the object built from basic/
end up in libsystemd-shared. And when the static library is linked into binaries,
any objects that are included in it but are not used are trimmed. Hence, the
size of output artifacts doesn't change:

$ du -sb /var/tmp/inst*
54181861	/var/tmp/inst1    (old)
54207441	/var/tmp/inst1s   (old split-usr)
54182477	/var/tmp/inst2    (new)
54208041	/var/tmp/inst2s   (new split-usr)

(The negligible change in size is because libsystemd-shared.so is bigger
by a few hundred bytes. I guess it's because symbols are named differently
or something like that.)

The effect is on the build process, in particular partial builds. This change
effectively moves the requirements on some build steps toward the leaves of the
dependency tree. Two effects:
- when building items that do not depend on libsystemd-shared, we
  build less stuff for libbasic.a (which wouldn't be used anyway,
  so it's a net win).
- when building items that do depend on libshared, we reduce libbasic.a as a
  synchronization point, possibly allowing better parallelism.

Method:
1. copy list of .h files from src/basic/meson.build to /tmp/basic
2. $ for i in $(grep '.h$' /tmp/basic); do echo $i; git --no-pager grep "include \"$i\"" src/basic/ 'src/lib*' 'src/nss-*' 'src/journal/sd-journal.c' |grep -v "${i%.h}.c";echo ;done | less
2018-11-20 07:27:37 +01:00
Yu Watanabe 8a716f26ef missing: add ETHTOOL_LINK_MODE_* and struct ethtool_link_settings 2018-11-18 14:33:50 +09:00
Zbigniew Jędrzejewski-Szmek 1c2c7c6cb3 pkgconfig: define variables relative to ${prefix}/${rootprefix}/${sysconfdir}
Fixes #4549.

People want to be able to redefine the prefixes relative to which the other
variables are defined. Something like
  pkgconf --define-variable=prefix=/home/user/installpath --variable=systemdsystemunitdir systemd

I'm not convinced that this entirely useful, because the installed systemd will
not look at those paths, but maybe it's OK as an alternative type of $DESTDIR.
This has been requested a few times over the years, so let's just provide this.

I thought this would be more complicated, since we allow all kinds of directories
to be overrides in the compilation configuration. But it turns out that all the
directories defined in systemd.pc are relative to three prefixes:
$prefix, $rootprefix, and $sysconfdir. So this patch adds $rootprefix and $sysconfdir
to the .pc file and then changes the subsequent definitions in the .pc file to use
them. In the end we define each path twice using the same rules: once in meson.build
and once in the .pc file.

Without overrides:
$ for i in $(pkgconf --with-path=build/src/core systemd --print-variables); do
     echo -n "$i = "; pkgconf --with-path=$PWD/build/src/core --variable=$i systemd
  done
containeruidbasemax = 1878982656
containeruidbasemin = 524288
dynamicuidmax = 65519
dynamicuidmin = 61184
systemgidmax = 999
systemuidmax = 999
catalogdir = /usr/lib/systemd/catalog
modulesloaddir = /usr/lib/modules-load.d
binfmtdir = /usr/lib/binfmt.d
sysctldir = /usr/lib/sysctl.d
sysusersdir = /usr/lib/sysusers.d
tmpfilesdir = /usr/lib/tmpfiles.d
systemdshutdowndir = /usr/lib/systemd/system-shutdown
systemdsleepdir = /usr/lib/systemd/system-sleep
systemdusergeneratordir = /usr/lib/systemd/user-generators
systemdsystemgeneratordir = /usr/lib/systemd/system-generators
systemduserunitpath = /etc/systemd/user:/etc/systemd/user:/run/systemd/user:/usr/local/lib/systemd/user:/usr/local/share/systemd/user:/usr/lib/systemd/user:/usr/lib/systemd/user:/usr/share/systemd/user
systemdsystemunitpath = /etc/systemd/system:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:/usr/lib/systemd/system:/usr/lib/systemd/system:/lib/systemd/system
systemduserconfdir = /etc/systemd/user
systemdsystemconfdir = /etc/systemd/system
systemduserpresetdir = /usr/lib/systemd/user-preset
systemduserunitdir = /usr/lib/systemd/user
systemdsystempresetdir = /usr/lib/systemd/system-preset
systemdsystemunitdir = /usr/lib/systemd/system
systemdutildir = /usr/lib/systemd
sysconfdir = /etc
rootprefix = /usr
prefix = /usr
pcfiledir = /usr/share/pkgconfig

With overrides:
$ for i in $(pkgconf --with-path=build/src/core systemd --print-variables); do
     echo -n "$i = "; pkgconf --with-path=$PWD/build/src/core \
     --define-variable=prefix=/PREFIX \
     --define-variable=rootprefix=/ROOTPREFIX \
     --define-variable=sysconfdir=/SYSCONF --variable=$i systemd
  done
containeruidbasemax = 1878982656
containeruidbasemin = 524288
dynamicuidmax = 65519
dynamicuidmin = 61184
systemgidmax = 999
systemuidmax = 999
catalogdir = /PREFIX/lib/systemd/catalog
modulesloaddir = /PREFIX/lib/modules-load.d
binfmtdir = /PREFIX/lib/binfmt.d
sysctldir = /PREFIX/lib/sysctl.d
sysusersdir = /PREFIX/lib/sysusers.d
tmpfilesdir = /PREFIX/lib/tmpfiles.d
systemdshutdowndir = /ROOTPREFIX/lib/systemd/system-shutdown
systemdsleepdir = /ROOTPREFIX/lib/systemd/system-sleep
systemdusergeneratordir = /PREFIX/lib/systemd/user-generators
systemdsystemgeneratordir = /ROOTPREFIX/lib/systemd/system-generators
systemduserunitpath = /SYSCONF/systemd/user:/etc/systemd/user:/run/systemd/user:/usr/local/lib/systemd/user:/usr/local/share/systemd/user:/PREFIX/lib/systemd/user:/usr/lib/systemd/user:/usr/share/systemd/user
systemdsystemunitpath = /SYSCONF/systemd/system:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:/ROOTPREFIX/lib/systemd/system:/usr/lib/systemd/system:/lib/systemd/system
systemduserconfdir = /SYSCONF/systemd/user
systemdsystemconfdir = /SYSCONF/systemd/system
systemduserpresetdir = /PREFIX/lib/systemd/user-preset
systemduserunitdir = /PREFIX/lib/systemd/user
systemdsystempresetdir = /ROOTPREFIX/lib/systemd/system-preset
systemdsystemunitdir = /ROOTPREFIX/lib/systemd/system
systemdutildir = /usr/lib/systemd
sysconfdir = /SYSCONF
rootprefix = /ROOTPREFIX
prefix = /PREFIX
pcfiledir = /usr/share/pkgconfig

(pkgconf doesn't provide a way to print all variables together with their definitions,
according to the man page. Disappointing.)
2018-11-17 15:38:15 +01:00
Yu Watanabe a137a1c3ff sd-event: split definition of event_source to event-source.h 2018-11-16 22:57:37 +09:00
Michael Olbrich be5536a6af meson: fix building with -Ddns-over-tls=false
Assigning multiple variables in one line is no valid meson syntax.
Without this running meson with -Ddns-over-tls=false fails with:

meson.build:1191:8: ERROR:  Tried to assign an invalid value to variable.
2018-11-11 11:31:53 +01:00
Michael Olbrich 5996740a09 meson: don't build fuzzers if tests are disabled
Fuzzers are just special tests anyways and without this, building with
'-Dtests=false' fails with:

.../src/fuzz/fuzz-main.c:20: undefined reference to `test_setup_logging'
2018-11-11 11:28:41 +01:00
Tobias Jungel 99f68ef02d networkd: add missing bonding options (#10542)
Add support for bonding options system prio, port key and actor system mac.

These options exist in the linux kernel since 4.2
(torvalds/linux@171a42c38c)

Details:
https://www.kernel.org/doc/Documentation/networking/bonding.txt
2018-11-02 10:31:20 +09:00
Lennart Poettering fc03c53653
Merge pull request #10573 from faheel/master
Convert remaining docs to Markdown
2018-10-31 15:15:41 +01:00
Faheel Ahmad eea984028f docs: Update links to updated docs 2018-10-30 23:01:20 +05:30
Zbigniew Jędrzejewski-Szmek e0a1d4b049 Drop support for lz4 < 1.3.0
lz4-r130 was released on May 29th, 2015. Let's drop the work-around for older
versions. In particular, we won't test any new code against those ancient
releases, so we shouldn't pretend they are supported.
2018-10-29 21:54:42 +01:00
Yu Watanabe 80df8f2518 missing: support old linux/fou.h
linux/fou.h was introduced in 3.18.
FOU_ATTR_REMCSUM_NOPARTIAL was added in 4.0.
FOU_CMD_GET was added in 4.1.

Follow-up for 53cb501a13.
Fixes #10474.
2018-10-21 22:34:28 +09:00
Lennart Poettering f876f53789 units: add simple boot check unit
This is might be useful in some cases, but it's primarily an example for
a boot check service that can be plugged before boot-complete.target.

It's disabled by default.

All it does is check whether the failed unit count is zero
2018-10-19 22:34:50 +02:00
Lennart Poettering 8d16ed0785 add "systemd-bless-boot-generator"
This generator automatically pulls in "systemd-bless-boot.service" if
a boot with boot counting is detected.
2018-10-19 22:34:50 +02:00
Lennart Poettering 36695e880a add new systemd-bless-boot.service that marks boots as successful
This is the counterpiece to the boot counting implemented in
systemd-boot: if a boot is detected as successful we mark drop the
counter again from the booted snippet or kernel image.
2018-10-19 22:34:50 +02:00
Zbigniew Jędrzejewski-Szmek 30538ff10b meson: simplify definition of MEMORY_ACCOUNTING_DEFAULT
Let's just use the simplest form, it doesn't really matter how the define
looks after preprocessing.
2018-10-17 14:54:48 +02:00
Zbigniew Jędrzejewski-Szmek c02b6ee496 meson: define @HIGH_RLIMIT_NOFILE@ and use it everywhere 2018-10-17 14:54:48 +02:00
Lennart Poettering a8b627aaed main: bump fs.nr_open + fs.max-file to their largest possible values
After discussions with kernel folks, a system with memcg really
shouldn't need extra hard limits on file descriptors anymore, as they
are properly accounted for by memcg anyway. Hence, let's bump these
values to their maximums.

This also adds a build time option to turn thiss off, to cover those
users who do not want to use memcg.
2018-10-17 14:40:39 +02:00
Lennart Poettering 07ee5adb35 logind: change user-runtime-dir to query runtime dir size from logind via the bus
I think this is a slightly cleaner approach than parsing the
configuration file at multiple places, as this way there's only a single
reload cycle for logind.conf, and that's systemd-logind.service's
runtime.

This means that logind and dbus become a requirement of
user-runtime-dir, but given that XDG_RUNTIME_DIR is not set anyway
without logind and dbus around this isn't really any limitation.

This also simplifies linking a bit as this means user-runtime-dir
doesn't have to link against any code of logind itself.
2018-10-13 12:59:29 +02:00
Yu Watanabe be44b572f3 meson: fix '-Dstatic-libsystemd=true' or '-Dstatic-libudev=true'
Follow-up for a5d8835c78.
2018-10-12 17:54:23 +09:00
Zbigniew Jędrzejewski-Szmek 0e3cc902fa Revert "meson: use c_args in generator scripts (#10289)"
This reverts commit 56f56d5ad8.

This broke the compilation for coverity under travis. Our build script does
something like this:

$ CFLAGS='-D_Float128=long\ double -D_Float64=double -D_Float64x=long\ double -D_Float32=float -D_Float32x=double' meson cov-build -Dman=false
$ ninja -C build
...
[pid 27096] execve("/usr/bin/cc", ["/usr/bin/cc", "-D_Float128=long", "double", "-D_Float64=double", "-D_Float64x=long", "double", "-D_Float32=float", "-D_Float32x=double", "-E", "-dM", "-include", "linux/capability.h", "-include", "config.h", "-include", "../src/basic/missing.h", "-"], 0x55ab75ea4e80 /* 91 vars */) = 0
cc: error: double: No such file or directory
cc: error: double: No such file or directory
[pid 27096] +++ exited with 1 +++

I'm sure this could be fixed somehow, but since the original motivation for
56f56d5ad8 wasn't very strong, let's just revert
it as this seems to be the simplest solution.
2018-10-11 17:22:40 +02:00
Lennart Poettering 960d4b29d7
Merge pull request #10334 from keszybz/nomempool
Use mempool only in progs linked to libsystemd-shared.so
2018-10-11 13:44:34 +02:00
Zbigniew Jędrzejewski-Szmek abc8caf76c meson: use vars we already have defined in status 2018-10-11 11:10:53 +02:00
Zbigniew Jędrzejewski-Szmek a5d8835c78 mempool: only enable mempool use when linked to libsystemd-shared.so
Mempool use is enabled or disabled based on the mempool_use_allowed symbol that
is linked in.

Should fix assert crashes in external programs caused by #9792.
Replaces #10286.

v2:
- use two different source files instead of a gcc constructor
2018-10-11 11:10:37 +02:00
Zbigniew Jędrzejewski-Szmek c42c981924 meson: remove old comment
The linked page is gone, and I can't quite remember what the
warning was about. Something about recursive copying... Everything
seems to work.
2018-10-11 10:55:41 +02:00
Zbigniew Jędrzejewski-Szmek 5dbf13fa6c meson: drop workaround
It was added way back, and seems to work fine now without it.
2018-10-11 10:55:41 +02:00
Zbigniew Jędrzejewski-Szmek c09edc79ab meson: c++ is required for the fuzzer builds
The configuration would fail with an error about cpp being an unknown language
anyway, but it's nicer to fail early and explicitly.

https://github.com/systemd/systemd/pull/10339#issuecomment-428279175
2018-10-10 11:56:45 +02:00
Zbigniew Jędrzejewski-Szmek 9b0ca01903 meson: rename cpp_cmd to cxx_cmd
cpp is a really bad alias for c++ because it's also the name of the
preprocessor. Let's rename the variable.
2018-10-10 11:50:57 +02:00
Zbigniew Jędrzejewski-Szmek 1b2acaa7a6 meson: we cannot call get_compiler('cpp') if we didn't "add" it
Follow-up for f6d783ac3d.
2018-10-09 21:12:00 +02:00
Lennart Poettering 19d8c9c9b7 meson: include more build settings in status output 2018-10-09 15:42:40 +02:00
Lennart Poettering 80f39b81f3 portable: move portablectl to /usr/bin
Let's declare this a supported API. After all feedback I got at
conferences I think we are good to consider this stable now and make it
official API.
2018-10-08 18:49:45 +02:00
Yu Watanabe 56f56d5ad8 meson: use c_args in generator scripts (#10289)
May be useful in some cases.
2018-10-08 18:37:06 +02:00
Lennart Poettering 29088d374e
Merge pull request #9898 from keszybz/id128
Add a new tool 'systemd-id128'
2018-10-02 17:43:37 +02:00
Lennart Poettering c3281539da
Merge pull request #10246 from keszybz/fuzz-buss
Bus fuzzer
2018-10-02 15:45:21 +02:00
Zbigniew Jędrzejewski-Szmek 0d1d512f7f systemd-id128: a new tool to print machine/boot/invocation/app-specific ids
The raison d'etre for this program is printing machine-app-specific IDs. We
provide a library function for that, but not a convenient API. We can hardly
ask people to quickly hack their own C programs or call libsystemd through CFFI
in python or another scripting language if they just want to print an ID.

Verb 'new' was already available as 'journalctl --new-id128', but this makes
it more discoverable.

v2:
- rename binary to systemd-id128
- make --app-specific= into a switch that applies to boot-id and machine-id
2018-10-02 15:15:10 +02:00
Lennart Poettering 0bc7a22d93 docs: add a simple, auto-generated index.md
This is useful for the github pages feature
2018-10-02 10:43:54 +02:00
Zbigniew Jędrzejewski-Szmek e6bad67461 meson: treat all fuzz cases as unit tests
318/365 fuzz-bus-message:crash-26bba7182dedc8848939931d9fcefcb7922f2e56:address  OK       0.03 s
319/365 fuzz-bus-message:crash-29ed3c202e0ffade3cad42c8bbeb6cc68a21eb8e:address  OK       0.03 s
320/365 fuzz-bus-message:crash-b88ad9ecf4aacf4a0caca5b5543953265367f084:address  OK       0.03 s
321/365 fuzz-bus-message:crash-c1b37b4729b42c0c05b23cba4eed5d8102498a1e:address  OK       0.03 s
322/365 fuzz-bus-message:crash-d8f3941c74219b4c03532c9b244d5ea539c61af5:address  OK       0.03 s
323/365 fuzz-bus-message:crash-e1b811da5ca494e494b77c6bd8e1c2f2989425c5:address  OK       0.03 s
324/365 fuzz-bus-message:leak-c09c0e2256d43bc5e2d02748c8d8760e7bc25d20:address  OK       0.04 s
325/365 fuzz-bus-message:message1:address       OK       0.03 s
326/365 fuzz-bus-message:timeout-08ee8f6446a4064db064e8e0b3d220147f7d0b5b:address  OK       0.03 s
327/365 fuzz-dhcp-server:discover-existing:address  OK       0.04 s
328/365 fuzz-dhcp-server:discover-new:address   OK       0.03 s
329/365 fuzz-dhcp-server:release:address        OK       0.04 s
330/365 fuzz-dhcp-server:request-existing:address  OK       0.03 s
331/365 fuzz-dhcp-server:request-new:address    OK       0.03 s
332/365 fuzz-dhcp-server:request-reboot:address  OK       0.03 s
333/365 fuzz-dhcp-server:request-renew:address  OK       0.03 s
334/365 fuzz-dns-packet:issue-7888:address      OK       0.03 s
335/365 fuzz-dns-packet:oss-fuzz-5465:address   OK       0.03 s
336/365 fuzz-journal-remote:crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76:address  OK       0.06 s
337/365 fuzz-journal-remote:crash-96dee870ea66d03e89ac321eee28ea63a9b9aa45:address  OK       0.04 s
338/365 fuzz-journal-remote:invalid-ts.txt:address  OK       0.04 s
339/365 fuzz-journal-remote:oss-fuzz-8659:address  OK       0.06 s
340/365 fuzz-journal-remote:oss-fuzz-8686:address  OK       0.04 s
341/365 fuzz-journal-remote:sample.txt:address  OK       0.07 s
342/365 fuzz-unit-file:directives.service:address  OK       0.03 s
343/365 fuzz-unit-file:empty.scope:address      OK       0.04 s
344/365 fuzz-unit-file:machine.slice:address    OK       0.03 s
345/365 fuzz-unit-file:oss-fuzz-6884:address    OK       0.05 s
346/365 fuzz-unit-file:oss-fuzz-6885:address    OK       0.03 s
347/365 fuzz-unit-file:oss-fuzz-6886:address    OK       0.04 s
348/365 fuzz-unit-file:oss-fuzz-6892:address    OK       0.03 s
349/365 fuzz-unit-file:oss-fuzz-6897:address    OK       0.05 s
350/365 fuzz-unit-file:oss-fuzz-6897-evverx:address  OK       0.04 s
351/365 fuzz-unit-file:oss-fuzz-6908:address    OK       0.05 s
352/365 fuzz-unit-file:oss-fuzz-6917:address    OK       0.06 s
353/365 fuzz-unit-file:oss-fuzz-6977:address    OK       0.08 s
354/365 fuzz-unit-file:oss-fuzz-6977-unminimized:address  OK       0.10 s
355/365 fuzz-unit-file:oss-fuzz-7004:address    OK       0.03 s
356/365 fuzz-unit-file:oss-fuzz-8064:address    OK       0.03 s
357/365 fuzz-unit-file:oss-fuzz-8827:address    OK       0.50 s
358/365 fuzz-unit-file:proc-sys-fs-binfmt_misc.automount:address  OK       0.03 s
359/365 fuzz-unit-file:syslog.socket:address    OK       0.03 s
360/365 fuzz-unit-file:systemd-ask-password-console.path:address  OK       0.03 s
361/365 fuzz-unit-file:systemd-machined.service:address  OK       0.03 s
362/365 fuzz-unit-file:systemd-resolved.service:address  OK       0.03 s
363/365 fuzz-unit-file:systemd-tmpfiles-clean.timer:address  OK       0.03 s
364/365 fuzz-unit-file:timers.target:address    OK       0.03 s
365/365 fuzz-unit-file:var-lib-machines.mount:address  OK       0.04 s

This gives us slightly nicer coverage in the normal test run.

When in a git repo, git ls-files is used to get a list of files known to git.
This mirrors what update-man-rules does for man files. Only looking at files
known to git makes it easier to not forget to commit the test file to git,
and also makes bisecting easier if some files are left in repo.

When outside of a git repo, we expect to be unpacked from a tarball, so just
using all files reported by ls is OK.
2018-10-02 09:42:19 +02:00
Zbigniew Jędrzejewski-Szmek 243e5cecc3 meson: use .source_root() in more places
In the main meson.build file, .source_root() and .current_source_dir() are
equivalent, but it seems more appropriate to use .source_root() when we are appending
a path which is by design relative to repo root.
2018-10-02 09:41:25 +02:00
Zbigniew Jędrzejewski-Szmek fd5dec9adf meson: add -Dlog-trace to set LOG_TRACE
The justification is the same as for -Dvalgrind: setting config in
meson in this way is easier, because when the value is changed stuff
that should be rebuilt is rebuilt.
2018-10-02 09:41:25 +02:00
Zbigniew Jędrzejewski-Szmek 6bd2bc8e16 meson: drop duplicated condition
The generic check suffices for those four.
2018-10-02 09:41:25 +02:00
Zbigniew Jędrzejewski-Szmek c74a3f973e fuzz: unify the "fuzz-regressions" directory with the main corpus
There isn't really much need to keep them separate. Anything which is a good
corpus entry can be used as a smoke test, and anything which which is a
regression test can just as well be inserted into the corpus.

The only functional difference from this patch (apart from different paths in
output) is that the regression tests are now zipped together with the rest of
the corpus.

$ meson configure build -Dslow-tests=true && ninja -C build test
...
307/325 fuzz-dns-packet:issue-7888:address      OK       0.06 s
308/325 fuzz-dns-packet:oss-fuzz-5465:address   OK       0.04 s
309/325 fuzz-journal-remote:crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76:address  OK       0.07 s
310/325 fuzz-journal-remote:crash-96dee870ea66d03e89ac321eee28ea63a9b9aa45:address  OK       0.05 s
311/325 fuzz-journal-remote:oss-fuzz-8659:address  OK       0.05 s
312/325 fuzz-journal-remote:oss-fuzz-8686:address  OK       0.07 s
313/325 fuzz-unit-file:oss-fuzz-6884:address    OK       0.06 s
314/325 fuzz-unit-file:oss-fuzz-6885:address    OK       0.05 s
315/325 fuzz-unit-file:oss-fuzz-6886:address    OK       0.05 s
316/325 fuzz-unit-file:oss-fuzz-6892:address    OK       0.05 s
317/325 fuzz-unit-file:oss-fuzz-6897:address    OK       0.05 s
318/325 fuzz-unit-file:oss-fuzz-6897-evverx:address  OK       0.06 s
319/325 fuzz-unit-file:oss-fuzz-6908:address    OK       0.07 s
320/325 fuzz-unit-file:oss-fuzz-6917:address    OK       0.07 s
321/325 fuzz-unit-file:oss-fuzz-6977:address    OK       0.13 s
322/325 fuzz-unit-file:oss-fuzz-6977-unminimized:address  OK       0.12 s
323/325 fuzz-unit-file:oss-fuzz-7004:address    OK       0.05 s
324/325 fuzz-unit-file:oss-fuzz-8064:address    OK       0.05 s
325/325 fuzz-unit-file:oss-fuzz-8827:address    OK       0.52 s
2018-10-02 09:41:25 +02:00
Thiago Macieira 044c2c7a2b Make bzip2 an optional dependency for systemd-importd
Yes, there are still a lot of users of bzip2, but it's fallen out of
favour after LZMA/xz, which can compress a lot more and often
decompresses faster than bzip2 too.
2018-09-25 10:58:09 +02:00
Zbigniew Jędrzejewski-Szmek c1cd674357 meson: drop some unneeded parens 2018-09-13 12:07:34 +02:00
Zbigniew Jędrzejewski-Szmek 3b2bdd625a meson: always allow compilation of tests binaries 2018-09-13 12:07:34 +02:00
Yu Watanabe fd1939fbe7 meson: do not build tests by default when '-Dtests=false'
[zj: it is still possible to build tests explicitly by calling
     ninja -C build test-name. This way we have full flexibility.]
2018-09-13 12:07:34 +02:00
Zbigniew Jędrzejewski-Szmek 938be08926 meson: disable _all_ tests when -Dtests=false
Back in 08318a2c5a, value "false" was enabled for
'-Dtests=', but various tests were not conditionalized properly. So even with
-Dtests=false -Dslow-tests=false we'd run 120 tests. Let's make this consistent.
2018-09-13 12:07:34 +02:00
Zbigniew Jędrzejewski-Szmek d3da291eb0 meson: disable "slow tests" too when tests are generally disabled
We would have a strange situation where after setting -Dslow-tests=true -Dtests=false
we'd get mostly the slow tests (plus some other ones which I'll fix in
subsequent commit). Let's simplify things by making -Dtests=false just
disable those tests too.
2018-09-13 12:07:34 +02:00
Filipe Brandenburger 49cdae63d1 test: use ${builddir}/systemd-runtest.env for $SYSTEMD_CATALOG_DIR
This makes it so that tests no longer need to know the absolute paths to the
source and build dirs, instead using the systemd-runtest.env file to get these
paths when running from the build tree.

Confirmed that test-catalog works on `ninja test`, when called standalone and
also when the environment file is not present, in which case it will use the
installed location under /usr/lib/systemd/catalog.

The location can now also be overridden for this test by setting the
$SYSTEMD_CATALOG_DIR environment variable.
2018-09-12 09:49:03 -07:00
Filipe Brandenburger e2d413707f test: use ${builddir}/systemd-runtest.env to set $SYSTEMD_TEST_DATA
This simplifies get_testdata_dir() to simply checking for an environment
variable, with an additional function to locate a systemd-runtest.env file in
the same directory as the test binary and reading environment variable
assignments from that file if it exists.

This makes it possible to:
- Run `ninja test` from the build dir and have it use ${srcdir}/test for
  test unit definitions.
- Run a test directly, such as `build/test-execute` and have it locate
  them correctly.
- Run installed tests (from systemd-tests package) and locate the test
  units in the installed location (/usr/lib/systemd/tests/testdata), in
  which case the absence of the systemd-runtest.env file will have
  get_testdata_dir() use the installed location hardcoded into the
  binaries.

Explicit setting of $SYSTEMD_TEST_DATA still overrides the contents of
systemd-runtest.env.
2018-09-12 09:49:03 -07:00
Zbigniew Jędrzejewski-Szmek 3c83f15967
Merge pull request #10037 from filbranden/docs2
Moving docs around and starting conversion to Markdown
2018-09-09 21:01:17 +02:00
Filipe Brandenburger bf7efeb16f build-sys: Use common gcc argument detection for negative warning flags.
Starting with meson 0.46, it is able to detect these argument correctly.

See this commit in meson codebase for more details:
695b8f3a03

We already carry a requirement for meson_version : '>= 0.46', so we can be sure
our build system will include this commit.

Tested by building systemd using a cloned meson synced to the 0.46.0 tag,
confirmed the warnings were detected correctly in that case. The meson messages included this snippet:

> Compiler for C supports arguments -Wno-unused-parameter -Wunused-parameter: YES
> Compiler for C supports arguments -Wno-missing-field-initializers -Wmissing-field-initializers: YES
> Compiler for C supports arguments -Wno-unused-result -Wunused-result: YES
> Compiler for C supports arguments -Wno-format-signedness -Wformat-signedness: YES
> Compiler for C supports arguments -Wno-error=nonnull -Werror=nonnull: YES
> Compiler for C supports arguments -Wno-maybe-uninitialized -Wmaybe-uninitialized: YES
2018-09-09 20:57:08 +02:00
Filipe Brandenburger b6dc0d7d01 docs: convert TRANSLATORS to Markdown
Also expand it to cover typical tasks of creating new translations, updating
existing ones and compiling them (which can be useful to check syntax.)
2018-09-08 13:40:19 -07:00
Filipe Brandenburger 1d1cb1683e docs: convert DISTRO_PORTING to Markdown 2018-09-08 13:39:03 -07:00
Filipe Brandenburger 9e825ebf4f docs: move doc/ to docs/
The docs/ directory is special in GitHub, since it can be used to serve GitHub
Pages from, so there's a benefit to switching to it in order to expose it
directly as a website.

Updated references to it from the documentations themselves, from the
CONTRIBUTING.md file and from Meson build files.
2018-09-08 13:39:03 -07:00
Filipe Brandenburger 8794164fed build-sys: disable -Wmaybe-uninitialized
Compiler flag -Wmaybe-uninitialized is quite noisy and produces many false
positives, especially when optimization flags are enabled (tested gcc 8.2.1),
so let's just disable it in systemd build.

For example, with CFLAGS=-O2, the build produces 11 such warnings and the
default CFLAGS of Fedora's rpmbuild warns about it in 176 places. A look at a
sample of those shows that most are false positives, where the compiler just
can't figure it out correctly. (While fixing those would be nice, I'm not sure
it's a good use of our time.)

The noisy [-Wmaybe-uninitialized] warnings are not just an annoyance, since
they make it harder to spot warnings that indicate actual problems (such as
variable declared but not used.) Silencing those is beneficial, so that
contributors would see warnings where there are actually actionable problems,
so there's a better chance of having those issues addressed before a PR is
pushed.

Tested:
  $ CFLAGS='-O2 -Wp,-D_FORTIFY_SOURCE=2' meson build/
  $ ninja -C build/

(NOTE: -Wp,-D_FORTIFY_SOURCE=2 prevents [-Wstringop-truncation] warnings.)

With the commands above, the build will not produce any [-Wmaybe-uninitialized]
warnings (or any other warnings), which is not really the case before this commit.

Also tested with rpmbuild on Fedora, after this commit there are no warnings
produced in the build step.
2018-09-08 12:05:56 +02:00
Dimitri John Ledkov a9fc640671 cryptsetup: add support for sector-size= option (#9936)
Bug-Ubuntu: https://launchpad.net/bugs/1776626

Closes #8881.
2018-08-29 23:38:09 +09:00
Susant Sahani 53cb501a13 networkd and sd-netlink: add support for Generic netlink And FooOverUDP to IPIP tunnel
This work add support to generic netlink to sd-netlink.
See https://lwn.net/Articles/208755/

networkd: add support FooOverUDP support to IPIP tunnel netdev
https://lwn.net/Articles/614348/

Example conf:

/lib/systemd/network/1-fou-tunnel.netdev
```
[NetDev]
Name=fou-tun
Kind=fou

[FooOverUDP]
Port=5555
Protocol=4

```

/lib/systemd/network/ipip-tunnel.netdev
```
[NetDev]
Name=ipip-tun
Kind=ipip

[Tunnel]
Independent=true
Local=10.65.208.212
Remote=10.65.208.211
FooOverUDP=true
FOUDestinationPort=5555
```

$ ip -d link show ipip-tun
```
5: ipip-tun@NONE: <POINTOPOINT,NOARP> mtu 1472 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ipip 10.65.208.212 peer 10.65.208.211 promiscuity 0
    ipip remote 10.65.208.211 local 10.65.208.212 ttl inherit pmtudisc encap fou encap-sport auto encap-dport 5555 noencap-csum noencap-csum6 noencap-remcsum numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
```
2018-08-23 11:30:37 +02:00
Zbigniew Jędrzejewski-Szmek 8f6b442a78 meson: rename -Ddebug to -Ddebug-extra
Meson added -Doptimization and -Ddebug options, which obviously causes
a conflict with our -Ddebug options. Let's rename it.

Fixes #9883.
2018-08-20 16:10:57 -07:00
Benedikt Morbach a95696e33d meson: actually honor pkgconfig*dir options (#9841)
both were silently ignored leading to some of the pkg-config files
ending up in the wrong place
2018-08-10 11:59:54 +09:00
Zbigniew Jędrzejewski-Szmek 5a8b164092 meson: drop parens when appending to list
Meson does not care either way, so let's use the simpler syntax. And files()
already gives a list, so nesting this in a list wouldn't be necessary even
if meson did not flatten everything.
2018-07-31 21:02:01 +09:00
Iwan Timmer 096cbdce13 resolved: basic OpenSSL support for DNS-over-TLS
This provides basic OpenSSL support without optimizations like TCP Fast Open and TLS Session Tickets.
Notice only a single SSL library can be enabled at a time and therefore journald functions provided by GnuTLS will be disabled when using OpenSSL.
Fixes #9531
2018-07-27 21:23:17 +01:00
Zbigniew Jędrzejewski-Szmek ae1d4a70a6
Merge pull request #8876 from yuwata/meson-0.46
meson: bump minimum required version to 0.46
2018-07-24 13:41:57 +02:00
Zbigniew Jędrzejewski-Szmek 915fa28549
Merge pull request #9560 from mbiebl/uaccess-dev-kvm
Re-add uaccess tag for /dev/kvm
2018-07-23 20:10:38 +02:00
Yu Watanabe 7a6397d2b3 meson: use has_link_argument() and friends
This bumps the minimum required version of meson to 0.46, as
`has_link_argument()` and friends are supported since 0.46.
2018-07-24 01:31:22 +09:00
Yu Watanabe ac09340e85 meson: use integer type in options
This bumps the minimum required version of meson to 0.45 and
python to 3.5, as integer type option is supported since meson-0.45
and meson-0.45 requires python-3.5.
2018-07-24 01:31:21 +09:00
Yu Watanabe 08540a9591 meson: allow building resolved and machined without nss modules
This adds -Dnss-resolve= and -Dnss-mymachines= meson options.
By using this option, e.g., resolved can be built without nss-resolve.
When no nss modules are built, then test-nss is neither built.

Also, This changes the option name -Dmyhostname= to -Dnss-myhostname=
for consistency to other nss related options.

Closes #9596.
2018-07-23 14:03:05 +02:00
Yu Watanabe a0cb8078b1 meson: drop redundant messages
The equivalent messages are shown in the last summary.
2018-07-23 14:03:05 +02:00
Chen Qi 2484bff32b check nobody user/group validity only when not cross compiling
Using `getent' and `id' command in case of cross compiling does not
make much sense. This is because it is the host files that are checked.

Besides, in some restricted cross compilation environment, these two
command may not even be available. This is to avoid host comtamination.

So we should only check the validity using getent and id when not
cross compiling.
2018-07-23 13:08:32 +02:00
Zbigniew Jędrzejewski-Szmek 1d7aedf11a meson: remove false check for key_serial_t
key_serial_t is defined in keyutil.h, which wasn't included in the header list
in the test, so the test always failed. We were always compiling stuff with
!HAVE_KEY_SERIAL_T.

We could try to add keyutil.h to the test, but then we'd have to first check if
it is available, which just doesn't seem worth the trouble.

key_serial_t should always be defined as int32_t. Let's keep the uncoditional
define, since repeated compatible typedefs are not a problem, and it allows us
to compile even if the header file is missing. If there's ever a change in the
definition, we'll have to adjust the code for the different type anyway, and
our compiler will tell us.
2018-07-18 17:46:33 +02:00
Zbigniew Jędrzejewski-Szmek 9c869d08d8 meson: unify linux/stat.h check with other checks and use _GNU_SOURCE
Using _GNU_SOURCE is better because that's how we include the headers in the
actual build, and some headers define different stuff when it is defined.
sys/stat.h for example defines 'struct statx' conditionally.
2018-07-18 17:40:41 +02:00
Filipe Brandenburger 75720bff62 build-sys: Detect whether struct statx is defined in sys/stat.h
Starting with glibc 2.27.9000-36.fc29, include file sys/stat.h will have a
definition for struct statx, in which case include file linux/stat.h should be
avoided, in order to prevent a duplicate definition.

    In file included from ../src/basic/missing.h:18,
		     from ../src/basic/util.h:28,
		     from ../src/basic/hashmap.h:10,
		     from ../src/shared/bus-util.h:12,
		     from ../src/libsystemd/sd-bus/bus-creds.c:11:
    /usr/include/linux/stat.h:99:8: error: redefinition of ‘struct statx’
     struct statx {
	    ^~~~~
    In file included from /usr/include/sys/stat.h:446,
		     from ../src/basic/util.h:19,
		     from ../src/basic/hashmap.h:10,
		     from ../src/shared/bus-util.h:12,
		     from ../src/libsystemd/sd-bus/bus-creds.c:11:
    /usr/include/bits/statx.h:36:8: note: originally defined here
     struct statx
	    ^~~~~

Extend our meson.build to look for struct statx when only sys/stat.h is
included and, in that case, do not include linux/stat.h anymore.

Tested that systemd builds correctly when using a glibc version that includes a
definition for struct statx.

glibc Fedora RPM update:
28cb5d31fc

glibc upstream commit:
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fd70af45528d59a00eb3190ef6706cb299488fcd
2018-07-16 11:14:29 +02:00
Michael Biebl ace5e3111c Do not apply uaccess tag for /dev/kvm if mode is 0666 2018-07-13 23:38:55 +02:00
Yu Watanabe 48f5da19b6 meson: do not compare objects of different types
This fixes the following warning:
```
meson.build:1140: WARNING: Trying to compare values of different types (DependencyHolder, list) using !=.
The result of this is undefined and will become a hard error in a future Meson release.
```

Follow-up for f02582f69fe1e7663a87ba80bd4f90d5d23ee75f(#9410).
2018-06-28 10:05:19 +02:00
Yu Watanabe f02582f69f meson: check whether gnutls supports TCP fast open
Fixes #9403
2018-06-26 00:30:29 +09:00
Lennart Poettering de7436b02b meson: bump package and library version 2018-06-22 13:11:49 +02:00
Yu Watanabe 56ddbf1009 meson: make DNS-over-TLS support optional
This adds dns-over-tls option to meson. If set to 'false',
systemd-resolved is not linked with libgnutls.
2018-06-20 22:28:01 +02:00
Zbigniew Jędrzejewski-Szmek 0cd41d4dff Drop my copyright headers
perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms'
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms'
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
2018-06-14 13:03:20 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Iwan Timmer c9299be2f5 resolve: rename PrivateDNS to DNSOverTLS
PrivateDNS is not considered a good name for this option, so rename it to DNSOverTLS
2018-06-14 09:57:56 +02:00
Iwan Timmer 5d67a7ae74 resolved: support for DNS-over-TLS
Add support for DNS-over-TLS using GnuTLS. To reduce latency also TLS False Start and TLS session resumption is supported.
2018-06-11 21:35:58 +02:00
Zbigniew Jędrzejewski-Szmek d28b67d46a meson: also reject shifts that change the sign bit
../src/test/test-sizeof.c: In function ‘main’:
../src/test/test-sizeof.c:70:24: error: result of ‘1 << 31’ requires 33 bits to represent, but ‘int’ only has 32 bits [-Werror=shift-overflow=]
                 X = (1 << 31),
                        ^~
cc1: some warnings being treated as errors

Follow-up for b05ecb8cad.
2018-06-11 17:06:58 +02:00
Zbigniew Jędrzejewski-Szmek b05ecb8cad meson: do not allow bit-shift overflows
The primary motivation is to catch enum values created through a shift that is
too big:

../src/test/test-sizeof.c:26:29: error: left shift count >= width of type [-Werror=shift-count-overflow]
         enum_with_shift = 1 << 32,
                             ^~
cc1: some warnings being treated as errors

The compiler will now reject those.

This is an alternative to #9224.
2018-06-09 12:42:30 -07:00
Zbigniew Jędrzejewski-Szmek d40f5cc498 CODING_STYLE: allow c99-style mixed code and declarations
We already allowed variables to be declared in the middle of a function
(whenever a new scope was opened), so this isn't such a big change. Sometimes
we would open a scope just to work around this prohibition.

But sometimes the code can be much clearer if the variable is declared
somewhere in the middle of a scope, in particular if the declaration is
combined with initialization or acquisition of some resources. So let's allow
this, but keep things in the old style, unless there's a good reason to move
the variable declaration to a different place.
2018-06-07 16:42:34 +02:00
Felipe Sateler f3794366b0 build-sys: Add option to link systemctl statically
Systemctl is special because it is required for many tasks that may need to
be performed when the system is not fully configured and/or partially
broken:

1. Installing/Uninstalling services during OS installs and upgrades
2. Shutting down the system

Therefore reduce the number of dependencies that systemctl pulls in, by
not linking to systemd-shared. This brings a bit of resilience to
systemctl (and its aliases shutdown, reboot, etc), by linking against
less external libraries.

Because this extra resilience comes at a cost of approximately 580 KB
extra space, this is done behind a meson build option.
2018-05-31 16:05:00 +02:00
Zbigniew Jędrzejewski-Szmek a38f7fec44 fuzz-journal-remote: a fuzzer for journal-remote over-the-wire input 2018-05-31 13:04:18 +02:00
Zbigniew Jędrzejewski-Szmek c064d8db40 journal-remote: split out µhttpd support and main() into a separate file
This is in preparation to reusing the RemoteServer in other concepts.
I tried to keep changes to minimum:
- arg_* global variables are now passed as state in RemoteServer
- exported functions get the "journal_remote_" prefix
- some variables are renamed

In particular, there is an ugly global RemoveServer* variable. It was originally
added because µhttpd did not allow state to be passed to the callbacks. I'm not
sure if this has been remediated in µhttpd, but either way, this is not changed
here, the global variable is only renamed for clarity.
2018-05-31 13:04:18 +02:00
Zbigniew Jędrzejewski-Szmek 97d9061563 meson: use a convenience static library for nspawn core
This makes it easier to link the nspawn implementation to the tests.
Right now this just means that nspawn-patch-uid.c is not compiled
twice, which is nice, but results in test-patch-uid being slightly bigger,
which is not nice. But in general, we should use convenience libs to
compile everything just once, as far as possible. Otherwise, once we
start compiling a few files here twice, and a few file there thrice, we
soon end up in a state where we are doing hundreds of extra compilations.
So let's do the "right" thing, even if is might not be more efficient.
2018-05-28 10:40:00 +02:00
Lennart Poettering 61d0578b07 add new portable service framework
This adds a small service "systemd-portabled" and a matching client
"portablectl", which implement the "portable service" concept.

The daemon implements the actual operations, is PolicyKit-enabled and is
activated on demand with exit-on-idle.

Both the daemon and the client are an optional build artifact, enabled
by default rhough.
2018-05-24 17:01:57 +02:00
Yu Watanabe 0297f67e7a
Merge pull request #9036 from keszybz/rpm-macro-cleanup
rpm macro cleanup
2018-05-20 23:20:24 +09:00
Zbigniew Jędrzejewski-Szmek 424e80b4b7 rpm: add macros for common configuration dirs
%_environmnentdir /usr/lib/environment.d
%_modulesloaddir /usr/lib/modules-load.d
%_modprobedir /usr/lib/modprobe.d

This makes installing files there more convenient because people don't need to
construct the path from %_prefix/lib/… .

See https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/GBF5WJLTQVSXMHGYGBF3723ZYCWFBR7C/.
2018-05-19 17:02:59 +02:00
Evegeny Vereshchagin 2f09974f34 meson: use run_target for generating tags with ctags
In https://github.com/systemd/systemd/pull/6561, `run_target`
was changed to `custom_target`, which inadvertently caused
relative paths to be passed to ctags due to
https://github.com/mesonbuild/meson/issues/3589.
The switch to `run_target` causes absolute paths to be
passed again and makes it easier to jump from file to
file, hopefully delaying the need to exit Vim :-)
2018-05-19 15:32:47 +02:00
Zbigniew Jędrzejewski-Szmek d18cb3937b Turn VALGRIND variable into a meson configuration switch
Configuration through environment variable is inconvenient with meson, because
they cannot be convieniently changed and/or are not preserved during
reconfiguration (https://github.com/mesonbuild/meson/issues/1503).
This adds -Dvalgrind=true/false, which has the advantage that it can be set
at any time with meson configure -Dvalgrind=... and ninja will rebuild targets
as necessary. Additional minor advantages are better consistency with the
options for hashmap debugging, and typo avoidance with '#if' instead of '#ifdef'.
2018-05-17 09:54:36 -07:00
Yu Watanabe ad7aa76061 meson: use array type option
Array type option is supported since 0.44.0.
2018-05-10 15:31:00 +09:00
Yu Watanabe 8ea9fad715 meson: use warning() method
This bumps the required minimum version of meson to 0.44, as
`warning()` method is supported since 0.44.
2018-05-10 15:30:56 +09:00
Yu Watanabe 30a4ddff7f meson: use get_supported_arguments()
This bumps the required minimum version of meson to 0.43, as
`get_supported_arguments()` is supported since meson-0.43.
2018-05-10 15:30:42 +09:00
Zbigniew Jędrzejewski-Szmek f5ce2e764f
Merge pull request #8689 from davide125/static
meson: add support for building static libsystemd and libudev
2018-05-10 00:39:36 +02:00
Zbigniew Jędrzejewski-Szmek 975464e0d4 meson: recompile all sources for install_libudev_static and install_libsystemd_static
This means that when those targets are built, all the sources are built again,
instead of reusing the work done to create libbasic.a and other convenience static
libraries. It would be nice to not do this, but there seems to be no support in
our toolchain for joining multiple static libraries into one. When linking
a static library, any -l arguments are simply ignored by ar/gcc-ar, and .a
libraries given as positional arguments are copied verbatim into the archive
so they objects in them cannot be accessed.

https://stackoverflow.com/questions/2157629/linking-static-libraries-to-other-static-libraries
suggests either unzipping all the archives and putting them back togather,
or using a linker script. Unzipping and zipping back together seems ugly.
The other option is not very nice. The linker script language does not
allow "+" to appear in the filenames, and filenames that meson generates
use that, so files would have to be renamed before a linker script was used.
And we would have to generate the linker script on the fly. Either way, this
doesn't seem attractive. Since those static libraries are a niche use case,
it seems reasonable to just go with the easiest and safest solution and
recompile all the source files. Thanks to ccache, this is probably almost as
cheap as actually reusing the convenience .a libraries.

test-libsystemd-sym.c and test-libudev-sym.c compile fine with the generated
static libs, so it seems that they indeed provide all the symbols they should.
2018-05-08 17:33:04 +02:00
Davide Cavalca 20f3d32d8d meson: only build test-lib{systemd,udev}-static-sym for pic 2018-05-08 17:33:04 +02:00
Zbigniew Jędrzejewski-Szmek 0632b4cd36 meson: add test-lib{systemd,udev}-static-sym
This is the same as test-lib{systemd,udev}-sym, but linked to the static
variants of those libraries.
2018-05-08 17:33:04 +02:00
Davide Cavalca 70848ecfc6 meson: add support for building static libsystemd and libudev 2018-05-08 17:33:04 +02:00
Yu Watanabe 348b44372f meson: generate m4 preprocessor from config.h (#8914) 2018-05-07 11:17:35 +02:00
Yu Watanabe 6129ec852e timedatectl: add timesync-status and show-timesync commands
Closes #1589.
2018-05-03 18:07:43 +09:00
Yu Watanabe b0903bb585 meson: drop 'name' argument in cc.has_argument() (#8878) 2018-05-02 10:05:51 +02:00
Lennart Poettering 385f3a0d8d
Merge pull request #7599 from keszybz/slice-templates
Make user@.service independent of logind
2018-04-26 21:39:05 +02:00
Yu Watanabe 8ac42236b0 meson: drop 'name' argument in cc.has_argument() (#8823)
This fixes the following warning with clang and meson-0.46.0,
```
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
Compiler for C supports arguments -Wno-typedef-redefinition: YES
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
Compiler for C supports arguments -Wno-gnu-variable-sized-type-not-at-end: YES
```
2018-04-26 10:53:10 +02:00
Zbigniew Jędrzejewski-Szmek a9f0f5e501 logind: split %t directory creation to a helper unit
Unfortunately this needs a new binary to do the mount because there's just
too many special steps to outsource this to systemd-mount:
- EPERM needs to be treated specially
- UserRuntimeDir= setting must be obeyed
- SELinux label must be adjusted

This allows user@.service to be started independently of logind.
So 'systemctl start user@nnn' will start the user manager for user nnn.
Logind will start it too when the user logs in, and will stop it (unless
lingering is enabled) when the user logs out.

Fixes #7339.
2018-04-25 16:20:28 +02:00
Yu Watanabe c2e84cab3a resolvectl: rename systemd-resolve to resolvectl
For the compatibility, `systemd-resolve` will be created as a symbolic
link to `resolvectl`.
2018-04-19 03:24:23 +09:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Filipe Brandenburger add384dd4d units: use `systemctl exit` to kill the user manager (#8648)
Use `systemctl --user --force exit` to implement the systemd-exit
user service.

This removes our dependence on an external `kill` binary and the
concerns about whether they recognize SIGRTMIN+n by name or what their
interpretation of SIGRTMIN is.

Tested: `systemctl --user start systemd-exit.service` kills the
  `systemd --user` instance for my user.
2018-04-04 11:14:37 +02:00
Lennart Poettering 2d684e65aa doc: merge docs/ dir → doc/
It's weird having two subdirs for documentation, let's unify this in
one.
2018-03-28 09:38:30 -07:00
Zbigniew Jędrzejewski-Szmek b1ffacb631 tests: skip udev-test when perl is not installed 2018-03-22 15:57:56 +01:00
Peter A. Bigot 5c3376efcd time-sync-wait: add service (#8494)
This one-shot service waits until the kernel time has been set to
synchronized.
2018-03-21 12:42:04 +01:00
Lennart Poettering 8c637fe242
Merge pull request #8452 from keszybz/use-libmount-more
Use libmount in systemd-shutdown, add tests
2018-03-20 09:53:34 +01:00
Yu Watanabe bcabcde5d2
Merge pull request #8408 from keszybz/ln-relative
bugs.fd.o bug archelogy
2018-03-19 18:32:30 +09:00
Zbigniew Jędrzejewski-Szmek 95b862b054 shutdown: use libmount to enumerate /proc/self/mountinfo
This is analogous to 8d3ae2bd4c, except that now
src/core/umount.c not src/core/mount.c is converted.

Might help with https://bugzilla.redhat.com/show_bug.cgi?id=1554943, or not.

In the patch, mnt_free_tablep and mnt_free_iterp are declared twice. It'd
be nicer to define them just once in mount-setup.h, but then libmount.h would
have to be included there. libmount.h seems to be buggy, and declares some
defines which break other headers, and working around this is more pain than
the two duplicate lines. So let's live with the duplication for now.

This fixes memleak of MountPoint in mount_points_list_get() on error, not that
it matters any.
2018-03-16 10:09:46 +01:00
Zbigniew Jędrzejewski-Szmek 52d4d1d339 test: run all fuzz regression tests with all sanitizers
We currently have just one sanitizer for tests, asan, but we may add more in
the future. So let's keep the loop over the sanitizers in meson.build, but
just enable all regression cases under all sanitizers. If it fails under one
of them, it might fail under a different one.

In subsequent commits I'll add test cases which might not fail under asan,
but it's good to commit them for future use.

The test names are made more verbose:
256/257 fuzz-dns-packet:oss-fuzz-5465:address   OK       0.04 s
257/257 fuzz-dns-packet:issue-7888:address      OK       0.03 s
2018-03-14 14:27:04 +01:00
Zbigniew Jędrzejewski-Szmek 99eae076eb
Merge pull request #8296 from poettering/resolvconf
resolvconf(8) compat interface
2018-03-12 17:27:39 +01:00
Zbigniew Jędrzejewski-Szmek 6fed2cc41f
Merge pull request #8412 from keszybz/meson-warning-fixes
Meson warning fixes
2018-03-09 20:12:37 +01:00
Michal Koutný c7f7e859f0 man: Correct value of default KillUserProcesses= 2018-03-09 18:29:25 +01:00
Michal Koutný 7f672e865a man: Unify values of boolean configuration values with sample config 2018-03-09 18:29:05 +01:00
Zbigniew Jędrzejewski-Szmek c0b4b0f8f5 meson: libmount is required for oss-fuzz builds now too
See https://github.com/google/oss-fuzz/issues/1191.
2018-03-09 14:58:47 +01:00
Zbigniew Jędrzejewski-Szmek af4d7860c4 meson: avoid warning about comparison of bool and string
meson.build:2907: WARNING: Trying to compare values of different types (bool, str) using ==.
The result of this is undefined and will become a hard error in a future Meson release.
2018-03-09 14:21:08 +01:00
Zbigniew Jędrzejewski-Szmek cd001016a1 meson: add note about coreutils version with ln --relative
https://bugs.freedesktop.org/show_bug.cgi?id=90799
2018-03-09 10:31:10 +01:00
Zbigniew Jędrzejewski-Szmek ad6a085310 meson: bump so revision and systemd version in preparation for v238 2018-03-05 17:21:09 +01:00
Lennart Poettering 088c136384 resolve-tool: provide resolvconf(8) compatibility
This turns resolve-tool into a multi-call binary. When invoked as
"resolvconf" it provides minimal compatibility with the resolvconf(8)
tool of various distributions (and FreeBSD as it appears).

This new interface understands to varying degrees features of the two
major implementations of resolvconf(8): Debian's original one and
"openresolv". Specifically:

Fully supported:

        -a -d (supported by all implementations)
        -f    (introduced by openresolv)

Somewhat supported:

        -x    (introduced by openresolv, mapped to a '~.' domain entry)

Unsupported and ignored:

        -m -p (introduced by openresolv, not really necessary for us)

Unsupported and resulting in failure:
        -u    (supported by all other implementations)
        -I -i -l -R -r -v -V
              (all introduced by openresolv)
        --enable-updates --disable-updates --updates-are-enabled
              (specific to Debian's implementation)

Of course, resolvconf(8) is a tool with multiple backends, in our
implementation systemd-resolved is the only backend.

Fixes: #7202
2018-03-02 15:48:46 +01:00
Zbigniew Jędrzejewski-Szmek 3cca71c456
Merge pull request #8323 from xyproto/ok_color
Make the color of the status OK configurable at build-time
2018-03-02 13:00:07 +01:00
Zbigniew Jędrzejewski-Szmek f7c5427c28 meson: use dashes in colour names 2018-03-02 09:09:29 +01:00
Alexander F Rødseth 96164a3936 Add build-time option to change the color of the "OK" status text 2018-03-02 09:00:44 +01:00
Zbigniew Jędrzejewski-Szmek 671f0f8de0 Remove /sbin from paths if split-bin is false (#8324)
Follow-up for 157baa87e4.
2018-03-01 21:48:36 +01:00
Zbigniew Jędrzejewski-Szmek 157baa87e4 meson: support both separate and merged sbin-bin directories
Follow-up for ba7f4ae617.

By default, we detect if the real root has a separate /usr/sbin directory, but
this can be overrides with -Dsplit-bin=true|false. The check assumes that
/usr/sbin is split if it is not a symlink, so it'll return a false negative
with some more complicated setups. But that's OK, in those cases this should be
configured explicitly.

This will copy the structure of the directories in the root file system to
$DESTDIR. If a directory is a directory in $DESTDIR but a symlink in the root
file system, this script will fail. This means that it's not possible to reuse
a $DESTDIR from between ba7f4ae61 and this patch.
2018-03-01 12:27:33 +01:00
Zbigniew Jędrzejewski-Szmek 2675413e39 meson: autodetect split-usr
Also move the status from "features" to the paths section. This is more of an
anti-feature.
2018-03-01 12:23:00 +01:00
Zbigniew Jędrzejewski-Szmek ba7f4ae617 meson: install compat symlinks for systemctl and systemd (#8300)
v2:
- init is a symlink to systemd, not systemctl!
2018-02-28 10:20:48 +01:00
Lennart Poettering f09eb7688e doc: add a new doc/ directory, and move two markdown docs into them
I figure sooneror later we'll have more of these docs, hence let's give
them a clean place to be.

This leaves NEWS and README/README.md as well as the LICENSE texts in
the root directory of the project since that appears to be customary for
Free Software projects.
2018-02-27 19:59:09 +01:00
Zbigniew Jędrzejewski-Szmek aa484f3561 tree-wide: use reallocarray instead of our home-grown realloc_multiply (#8279)
There isn't much difference, but in general we prefer to use the standard
functions. glibc provides reallocarray since version 2.26.

I moved explicit_bzero is configure test to the bottom, so that the two stdlib
functions are at the bottom.
2018-02-26 21:20:00 +01:00
Lennart Poettering 4c2e1b399f xattr-util: use crtime/btime if statx() is available for implementation of fd_setcrtime() and friends
The Linux kernel exposes the birth time now for files through statx()
hence make use of it where available. We keep the xattr logic in place
for this however, since only a subset of file systems on Linux currently
expose the birth time. NFS and tmpfs for example do not support it. OTOH
there are other file systems that do support the birth time but might
not support xattrs (smb…), hence make the best of the two, in particular
in order to deal with journal files copied between file system types and
to maintain compatibility with older file systems that are updated to
newer version of the file system.
2018-02-20 15:41:49 +01:00
Caio Marcelo de Oliveira Filho 2f62cf3552 meson: apply defaults if /etc/login.defs doesn't exist
Apply defaults for system_{uid,gid}_max even if the /etc/login.defs file
doesn't exist (e.g. in Clear Linux with no changes).

awk returns an empty string in case the file doesn't exist, causing meson to
fail in to_int(). So set the default if output is empty. This makes the BEGIN{}
blocks unnecessary, so remove them.
2018-02-19 12:59:37 +01:00
Caio Marcelo de Oliveira Filho 9e70f2f818 meson: use multiline string syntax (#8214)
The single quote working with multiple lines is likely to be unintended. With
current versions of meson, it also causes error messages after it to report the
wrong line number. Use the documented syntax instead.
2018-02-19 18:37:19 +09:00
Zbigniew Jędrzejewski-Szmek 444d586333 meson: add -Dmemory-accounting-default=true|false
This makes it easy to set the default for distributions and users which want to
default to off because they primarily use older kernels.
2018-02-15 12:02:41 +01:00
tblume 75aaade16b meson.build: make docdir configurable (#8068)
SUSE is using a different docdir, so the path should be configurable
2018-02-02 06:46:15 +09:00
Lennart Poettering 7755083256
Merge pull request #7881 from keszybz/pcre
Add new --grep option to journalctl
2018-01-28 15:29:10 +01:00
Zbigniew Jędrzejewski-Szmek 6becf48ca3 journalctl: regexp matching 2018-01-27 13:40:57 +01:00
Evgeny Vereshchagin 4c0d481095
Merge pull request #7933 from keszybz/fuzz-regression
test: add fuzzer regression testing
2018-01-27 12:56:42 +03:00
Zbigniew Jędrzejewski-Szmek 25a8210234 meson: use env object instead of string in tags targets
I used 'tags' before because this way we avoided a unnecessary
line about 'env' detection. But we cannot use 'env' in test(), so
previous commit added 'env' detection. We might just as well use
it in custom_target().
2018-01-27 09:03:46 +01:00
Zbigniew Jędrzejewski-Szmek b68dfb9e83 Hook up oss-fuzz test cases as tests
This is a bit painful because a separate build of systemd is necessary. The
tests are guarded by tests!=false and slow-tests==true. Running them is not
slow, but compilation certainly is. If this proves unwieldy, we can add a
separate option controlling those builds later.

The build for each sanitizer has its own directory, and we build all fuzzer
tests there, and then pull them out one-by-one by linking into the target
position as necessary. It would be nicer to just build the desired fuzzer, but
we need to build the whole nested build as one unit.

[I also tried making systemd and nested meson subproject. This would work
nicely, but meson does not allow that because the nested target names are the
same as the outer project names. If that is ever fixed, that would be the way
to go.]

v2:
- make sure things still work if memory sanitizer is not available
v3:
- switch to syntax which works with meson 0.42.1 found in Ubuntu
2018-01-27 09:03:46 +01:00
Zbigniew Jędrzejewski-Szmek e12fa1fdb4
Merge pull request #7996 from poettering/v237-prepare
preparation for v237
2018-01-25 17:41:25 +03:00
Björn Esser 9f555bba67 firstboot: Include <crypt.h> for declaration of crypt() if needed (#7944)
Not every target system may provide a crypt() function in its stdlibc
and may use an external or replacement library, like libxcrypt, for
providing such functions.

See https://fedoraproject.org/wiki/Changes/Replace_glibc_libcrypt_with_libxcrypt.
2018-01-25 17:30:15 +03:00
Lennart Poettering 69cd51de5d meson: bump so revision and systemd version in preparation for v237 2018-01-25 14:18:14 +01:00
Jonathan Rudenberg 31e57a35dc fuzz: allow building fuzzers outside of oss-fuzz
Add a new -Dllvm-fuzz=true option that can be used to build against
libFuzzer and update the oss-fuzz script to work outside of the
oss-fuzz build environment.
2018-01-17 13:57:06 -05:00
Jonathan Rudenberg b4081f3ea2 fuzz: disable all deps when building with oss-fuzz
The fuzz targets are intended to be fast and only target systemd
code, so they don't need to call out to any dependencies. They also
shouldn't depend on shared libraries outside of libc, so we disable
every dependency when compiling against oss-fuzz. This also
simplifies the upstream build environment significantly.
2018-01-17 13:57:06 -05:00
Jonathan Rudenberg 7db7d5b733 fuzz: add initial fuzzing infrastructure
The fuzzers will be used by oss-fuzz to automatically and
continuously fuzz systemd.

This commit includes the build tooling necessary to build fuzz
targets, and a fuzzer for the DNS packet parser.
2018-01-17 13:57:06 -05:00
Adam Duskett 08318a2c5a add false option for tests (#7778)
Currently there is no way to prevent tests from building using meson.
This introduces two problems:

1) It adds a extra 381 files to compile.
2) One of these tests explicitly requires libgcrypt to be built even if systemd
   is not using it.
3) It adds C++ to the requirements to build systemd.

When cross-compiling, this is uneccessary.
2018-01-15 15:25:46 +04:00
Zbigniew Jędrzejewski-Szmek c4c978a07f meson: detect pcre2 dep 2018-01-12 14:44:45 +01:00
Lennart Poettering 51b13863a2 meson: resurrect API documentation target
We had this functionality back in Automake times, let's resurrect it.
2018-01-05 13:58:33 +01:00
Mike Gilbert 2fa645f1cc meson: don't search PATH for telinit (#7770)
On a typical system running systemd, the telinit in PATH is very likely to be a symlink
to systemctl. Setting TELINIT to this may result in an infinite recursion if telinit is called
and sd_booted() == 0. This may commonly occur in a chroot environment.

Bug: https://bugs.gentoo.org/642724

[zj:
The path was originally hardcoded as "/lib/upstart/telinit", but was made configurable without
changing the default in 4ad61fd180. Then the default was
changed to `/lib/sysvinit/telinit` in abaaabf40a. Then it
started being  autodetected when meson support was added in 
5c23128dab. This patch restores the behaviour that was 
implemented in configure.ac at the time of its removal.]
2018-01-04 13:14:20 +01:00
Lennart Poettering 7f9ac71c76
Merge pull request #7705 from keszybz/redo-linking
Redo linking
2018-01-03 18:37:00 +01:00
Zbigniew Jędrzejewski-Szmek 7f1ea2cc94 meson: add a single .h file to shared libs with no sources
Otherwise stuff doesn't build on old Ubuntu with meson-0.42.1-1~xenial.
2018-01-03 12:09:46 +01:00
Zbigniew Jędrzejewski-Szmek 568a4ff8b1 meson: use a convenience lib for shared resolve files
This reduces the man=false meson target count from 1281 to 1253.

--

A fully scientific test:
  git grep _sources, :/*.build|cut -d: -f2|tr -d ' '|sort|uniq -c
reveals that libudev_sources is the only source list now reused twice.  There's
some ugly circular dependency between libudev and libshared, and anyway I'm not
sure if we don't want to use different compilation options (LOG_REALM_…) in
those two cases, so I'm leaving that alone for now.
2018-01-03 12:09:46 +01:00
Zbigniew Jędrzejewski-Szmek 0c06b50662 meson: rename libudev_internal to libudev_static and link into libudev
This reduces the meson man=false target count to 1281.

v2:
- link test-engine with libshared instead of libsystemd_static
Previous version built fine on F27, but fails on F26 with the following error:
/usr/bin/ld: /tmp/ccr8HRGw.ltrans6.ltrans.o: undefined reference to symbol '__start_BUS_ERROR_MAP@@SD_SHARED'
/home/zbyszek/fedora/systemd/systemd-9d5aae75c64f5583a110f03b94816aacc03bbf4d/x86_64-redhat-linux-gnu/src/shared/libsystemd-shared-236.so: error adding symbols: DSO missing from command line

v3:
- add libudev_basic
2018-01-03 12:09:46 +01:00
Zbigniew Jędrzejewski-Szmek 5e3cec87be meson: use a convenience lib for journal user sources
Instead of compiling those files twice, once for libsystemd and once for
libshared, compile once as a static archive and then link into both.
This reduce the meson target for man=no compile to 1291.
2018-01-03 12:09:46 +01:00
Zbigniew Jędrzejewski-Szmek 34e221a58b Move gcrypt-util to basic/
We were including gcrypt-util.[ch] by hand in the few places where it
was used. Create a convenience library to avoid compiling the same
files multiple times.

v2:
- use a separate static library instead of mergin into libbasic
2018-01-03 12:09:45 +01:00
Zbigniew Jędrzejewski-Szmek 2d4ceca8a5 meson: link libbasic and libshared_static into libshared
gcrypt_util_sources had to be moved because otherwise they appeared twice
in libshared.so halfproducts, causing an error.

-fvisibility=default is added to libbasic, libshared_static so that the symbols
appear properly in the exported symbol list in libshared.

The advantage is that files are not compiled twice. When configured with -Dman=false,
the ninja target list is reduced from 1588 to 1347 targets. The difference in compilation
time is small (<10%). I think this is because of -O0 and ccache and multiple cores, and
in different settings the compilation time could be reduced. The main advantage is that
errors and warnings are not reported twice.
2018-01-03 12:09:14 +01:00
Lennart Poettering 2acfd0ff43 meson: hopefully renameat2() will show up where renameat() is defined
Should glibc add this eventually, let's try to be smart where to look
for it.
2017-12-25 12:35:43 +01:00
Lennart Poettering 7b961e40ee meson: look for gettid() definition where getpid() is defined
Hopefully, should gettid() show up one day in glibc it'll show up where
getpid() is defined too.
2017-12-25 12:35:28 +01:00
Lennart Poettering 3c042add1d meson: when pivot_root() is added one day, look for it in <unistd.h>
We of course don't know in which header glibc will export pivot_root()
and if it ever will. But there's a good chance they'll place it where
chroot() is located, given the similarity in the operations, hence let's
try our luck and look for it at the same place.

If we are lucky this means we don't have to patch our code if glibc
decides to expose the call one day.
2017-12-25 12:10:22 +01:00
Lennart Poettering 85db59b794 meson: use "args" for setting _GNU_SOURCE when checking for functions
This reworks how we set _GNU_SOURCE when checking for the availability
of functions:

1. We set it for most of the functions we look for. After all we set it
for our entire built anyway, and it's usually how Linux-specific
definitions in glibc are protected these days. Given that we usually
have checks for such modern stuff only anyway, let's just blanket enable
it.

2. Use "args" instead of "prefix" to set the macro. This is what is
suggested in the meson docs, hence let's do it.
2017-12-25 12:10:14 +01:00
Yu Watanabe 0e50bfaefd meson: define _GNU_SOURCE to detect copy_file_range() (#7734)
Follow-up for bad7a0c81f501fbbcc79af9eaa4b8254441c4a1f of git
repository for glibc.

Recently glibc added `copy_file_range()`, but to use it,
`_GNU_SOURCE` needs to be defined. This adds the flag in
meson.build to detect the function by meson correctly.
2017-12-25 11:42:42 +01:00
Susant Sahani d384826f69 networkd: Add support for ipvlan L3s and flags (#7726)
This works supports to configure L3S mode and flags
such as bridge, private and vepa
2017-12-23 18:55:03 +01:00
Zbigniew Jędrzejewski-Szmek 4f561ecda9 meson: reuse libsystemd_static for libsystemd
This gets rid of recompilation, making things faster and avoids duplicated warnings.
The result seems to be the same:
$ ls -l build/libsystemd.so.0.20.0 build2/libsystemd.so.0.20.0
-rwxrwxr-x. 1 zbyszek zbyszek 3071312 Dec 19 11:45 build2/libsystemd.so.0.20.0
-rwxrwxr-x. 1 zbyszek zbyszek 3071760 Dec 19 11:11 build/libsystemd.so.0.20.0
$ diff -U1 <(objdump -T build/libsystemd.so.0.20.0|sed -r 's/[0-9a-f]{16}/________________/g') <(objdump -T build2/libsystemd.so.0.20.0|sed -r 's/[0-9a-f]{16}/________________/g')
-build/libsystemd.so.0.20.0:     file format elf64-x86-64
+build2/libsystemd.so.0.20.0:     file format elf64-x86-64
2017-12-21 17:01:23 +01:00
Zbigniew Jędrzejewski-Szmek 37e4d7a855 meson: rename libsystemd_internal to libsystem_static
We already use the "_static" suffix for libshared_static ("shared" is the name
of the library, "static" is the format) and other libs, so let's rename for
consistency.

Also change libsystemd_static_sources to libsystemd_sources, since the same
list is used for both and shorter is better.
2017-12-21 17:01:02 +01:00
Felipe Sateler f9f54413db build-sys: install TRANSIENT-SETTINGS.md and UIDS-GIDS.md (#7690) 2017-12-18 14:58:13 +01:00
Franck Bui 6671e818e9 meson: libudev_core and udevadm should have LOG_REALM=LOG_REALM_UDEV (#7666)
Otherwise, setting udev_log=debug in /etc/udev/udev.conf has no effects since
systemd-udevd is built with LOG_REALM=LOG_REALM_UDEV.

However using LOG_REALM_UDEV (for libudev_core) reveals another similar bug for
udevadm which should also define LOG_REALM_UDEV.
2017-12-16 09:36:36 +01:00
Max Harmathy 5424824adf Fix logical error in meson.build (#7658)
sysvinit_path and sysvrcnd_path have to be set both to activate Sysv compatibility.
2017-12-15 16:05:25 +01:00
Lennart Poettering cbd73c69ba meson: increase version numbers 2017-12-14 17:29:30 +01:00
Lennart Poettering b4b36f4405 meson: link NSS modules with -z nodelete (#7607)
We might end up allocating mempools, and when we are unloaded we might
orphan them, thus leaking them. Hence, let's just stick around for good,
so the mempools remain referenced continously and for good, and thus no
memory is leaked (though the memory isn't cleaned up either).

Fixes: #7596
2017-12-12 20:13:16 +01:00
Lennart Poettering 9e32914aa5
Merge pull request #7570 from keszybz/sulogin-shell-reload-manager
Reload manager before exit from sulogin shell
2017-12-08 13:09:45 +01:00
Zbigniew Jędrzejewski-Szmek e821f6a916 meson: place systemd-sulogin-shell in build/
We do that will all executables so that it's easy to call them.
2017-12-07 12:34:12 +01:00
Yu Watanabe 8374cc6235 meson: warn if nobody-user and nobody-group are set to different name
It may work, but is very strange. So, let's warn about that.

v2:
Debian uses nobody and nogroup. Do not warn such case.
2017-12-07 17:19:11 +09:00
Yu Watanabe 6071202165 sysusers: use NOBODY_USER_NAME 2017-12-07 17:12:13 +09:00
Lennart Poettering c7a54cd67b
Merge pull request #7419 from keszybz/tmpfiles-fixes
Tmpfiles --user mode and various fixes
2017-12-06 19:50:26 +01:00
Lennart Poettering afde45740f meson: print warnings if the "nobody" user/group name is not compatible with the local system
At least on Fedora and Debian systems this not obvious to get right,
hence warn.
2017-12-06 13:40:50 +01:00
Lennart Poettering 87d5e4f286 build-sys: make the dynamic UID range, and the container UID range configurable
Also, export these ranges in our pkg-config files.
2017-12-06 12:55:37 +01:00
Zbigniew Jędrzejewski-Szmek e783f95718 Rename "system-preset" source dir to "presets"
I want to add presets/user/ later. This mirrors the layout for units:
we have units/ and units/user. The advantage is that we avoid having yet
another directory at the top level.
2017-12-06 10:18:35 +01:00
Yu Watanabe d6806870a2 meson: fix indentation 2017-12-05 14:01:39 +09:00
Ikey Doherty 84786b8e32 sysusers: Provide meson argument to set gid for 'users' group (#7533)
To allow better integration with distributions requiring an explicitly
set gid for the `users` group, provide the new `-Dusers-gid` option to
set to a new numeric value.

In the absence of a specified gid, we'll fallback to the default existing
behaviour of `-` as the gid value, to automatically assign the next available
gid on the system.
2017-12-03 13:28:23 +01:00
Zbigniew Jędrzejewski-Szmek d9daae55d5 tmpfiles: add a special return code for syntax failures
In this way, individual errors in files can be treated differently than a
failure of the whole service.

A test is added to check that the expected value is returned.
Some parts are commented out, because it is not. This will be fixed in
a subsequent commit.
2017-12-01 18:58:54 +01:00
Zbigniew Jędrzejewski-Szmek 7f2806d509 Add x-systemd.growfs option for fstab 2017-11-30 20:46:30 +01:00
Zbigniew Jędrzejewski-Szmek da495a0385 Add x-systemd.makefs option for fstab
I opted to completely generate a unit for both mount points and swaps. For
swaps, it would be possible to use fixed template unit like systemd-mkswap@.service,
because there's no information passed except the device name. For mount points,
that's not possible because both the device name and file system type need to
be passed. Nevertheless, I expect that options will need to passed to both mkfs
and mkswap, in which case it'll be necessary to create units of both types
anyway.
2017-11-30 20:46:30 +01:00
Zbigniew Jędrzejewski-Szmek b7f28ac51f Add mkfs wrapper which first checks if the partition is empty 2017-11-30 20:46:30 +01:00