Commit Graph

99 Commits

Author SHA1 Message Date
Norbert Lange ef5924aa31 coredump: add zstandard support for coredumps
this will hook libzstd into coredump,
using this format as default.
2020-05-04 10:59:43 +02:00
Lennart Poettering 965cc99416 shared: add common helper for unregistering all binfmt entries 2020-04-23 17:13:50 +02:00
Lennart Poettering 052740e2e3 log-control-api: add generic D-Bus interface for querying/setting log level/target
Let's define a new, generic bus interface that any daemon can implement
for querying/setting the log level.

We can turn this into something more powerful later on, but for now,
only expose three properties: the log level, log target and the syslog
identifier (with the former two being writable).

This is supposed to be generic, so that it can be implemented by 3rd
party daemons too, eventually.
2020-04-21 17:07:43 +02:00
Zbigniew Jędrzejewski-Szmek b34612bd5a Add parser and printer for coredump filter mask 2020-04-09 12:51:41 +02:00
Zbigniew Jędrzejewski-Szmek 09e6443ef4 Move path-lookup.c to src/basic
I want to use it from sd-path later on so it needs to be moved out of
src/shared (libsystemd is not allowed to use code from src/shared).
2020-03-27 20:12:44 +01:00
Zbigniew Jędrzejewski-Szmek 1ab2033804
Merge pull request #15224 from ssahani/geneve
networkctl: Display more geneve properties
2020-03-26 18:30:37 +01:00
Susant Sahani 3039cc0281 network: Introduce geneve util 2020-03-25 14:52:31 +01:00
Susant Sahani af94bb24b5 shared: Introduce bridge util 2020-03-24 14:22:50 +01:00
Michal Sekletár 1808f76870 shared: split out NUMA code from cpu-set-util.c to numa-util.c 2020-03-16 08:23:18 +01:00
Lennart Poettering b940fb1f4f
Merge pull request #14594 from keszybz/id128-show-gpt
Print gpt table values in systemd-id128
2020-01-28 17:23:50 +01:00
Zbigniew Jędrzejewski-Szmek 19ce38ce62 shared/gpt: export gpt_partition_type_uuid_{to,from}_string functions 2020-01-23 22:56:23 +01:00
Lennart Poettering 269e4d2d6b shared: split out polkit stuff from bus-util.c → bus-polkit.c
It's enough, complex stuff to warrant its own source file.

No other changes, just splitting out.
2020-01-22 12:34:10 +01:00
Lennart Poettering cef9f2a647 shared: add pam utility helpers 2020-01-15 15:29:31 +01:00
Lennart Poettering 295c1a6e45 shared: add helpers for displaying new-style user/group records to users 2020-01-15 15:27:59 +01:00
Lennart Poettering ec8e4a0ef1 shared: add internal API for querying JSON user records via varlink
This new API can be used in place of NSS by our own internal code if
more than the classic UNIX records are needed.
2020-01-15 15:27:41 +01:00
Lennart Poettering 9b2d907877 shared: add helpers for converting NSS passwd/group structures to new JSON objects
These new calls may be used to convert classic UNIX/glibc NSS struct
passwd and struct group records into new-style JSON-based user/group
objects.
2020-01-15 15:27:23 +01:00
Lennart Poettering 71d0b9d422 shared: add generic user/group record structures and JSON parsers 2020-01-15 15:27:04 +01:00
Lennart Poettering 42f3b2f975 shared: split out crypt() specific helpers into its own .c/.h in src/shared/
This way we can use libxcrypt specific functionality such as
crypt_gensalt() and thus take benefit of the newer algorithms libxcrypt
implements. (Also adds support for a new env var $SYSTEMD_CRYPT_PREFIX
which may be used to select the hash algorithm to use for libxcrypt.)

Also, let's move the weird crypt.h inclusion into libcrypt.h so that
there's a single place for it.
2020-01-15 15:26:27 +01:00
Zbigniew Jędrzejewski-Szmek 5c3fa98db6 util-lib: move things that parse ifnames to shared/
In subsequent commits, calls to if_nametoindex() will be replaced by a wrapper
that falls back to alternative name resolution over netlink. netlink support
requires libsystemd (for sd-netlink), and we don't want to add any functions
that require netlink in basic/. So stuff that calls if_nametoindex() for user
supplied interface names, and everything that depends on that, needs to be
moved.
2020-01-11 12:07:28 +01:00
Lennart Poettering b355d0c9af udev: move naming-scheme.[ch] into src/shared/
That way we can use it from non-udev code too, for example nspawn.
2020-01-02 19:34:00 +01:00
Lennart Poettering 417a6eece8 chown-recursive: move src/core/chown-recursive.[ch] → src/shared/
We want to use it outside of the core, hence let's moved it to the
shared code directory.
2019-12-17 20:03:40 +01:00
Lennart Poettering 839fddbe50 shared: add pkcs11-util.[ch] 2019-12-09 19:25:25 +01:00
Lennart Poettering 3f63701983 shared: add openssl helpers 2019-12-09 18:38:59 +01:00
Lennart Poettering 28937bcc6c shared: add new wrapper for online fs resizing ioctls 2019-12-04 11:02:14 +01:00
Lennart Poettering 462255c65b meson: order list of dependencies of libshared alphabetically
Let's make merging patches against this more stable.
2019-11-12 15:30:18 +01:00
Zbigniew Jędrzejewski-Szmek b492aea093 network: split out functions to get ssid and bssid 2019-10-24 00:02:41 +02:00
Zbigniew Jędrzejewski-Szmek 0bb2f0f10e util-lib: split shared/efivars into basic/efivars and shared/efi-loader
I want to use efivars.[ch] in proc-cmdline.c, but most of the efivars stuff is
not needed in basic/. Move the file from shared/ to basic/, but then move back
most of the higher-level functions to the new shared/efi-loader.c file.
2019-09-16 18:08:53 +02:00
Zbigniew Jędrzejewski-Szmek fdb3decaa7 util-lib: move some functions from basic/cgroup-util to shared/cgroup-setup
This way less stuff needs to be in basic. Initially, I wanted to move all the
parts of cgroup-utils.[ch] that depend on efivars.[ch] to shared, because
efivars.[ch] is in shared/. Later on, I decide to split efivars.[ch], so the
move done in this patch is not necessary anymore. Nevertheless, it is still
valid on its own. If at some point we want to expose libbasic, it is better to
to not have stuff that belong in libshared there.
2019-09-16 18:08:00 +02:00
Lennart Poettering dfadc1f203 meson: reorder alphabetically 2019-07-24 09:07:33 +02:00
Lennart Poettering 733cbd00b0 netlink: move local-addresses.[ch] to src/shared
This code is not part of the public API of sd-netlink, nor used by it
internally and hence should not be in the sd-netlink directory.

Also, move the test case for it to src/test/.
2019-07-24 09:06:50 +02:00
Zbigniew Jędrzejewski-Szmek 5cfa33e0bc Create src/shared/unit-file.[ch] for unit-file related ops
So far we put such functinos in install.[ch], but that is tied too closely
to enable/disable. Let's start moving things to a place with a better name.
2019-07-19 16:51:14 +02:00
Lennart Poettering 3572d3df8f shared: add generic logic for waiting for a unit to enter some state
This is a generic implementation of a client-side logic of waiting until
a unit enters or leaves some state.

This is a more generic implementation of the WaitContext logic currently
in systemctl.c, and is supposed to replace it (a later commit does
this). It's similar to bus-wait-for-jobs.c and we probably should fold
that one into it later on.

This code is more powerful and cleaner than the WaitContext logic
however. In addition to waiting for a unit to exit this also allows us
to wait for a unit to leave the "maintainance" state.

This commit only implements the generic logic, and adds no users of it
yet.
2019-07-11 12:18:51 +02:00
Lennart Poettering b67f05dabf fsck: split out fsck return code definitions into a header file of its own
This way we can make use of it from other components too, such as
systemd-homed.
2019-07-05 02:31:12 +09:00
Lennart Poettering a709a3154d dissect: split out DM deferred remove into src/shared/dm-util.c
The function is generally useful, let's split it out so that we can make
use of it later on in systemd-homed.
2019-07-05 02:19:24 +09:00
Yu Watanabe 5c2316c605 ethtool-util: move from src/udev/net/ to src/shared/ 2019-06-19 09:03:50 +09:00
Lennart Poettering d41bd96f54 shared: add minimal varlink implementation
This adds a minimal Varlink (https://varlink.org/) implementation to our
tree. Given that we already have a JSON logic it's an easy thing to add.

Why bother?

We currently have major problems with IPC before dbus-daemon is up, and
in all components that dbus-daemon itself makes use of (such as various
NSS modules to resolve users as well as the journal which dbus-daemon
logs to). Because of that we so far ended up creating various (usually
crappy) work-arounds either coming up with secondary IPC systems or
sharing data statelessly in /run or similar. Let's clean this up, and
instead use a clean, well-defined, broker-less IPC for cases like that.

This is a minimal implementation of Varlink, i.e. the most basic logic
only. Stuff that's missing is left out on purpose: there's no
introspection/validation and there's no name service. It might make
sense to add that later, but for now let's only do the minimum buy-in we
can get away with. In particular as I'd assume that at least initially
we only use this IPC for our internal communication avoiding
introspection and the name service should be fine.

Specifically, I'd expect that we add IPC interfaces to the following
concepts with this scheme:

1. nss-resolve (so that hostname lookups with resolved work before
   resolved is up)
2. journald (so that IPC calls to journald don't have to go through
   dbus-daemon thus creating a cyclic dependency between journald and
   dbus-daemon)
3. nss-systemd (so that dynamic user lookups via PID 1 work sanely even
   inside of dbus-daemon, because otherwise we'd want to use dbus to run
   dbus which causes deadlocks)
4. networkd (to make sure one can talk to it in the initrd already,
   long before dbus is around)

And there might be other cases similar to this.
2019-05-09 14:14:20 -04:00
Yu Watanabe 76566792e3 linux: move netdevice.h from shared/linux to basic/linux
As the header linux/if_arp.h includes linux/netdevice.h.
2019-04-13 22:43:59 +09:00
Yu Watanabe 01234e1fe7 tree-wide: drop several missing_*.h and import relevant headers from kernel-5.0 2019-04-11 19:00:37 +02:00
Zbigniew Jędrzejewski-Szmek 74b45889e4
Merge pull request #12252 from keszybz/libmount-dont-unescape
Don't unescape paths from libmount
2019-04-09 11:56:52 +02:00
Lennart Poettering 9f717d42cb meson: sort source files again 2019-04-05 16:58:30 +02:00
Zbigniew Jędrzejewski-Szmek fb36b1339b shared: add a single definition of libmount cleanup functions
Use a trivial header file to share mnt_free_tablep and mnt_free_iterp.
It would be nicer put this in mount-util.h, but libmount.h is not in the
default include path, and the build system would have to be adjusted to pass
pkg-config include path in various places, and it's just not worth the trouble.
A separate header file works nicely.
2019-04-05 10:18:21 +02:00
Lennart Poettering 25b1d72dcc bus-unit-util: split out code that shows a unit's process tree
The code is complex enough to deserve its own .c file. Let's split this
out.
2019-03-13 17:41:41 +01:00
Lennart Poettering e45c81b8bc shared: split out code to wait for jobs to complet into its own source file
It's complex enough and quite a few functions. Let's hence split this
out.

No code change, just some rearranging of source files.
2019-03-13 17:39:24 +01:00
Yu Watanabe e67ae9f5e6 network: move log_link_debug() or friends to log-link.h 2019-03-13 14:29:03 +09:00
Lennart Poettering 5e146a75b3 bootspec: also look for boot loader spec type 2 entries (i.e. unified kernel images)
sd-boot reads them, and hence we should from our userspace side too
2019-03-01 12:41:32 +01:00
Lennart Poettering f079c3727c shared: add helper for flushing nscd caches
Apparently, people do use nscd, hence play somewhat nice with it, and
let's explicitly flush nscd caches whenever we register a new
user/group.

This patch only adds the actual refresh request invocation. Later
commits then issue this call at appropriate moments.

Note that the nscd protocol is not officially documented though very
simple. This code is written very defensively so that incompatibilities
don't affect us much.

Given that glibc really has a duty to maintain compat between
differently compiled programs and their system nscd they can't break API
and thus it should be safe for us to implement an alternative,
minimalistic client.

Ideally this kind of explicit, global cache flushing would not be necessary.
However nscd currently has no cache coherency protocol, hence we can't
really implement this better. The only concept it knows is a TTL for
positive hosts lookups. Hoewver for negative lookups or any of the other
tables nothing is available.
2018-12-15 12:10:19 +01:00
Yu Watanabe c157884f09 sd-daemon: add notify_start() and notify_on_cleanup() helper function 2018-12-08 18:09:25 +09:00
Zbigniew Jędrzejewski-Szmek 871fa294ff Merge pull request #10935 from poettering/rlimit-nofile-safe
Merged by hand to resolve a trivial conflict in TODO.
2018-12-06 17:19:21 +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