summaryrefslogtreecommitdiff
path: root/src/shared
Commit message (Collapse)AuthorAge
* mempool: only enable mempool use when linked to libsystemd-shared.soZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | | | | | 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 (cherry picked from commit a5d8835c78112206bbf0812dd4cb471f803bfe88)
* shared/sleep-config: add switches to kill specific sleep modesZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | | | | | | /etc/systemd/sleep.conf gains four new switches: AllowSuspend=, AllowHibernation=, AllowSuspendThenHibernate=, AllowHybridSleep=. Disabling specific modes was already possible by masking suspend.target, hibernate.target, suspend-then-hibernate.target, or hybrid-sleep.target. But this is not convenient for distributions, which want to set some defaults based on what they want to support. Having those available as configuration makes it easy to put a config file in /usr/lib/systemd/sleep.conf.d/ that overrides the defaults and gives instructions how to undo that override. (cherry picked from commit e8f1d00d695f491654d50e57c82623288d3bcbeb)
* shared/sleep-config: forbid hibernation if resume= is not configuredZbigniew Jędrzejewski-Szmek2018-10-29
| | | | (cherry picked from commit 5fdf2d51c244288ac41443d1bd81365fab7b7b81)
* sleep-config: partitions can't be deleted, only files canLennart Poettering2018-10-29
| | | | | | | This fixes something I think was basically a typo introduced in db69869f264af2d1afcdd3e573e0e9fdd5bef065. (cherry picked from commit 3dea6886c20a32d832971e589cbc1807c549b66f)
* shared/sleep-config: exclude zram devices from hibernation candidatesAndrew Jorgensen2018-10-29
| | | | | | | | On a host with sufficiently large zram but with no actual swap, logind will respond to CanHibernate() with yes. With this patch, it will correctly respond no, unless there are other swap devices to consider. (cherry picked from commit 411ae92b407bd7b4549b205ad754bcd0e3dfd81f)
* meson: do not build module-util.c when libkmod is not foundYu Watanabe2018-10-29
| | | | | | | | Follow-up for 3cb9b42af3b205fba176ebf51ce0e07739698278 (#9516). Fixes oss-fuzz-9532. (cherry picked from commit ba323bbead1dda558a5bbe42846cdee5c8b0fc85)
* Move module-util.h to src/shared/ and load_module() to libsharedZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | | Unfortunately this needs libshared to link to libkmod. Before it was linked into systemd-udevd, udevadm, and systemd each seperately. On most systems this doesn't make much difference, because at least systemd would be installed, but it might not be in small chroots. It is a small library, so I hope this is not a big issue. (cherry picked from commit 3cb9b42af3b205fba176ebf51ce0e07739698278)
* bus-util: make log level lower in request_name_destroy_callback()Yu Watanabe2018-10-29
| | | | | | Fixes #9442. (cherry picked from commit 04e075b572b168a183cde29480dbb30d027d4fe7)
* bus-util: fix error handlingYu Watanabe2018-10-29
| | | | (cherry picked from commit 0ceff9068d4def8895929ba8c201a23502a7f941)
* Prep v239: Fix an issue with program_invocation[_short]_name :Sven Eden2018-10-16
| | | | | | | | | | | | | | The old implementation was done assuming that only glibc provides both program_invocation_name and program_invocation_short_name. This worked well for users using musl-libc with the library having been built without -D_GNU_SOURCE. However, alternative libc implementations that actually do provide these variables, could cause elogind to crash. To be on the safe side, we now actually check whether both these variables are present by letting meson check whether a code snippet accessing these compiles and links.
* Prep v239: A few cosmetic upgradesSven Eden2018-08-27
|
* Prep v239: Remove udev-util.c, we no longer need that.Sven Eden2018-08-24
|
* Prep v239: Mask definition of config_parse_mode, we do not need that.Sven Eden2018-08-24
|
* Prep v239: Add support for the new 'suspend-then-hibernate' method.Sven Eden2018-08-24
|
* Prep v239: Mirror upstream and move pager.[hc] from shared to basic.Sven Eden2018-08-24
|
* Prep v239: Fix sleep-config.[hc] and sleep/sleep.c to utilize upstream updates.Sven Eden2018-08-24
|
* Prep v239: Fix conf-parser.[hc], it got a bit mangled by migration.Sven Eden2018-08-24
|
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | 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'
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-08-24
| | | | | | 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.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-08-24
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-08-24
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* timedatectl: add 'show' command to display machine-readable outputYu Watanabe2018-08-24
| | | | Closes #9249.
* tree-wide: drop !! casts to booleansZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | They are not needed, because anything that is non-zero is converted to true. C11: > 6.3.1.2: When any scalar value is converted to _Bool, the result is 0 if the > value compares equal to 0; otherwise, the result is 1. https://stackoverflow.com/questions/31551888/casting-int-to-bool-in-c-c
* conf-parser: simplify conf_parse_path()Yu Watanabe2018-08-24
| | | | Follow-up for 97651797e83d0548aef9f808657d3518d89e5aee.
* tree-wide: unify how we define bit mak enumsLennart Poettering2018-08-24
| | | | | | Let's always write "1 << 0", "1 << 1" and so on, except where we need more than 31 flag bits, where we write "UINT64(1) << 0", and so on to force 64bit values.
* conf-parser: add config_parse_permille()Marc Kleine-Budde2018-08-24
|
* tree-wide: fix a number of log calls that use %m but have no errno setLennart Poettering2018-08-24
| | | | | | | | This is mostly fall-out from d1a1f0aaf0d2f08c60d1e0d32e646439d99f58dc, however some cases are older bugs. There might be more issues lurking, this was a simple grep for "%m" across the tree, with all lines removed that mention "errno" at all.
* udev: add helper udev_device_new_from_stat_rdev()Lennart Poettering2018-08-24
| | | | | | This is a simple wrapper around udev_device_new_from_devnum(), and uses the data from a struct stat's .st_rdev field to derive the udev_device object.
* shared/bus-util: use the new cleanup functionality to avoid a memleakZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the async callbacks didn't get a chance to finish properly, we'd leak memory. The output from test-bus-util with additional log line in the callbacks to show what is happening: $ build/test-bus-util /* test_name_async (0) */ Bus test-bus: changing state UNSET → OPENING Bus test-bus: changing state OPENING → AUTHENTICATING Bus test-bus: changing state AUTHENTICATING → HELLO Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=Hello cookie=1 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RequestName cookie=2 reply_cookie=0 signature=su error-name=n/a error-message=n/a Got message type=method_return sender=org.freedesktop.DBus destination=:1.732 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=1 signature=s error-name=n/a error-message=n/a Bus test-bus: changing state HELLO → RUNNING Bus test-bus: changing state RUNNING → CLOSED request_name_destroy_callback n_ref=1 /* test_name_async (20) */ Bus test-bus: changing state UNSET → OPENING Bus test-bus: changing state OPENING → AUTHENTICATING Bus test-bus: changing state AUTHENTICATING → HELLO stage 0: sd_bus_process returned 1 Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=Hello cookie=1 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RequestName cookie=2 reply_cookie=0 signature=su error-name=n/a error-message=n/a stage 1: sd_bus_process returned 1 Got message type=method_return sender=org.freedesktop.DBus destination=:1.733 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=1 signature=s error-name=n/a error-message=n/a Bus test-bus: changing state HELLO → RUNNING stage 2: sd_bus_process returned 1 Got message type=signal sender=org.freedesktop.DBus.Local destination=n/a path=/org/freedesktop/DBus/Local interface=org.freedesktop.DBus.Local member=Connected cookie=4294967295 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a stage 3: sd_bus_process returned 1 Got message type=signal sender=org.freedesktop.DBus destination=:1.733 path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=NameAcquired cookie=4294967295 reply_cookie=0 signature=s error-name=n/a error-message=n/a stage 4: sd_bus_process returned 1 Got message type=error sender=org.freedesktop.DBus destination=:1.733 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=2 signature=s error-name=org.freedesktop.DBus.Error.AccessDenied error-message=Request to own name refused by policy Unable to request name, will retry after reloading DBus configuration: Request to own name refused by policy Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=ReloadConfig cookie=3 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a request_name_destroy_callback n_ref=2 stage 5: sd_bus_process returned 1 Got message type=method_return sender=org.freedesktop.DBus destination=:1.733 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=3 signature= error-name=n/a error-message=n/a Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RequestName cookie=4 reply_cookie=0 signature=su error-name=n/a error-message=n/a request_name_destroy_callback n_ref=1 stage 6: sd_bus_process returned 1 Got message type=error sender=org.freedesktop.DBus destination=:1.733 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=4 signature=s error-name=org.freedesktop.DBus.Error.AccessDenied error-message=Request to own name refused by policy Unable to request name, failing connection: Request to own name refused by policy Bus test-bus: changing state RUNNING → CLOSING stage 7: sd_bus_process returned 1 Bus test-bus: changing state CLOSING → CLOSED stage 8: sd_bus_process returned 1 stage 9: sd_bus_process returned -104 Processing failed: Connection reset by peer
* bus-util: avoid unneeded initalization to zeroZbigniew Jędrzejewski-Szmek2018-08-24
|
* conf-parser: fix memleak (#9177)Yu Watanabe2018-08-24
| | | | | | Fixes CID#1391437. Closes #9180.
* conf-parser: remove redundant utf8-validity checkYu Watanabe2018-08-24
|
* conf-parse: use free_and_replace()Yu Watanabe2018-08-24
| | | | Also removes unnecessary empty lines.
* conf-parser: reject utf8-invalid linesYu Watanabe2018-08-24
|
* conf-parse: use path_simplify_and_warn() in config_parse_path()Yu Watanabe2018-08-24
|
* path-util: introduce path_simplify()Yu Watanabe2018-08-24
| | | | | | | | The function is similar to path_kill_slashes() but also removes initial './', trailing '/.', and '/./' in the path. When the second argument of path_simplify() is false, then it behaves as the same as path_kill_slashes(). Hence, this also replaces path_kill_slashes() with path_simplify().
* Use const char* for timestamp strings which we don't plan to modifyZbigniew Jędrzejewski-Szmek2018-08-24
| | | | Makes the intent a bit clearer.
* conf-parser: introduce DEFINE_CONFIG_PARSE*() macrosYu Watanabe2018-08-24
| | | | | | | | This introduces several macros for defining config parsers. Also this fixes errno in DEFINE_CONFIG_PARSE_ENUM() and _ENUMV() and makes the log level lower when a duplicated item is specified to the settings parsed by the function defined by DEFINE_CONFIG_PARSE_ENUMV().
* tree-wide: fix typo in comments and NEWSYu Watanabe2018-08-24
|
* conf-parser: add a bit more whitespaceLennart Poettering2018-08-24
| | | | | | | | We usually seperate case statements within a switch from each other by empty lines. We also often add an empty line after multi-line function prototypes, let's do so here too Also, no trailing ; after }...
* journalctl: add with-unit modeLuca Boccassi2018-08-24
| | | | | | | | | | When dealing with a large number of template instances, for example when launching daemons per VRF, it is hard for operators to correlate log lines to arguments. Add a new with-unit mode which, if available, prefixes unit and user unit names when displaying its log messages instead of the syslog identifier. It will also use the full timestamp with timezones, like the short-full mode.
* machined: move bus_reply_pair_array() into generic utilitiesLennart Poettering2018-08-24
| | | | This way, we can reuse it in portabled.
* fileio: accept FILE* in addition to path in parse_env_file()Lennart Poettering2018-08-24
| | | | | | | Most our other parsing functions do this, let's do this here too, internally we accept that anyway. Also, the closely related load_env_file() and load_env_file_pairs() also do this, so let's be systematic.
* load-fragment: allow to specify RestrictNamespaces= multiple timesYu Watanabe2018-08-24
| | | | | If multiple RestrictNamespaces= settings are set, then merge the settings. This also drops supporting "~yes" and "~no".
* nsflsgs: drop namespace_flag_{from,to}_string()Yu Watanabe2018-08-24
| | | | | | This also drops namespace_flag_to_string_many_with_check(), and renames namespace_flag_{from,to}_string_many() to namespace_flags_{from,to}_string().
* nsflags: drop namespace_flag_to_string_many_with_check()Yu Watanabe2018-08-24
| | | | | We always ignore the unused bits. So, it is not necessary to check them.
* timesync,shared: move logic requesting bus name to sharedYu Watanabe2018-08-24
| | | | | Preparation for setting DynamicUser= to other services which request bus names.
* conf-parser: make use of free_and_replace() at one more placeLennart Poettering2018-08-24
|
* config-parser: introduce new CONFIG_PARSER_PROTOTYPE() macroLennart Poettering2018-08-24
| | | | | | | | | | | | | | This builds on the previous GENERIC_PARSER_ARGS macro work. I think in general it is a better idea to declare macros that generate full C statements instead of just parts of them, hence, let's introduce CONFIG_PARSER_PROTOTYPE() which defines a full C function prototype, instead of the pre-existing way of defining the C function prototype manually, but then using GENERIC_PARSER_ARGS to define its arguments. This doesn't drop GENERIC_PARSER_ARGS though, but renames it to CONFIG_PARSER_ARGUMENTS, and changes the ConfigParserCallback function type to use it. The new name follows more closely how the other symbols in the header are named.
* bus-util: add more macros for defining functions of getting dbus propertiesYu Watanabe2018-08-24
|