summaryrefslogtreecommitdiff
path: root/src/systemctl/systemctl-is-enabled.c
Commit message (Collapse)AuthorAgeFilesLines
* systemctl: fix a memory leakDavid Tardon2023-04-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | valgrind systemctl is-enabled --root=/ -l default.target >/dev/null ==746041== Memcheck, a memory error detector ==746041== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==746041== Using Valgrind-3.20.0 and LibVEX; rerun with -h for copyright info ==746041== Command: systemctl is-enabled --root=/ -l default.target ==746041== ==746041== ==746041== HEAP SUMMARY: ==746041== in use at exit: 8,251 bytes in 4 blocks ==746041== total heap usage: 3,440 allocs, 3,436 frees, 1,163,346 bytes allocated ==746041== ==746041== LEAK SUMMARY: ==746041== definitely lost: 24 bytes in 1 blocks ==746041== indirectly lost: 35 bytes in 1 blocks ==746041== possibly lost: 0 bytes in 0 blocks ==746041== still reachable: 8,192 bytes in 2 blocks ==746041== suppressed: 0 bytes in 0 blocks ==746041== Rerun with --leak-check=full to see details of leaked memory ==746041== ==746041== For lists of detected and suppressed errors, rerun with: -s ==746041== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
* basic: add RuntimeScope enumLennart Poettering2023-03-101-2/+2
| | | | | | | | | | | | In various tools and services we have a per-system and per-user concept. So far we sometimes used a boolean indicating whether we are in system mode, or a reversed boolean indicating whether we are in user mode, or the LookupScope enum used by the lookup path logic. Let's address that, in introduce a common enum for this, we can use all across the board. This is mostly just search/replace, no actual code changes.
* systemctl: is-*: return correct code when no unit is foundMike Yuan2022-12-141-6/+24
| | | | | | | | According to systemctl(1), we should use LSB return code 4 (EXIT_PROGRAM_OR_SERVICES_STATUS_UNKNOWN) when the state is "no such unit" for is-{active,failed,enabled} verbs. Fixes #25680
* install: make InstallChange enum type a proper typeLennart Poettering2022-10-141-1/+1
| | | | | | | We can just make this an enum, as long as we ensure it has enough range, which we can do by adding -ERRNO_MAX as one possible value (at least on GNU C). We already do that at multiple other places, so let's do this here too.
* shared/install: rename 'unit_file_change_type' to 'install_change' + followupsZbigniew Jędrzejewski-Szmek2022-10-131-1/+1
| | | | | | We had an anonymous enum with values called UNIT_FILE_…, which could easily be confused with UNIT_FILE_… from UnitFileFlags enum. This commit renames the enum values and also the variables which refer to them.
* shared/install: rename UnitFileChange to InstallChangeZbigniew Jędrzejewski-Szmek2022-10-131-1/+1
| | | | | It's shorter and more generic. The struct can contain info about changes to unit files, but also symlinks and errors.
* Rename UnitFileScope to LookupScopeZbigniew Jędrzejewski-Szmek2022-03-291-1/+1
| | | | | | | | | As suggested in https://github.com/systemd/systemd/pull/22649/commits/8b3ad3983f5440eef812b34e5ed862ca59fdf7f7#r837345892 The define is generalized and moved to path-lookup.h, where it seems to fit better. This allows a recursive include to be removed and in general makes things simpler.
* strv: make iterator in STRV_FOREACH() declaread in the loopYu Watanabe2022-03-191-1/+0
| | | | This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
* systemctl: systematically rename verb entrypoints verb_xyz()Lennart Poettering2022-02-221-1/+1
| | | | | | | | | Let's clean up our function naming a bit, and always name the verb_xyz(), where the xyz maps to the command line verb as closely as possible. No actual code changes, just an attempt to make the systemctl sources a bit more systematic, and less surprising.
* install: make UnitFileChangeType enum anonymousLennart Poettering2021-02-171-1/+1
| | | | | | | | | | We almost never use the named enum type, in almost all cases we use "int" instead, since we overload it with negative errnos. To simplify things, let's use "int" really everywhere. Moreover, let's rename the fields for this enum to "type_or_errno", to make the overloading clear. And let's ad some assertions that things are in the right range.
* systemctl: reduce scope of iterator variablesZbigniew Jędrzejewski-Szmek2021-02-151-2/+2
|
* systemctl: have is-enabled return success for aliases when calling into pid1 tooLuca Boccassi2021-01-061-1/+1
| | | | | | | | | commit 15d7ab87c4e5917f5788f1f8dce327a1e272bea3 introduced the change to add an 'alias' state, but it was wired to systemctl only when running in 'client-side' mode. Return success as expected and documented also when running in 'server-mode'. Fixes https://github.com/systemd/systemd/issues/18134
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* systemctl: split up humungous systemctl.c fileLennart Poettering2020-10-071-0/+138
This is just some refactoring: shifting around of code, not change in codeflow. This splits up the way too huge systemctl.c in multiple more easily digestable files. It roughly follows the rule that each family of verbs gets its own .c/.h file pair, and so do all the compat executable names we support. Plus three extra files for sysv compat (which existed before already, but I renamed slightly, to get the systemctl- prefix lik everything else), a -util file with generic stuff everything uses, and a -logind file with everything that talks directly to logind instead of PID1. systemctl is still a bit too complex for my taste, but I think this way itc omes in a more digestable bits at least. No change of behaviour, just reshuffling of some code.