Lennart Poettering
63e688cc3b
Merge pull request #11031 from poettering/gcc-attr-cleanup
...
various gcc attribute clean-ups
2018-12-03 21:59:00 +01:00
Lennart Poettering
76b31bbb24
Merge pull request #10920 from yuwata/hashmap-destructor
...
hashmap: make hashmap_free() call destructors of key or value
2018-12-03 17:59:44 +01:00
Lennart Poettering
90b365cee0
json: use new _align_() macro
2018-12-03 13:28:26 +01:00
Lennart Poettering
ad2bf5df89
Merge pull request #10992 from yuwata/follow-up-10948
...
network: make fib rule accept arbitrary ip protocol
2018-12-03 11:09:04 +01:00
Lennart Poettering
686d13b9f2
util-lib: split out env file parsing code into env-file.c
...
It's quite complex, let's split this out.
No code changes, just some file rearranging.
2018-12-02 13:22:29 +01:00
Lennart Poettering
0a2152f005
util-lib: move open_serialization_fd() to serialize.c
...
It definitely fits better there.
No code changes, just some rearranging.
2018-12-02 13:22:29 +01:00
Lennart Poettering
e4de72876e
util-lib: split out all temporary file related calls into tmpfiles-util.c
...
This splits out a bunch of functions from fileio.c that have to do with
temporary files. Simply to make the header files a bit shorter, and to
group things more nicely.
No code changes, just some rearranging of source files.
2018-12-02 13:22:29 +01:00
Lennart Poettering
ee228be10c
util-lib: don't include fileio.h from fileio-label.h
...
There's no reason for doing that, hence simply don't.
2018-12-02 13:22:29 +01:00
Yu Watanabe
b07ec5a173
machine-image: introduce image_hash_ops and use it
2018-12-02 12:18:54 +01:00
Yu Watanabe
7a08d314f2
tree-wide: make hash_ops typesafe
2018-12-02 07:53:27 +01:00
Yu Watanabe
d2b42d63c4
core,run: make SocketProtocol= accept protocol name in upper case an protocol number
2018-12-02 06:13:47 +01:00
Yu Watanabe
dca2309108
test: add tests for ip_protocol_{from,to}_name()
2018-12-02 06:13:47 +01:00
Yu Watanabe
0667a0c497
util: introduce parse_ip_protocol()
...
Not only protocol name in lower case, but it optionally accepts
IP protocol name in upper case and IP protocol number.
2018-12-02 06:13:41 +01:00
Yu Watanabe
cedfe0b02b
util: cast smaller type to large type
2018-12-02 05:58:18 +01:00
Yu Watanabe
da96ad5ae2
util: rename socket_protocol_{from,to}_name() to ip_protocol_{from,to}_name()
2018-12-02 05:48:27 +01:00
Lennart Poettering
5dd9527883
tree-wide: remove various unused functions
...
All found with "cppcheck --enable=unusedFunction".
2018-12-02 13:35:34 +09:00
Lennart Poettering
55844aebb6
pager: close all fds when forking off pager
2018-12-01 12:50:45 +01:00
Lennart Poettering
1d78890851
pager: log about all error conditions
...
The code so far logged about some errors but was silent on others. Let's
stream-line that and make the function fully self-logging on all error
conditions.
2018-12-01 12:50:45 +01:00
Lennart Poettering
0672e2c6f8
tree-wide: use FORK_RLIMIT_NOFILE_SAFE wherever possible
...
Similar to the previous commit: in many cases no further fd processing
needs to be done in forked of children before execve() or any of its
flavours are called. In those case we can use FORK_RLIMIT_NOFILE_SAFE
instead.
2018-12-01 12:50:45 +01:00
Lennart Poettering
595225af7a
tree-wide: invoke rlimit_nofile_safe() before various exec{v,ve,l}() invocations
...
Whenever we invoke external, foreign code from code that has
RLIMIT_NOFILE's soft limit bumped to high values, revert it to 1024
first. This is a safety precaution for compatibility with programs using
select() which cannot operate with fds > 1024.
This commit adds the call to rlimit_nofile_safe() to all invocations of
exec{v,ve,l}() and friends that either are in code that we know runs
with RLIMIT_NOFILE bumped up (which is PID 1 and all journal code for
starters) or that is part of shared code that might end up there.
The calls are placed as early as we can in processes invoking a flavour
of execve(), but after the last time we do fd manipulations, so that we
can still take benefit of the high fd limits for that.
2018-12-01 12:50:45 +01:00
Lennart Poettering
3c069cdac4
move src/shared/rlimit-util.[ch] → src/basic/
...
This is really basic stuff and in a follow-up commit will use it all
across the codebase, including in process-util.[ch] which is in
src/basic/. Hence let's move it back to src/basic/ itself.
2018-12-01 12:50:45 +01:00
Lennart Poettering
1300f91149
rlimit: add new rlimit_nofile_safe() helper
...
This helper sets RLIMIT_NOFILE's soft limit to 1024 (FD_SETSIZE) for
compatibility with apps using select().
The idea is that we use this helper to reset the limit whenever we
invoke foreign code from our own processes which have bumped
RLIMIT_NOFILE high.
2018-12-01 12:50:45 +01:00
Lennart Poettering
ac20048fc0
Merge pull request #11002 from keszybz/path_join-merging
...
Path join merging
2018-12-01 00:44:58 +01:00
Zbigniew Jędrzejewski-Szmek
652ef29887
path-util: allow NULLs in arguments to path_join()
...
This removes the need to remember to put strempty() in places, thus reducing
the likelihood of a stupid mistake.
2018-11-30 22:21:17 +01:00
Lennart Poettering
88db94fa57
format-table: make sure we never call memcmp() with NULL parameters
2018-11-30 16:46:10 +01:00
Lennart Poettering
62d99b3970
format-table: add calls to query the data in a specific cell
2018-11-30 16:46:10 +01:00
Lennart Poettering
30d98de00c
format-table: always underline header line
2018-11-30 16:46:10 +01:00
Lennart Poettering
9314ead785
format-table: add an API for getting the cell at a specific row/column
2018-11-30 16:46:10 +01:00
Lennart Poettering
27e730e6d0
format-table: add table_update() to update existing entries
2018-11-30 16:46:10 +01:00
Lennart Poettering
a2c73e2d38
format-table: optionally allow reversing the sort order for a column
2018-11-30 16:46:10 +01:00
Lennart Poettering
a4661181fa
format-table: add option to store/format percent and uint64_t values in cells
2018-11-30 16:46:10 +01:00
Lennart Poettering
a22318e554
format-table: before outputting a color, check if colors are available
...
This is in many cases redundant, as a similar check is done by various
callers already, but in other cases (where we read the color from a
static table for example), it's nice to let the color check be done by
the table code itself, and since it doesn't hurt in the other cases just
do it again.
2018-11-30 16:46:10 +01:00
Lennart Poettering
165ca5663e
format-table: optionally make specific cells clickable links
2018-11-30 16:46:10 +01:00
Lennart Poettering
13b0d4d7bd
format-table: when duplicating a cell, also copy the color
2018-11-30 16:46:10 +01:00
Lennart Poettering
62d6a1cc9f
terminal-util: split out file:// generation from terminal_urlify_path()
...
This way we can use it at other places, for example when preparing URLs
for format_table_set_url()
2018-11-30 16:46:10 +01:00
Lennart Poettering
ad5ffe3716
seccomp-util: drop process_vm_readv from @debug group
...
it's already part of @ipc, no need to have it in both. Given that @ipc
is much more popular (as it is part of @system-service for example),
let's not define it a second time.
2018-11-30 16:46:09 +01:00
Zbigniew Jędrzejewski-Szmek
62a85ee0a9
tree-wide: rename path_join_many() to path_join()
...
$ git grep -e path_join_many -l|xargs sed -r -i 's/path_join_many/path_join/g'
The two test functions are merged into one.
2018-11-30 10:59:47 +01:00
Zbigniew Jędrzejewski-Szmek
30016f21b3
tree-wide: replace path_join with path_join_many
2018-11-30 10:40:38 +01:00
Zbigniew Jędrzejewski-Szmek
b2ac2b01c8
Merge pull request #10996 from poettering/oci-prep
...
Preparation for the nspawn-OCI work
2018-11-30 10:09:00 +01:00
Zbigniew Jędrzejewski-Szmek
77c772f227
Move mount-util.c to shared/
...
libmount dep is moved from libbasic to libshared, potentially removing
libmount from some build products.
2018-11-29 21:03:44 +01:00
Zbigniew Jędrzejewski-Szmek
049af8ad0c
Split out part of mount-util.c into mountpoint-util.c
...
The idea is that anything which is related to actually manipulating mounts is
in mount-util.c, but functions for mountpoint introspection are moved to the
new file. Anything which requires libmount must be in mount-util.c.
This was supposed to be a preparation for further changes, with no functional
difference, but it results in a significant change in linkage:
$ ldd build/libnss_*.so.2
(before)
build/libnss_myhostname.so.2:
linux-vdso.so.1 (0x00007fff77bf5000)
librt.so.1 => /lib64/librt.so.1 (0x00007f4bbb7b2000)
libmount.so.1 => /lib64/libmount.so.1 (0x00007f4bbb755000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4bbb734000)
libc.so.6 => /lib64/libc.so.6 (0x00007f4bbb56e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4bbb8c1000)
libblkid.so.1 => /lib64/libblkid.so.1 (0x00007f4bbb51b000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f4bbb512000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f4bbb4e3000)
libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f4bbb45e000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f4bbb458000)
build/libnss_mymachines.so.2:
linux-vdso.so.1 (0x00007ffc19cc0000)
librt.so.1 => /lib64/librt.so.1 (0x00007fdecb74b000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007fdecb744000)
libmount.so.1 => /lib64/libmount.so.1 (0x00007fdecb6e7000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdecb6c6000)
libc.so.6 => /lib64/libc.so.6 (0x00007fdecb500000)
/lib64/ld-linux-x86-64.so.2 (0x00007fdecb8a9000)
libblkid.so.1 => /lib64/libblkid.so.1 (0x00007fdecb4ad000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fdecb4a2000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fdecb475000)
libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007fdecb3f0000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fdecb3ea000)
build/libnss_resolve.so.2:
linux-vdso.so.1 (0x00007ffe8ef8e000)
librt.so.1 => /lib64/librt.so.1 (0x00007fcf314bd000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007fcf314b6000)
libmount.so.1 => /lib64/libmount.so.1 (0x00007fcf31459000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fcf31438000)
libc.so.6 => /lib64/libc.so.6 (0x00007fcf31272000)
/lib64/ld-linux-x86-64.so.2 (0x00007fcf31615000)
libblkid.so.1 => /lib64/libblkid.so.1 (0x00007fcf3121f000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fcf31214000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fcf311e7000)
libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007fcf31162000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fcf3115c000)
build/libnss_systemd.so.2:
linux-vdso.so.1 (0x00007ffda6d17000)
librt.so.1 => /lib64/librt.so.1 (0x00007f610b83c000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007f610b835000)
libmount.so.1 => /lib64/libmount.so.1 (0x00007f610b7d8000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f610b7b7000)
libc.so.6 => /lib64/libc.so.6 (0x00007f610b5f1000)
/lib64/ld-linux-x86-64.so.2 (0x00007f610b995000)
libblkid.so.1 => /lib64/libblkid.so.1 (0x00007f610b59e000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f610b593000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f610b566000)
libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f610b4e1000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f610b4db000)
(after)
build/libnss_myhostname.so.2:
linux-vdso.so.1 (0x00007fff0b5e2000)
librt.so.1 => /lib64/librt.so.1 (0x00007fde0c328000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fde0c307000)
libc.so.6 => /lib64/libc.so.6 (0x00007fde0c141000)
/lib64/ld-linux-x86-64.so.2 (0x00007fde0c435000)
build/libnss_mymachines.so.2:
linux-vdso.so.1 (0x00007ffdc30a7000)
librt.so.1 => /lib64/librt.so.1 (0x00007f06ecabb000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007f06ecab4000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f06eca93000)
libc.so.6 => /lib64/libc.so.6 (0x00007f06ec8cd000)
/lib64/ld-linux-x86-64.so.2 (0x00007f06ecc15000)
build/libnss_resolve.so.2:
linux-vdso.so.1 (0x00007ffe95747000)
librt.so.1 => /lib64/librt.so.1 (0x00007fa56a80f000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007fa56a808000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa56a7e7000)
libc.so.6 => /lib64/libc.so.6 (0x00007fa56a621000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa56a964000)
build/libnss_systemd.so.2:
linux-vdso.so.1 (0x00007ffe67b51000)
librt.so.1 => /lib64/librt.so.1 (0x00007ffb32113000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007ffb3210c000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ffb320eb000)
libc.so.6 => /lib64/libc.so.6 (0x00007ffb31f25000)
/lib64/ld-linux-x86-64.so.2 (0x00007ffb3226a000)
I don't quite understand what is going on here, but let's not be too picky.
2018-11-29 21:03:44 +01:00
Lennart Poettering
30874dda3a
dev-setup: generalize logic we use to create "inaccessible" device nodes
...
Let's generalize this, so that we can use this in nspawn later on, which
is pretty useful as we need to be able to mask files from the inner
child of nspawn too, where the host's /run/systemd/inaccessible
directory is not visible anymore. Moreover, if nspawn can create these
nodes on its own before the payload this means the payload can run with
fewer privileges.
2018-11-29 20:21:40 +01:00
Lennart Poettering
d435a18244
ptyfwd: optionally override terminal width/height
2018-11-29 20:21:39 +01:00
Lennart Poettering
54b22b2643
tree-wide: port various parts of the code over to the new device_major_minor_path() calls
2018-11-29 20:21:39 +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
acf4d15893
util: make *_from_name() returns negative errno on error
2018-11-28 20:20:50 +09:00
Yu Watanabe
7b5e750d2a
util: also move scripts related to socket-protocol-list.[ch] to shared/
...
The source files were moved to shared/. Let's also move the relevant scripts.
2018-11-28 20:20:29 +09:00
Lennart Poettering
1f70196644
Merge pull request #10961 from poettering/busctl-monitor-json
...
busctl: support json mode also for 'busctl monitor'
2018-11-28 10:30:53 +01:00