summaryrefslogtreecommitdiff
path: root/src/basic/unit-name.c
Commit message (Collapse)AuthorAgeFilesLines
* string-util: add delete_trailing_chars() and skip_leading_chars() helpersLennart Poettering2017-11-131-7/+2
| | | | And let's port over a couple of users to the new APIs.
* basic: split unit-name.[ch] into two (#7065)Lennart Poettering2017-10-111-268/+0
| | | | | | | | | | | | | | | | It always bothered me a bit that unit-name.[ch] contains so many definitions that aren't really have much to do with unit nameing, for example all the unit state definitions. With this patch unit-name.[ch] is split into two: the file now contains only the unit naming related operations, and everything else is split out into a new set of files unit-def.[ch]. That's mostly unit state stuff as well as dbus path and interface name operations. No functional changes. This just moves code around. (Note as both .c files include each other's headers this doesn't make the build simpler or anything. All it does is make the C files a bit shorter, and medicate my pretend OCD)
* tree-wide: use IN_SET macro (#6977)Yu Watanabe2017-10-041-1/+1
|
* swap: adjust swap.c in a similar way to what we just did to mount.cLennart Poettering2017-09-261-2/+0
| | | | | | Also drop the redundant states and make all similar changes too. Thankfully the swap.c state engine is much simpler than mount.c's, hence this should be easier to digest.
* mount: rework mount state engineLennart Poettering2017-09-261-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the mount unit state engine in the following ways: 1. The MOUNT_MOUNTING_SIGTERM and MOUNT_MOUNTING_SIGKILL are removed. They have been pretty much equivalent to MOUNT_UNMOUNTING_SIGTERM and MOUNT_UNMOUNTING_SIGKILL in what they do, and the outcome has been the same as well: the unit is stopped. Hence, let's simplify things a bit, and merge them. Note that we keep MOUNT_REMOUNTING_{SIGTERM|SIGKILL} however, as those states have a different outcome: the unit remains started. 2. mount_enter_signal() will now honour the SendSIGKILL= option of the mount unit if it was set. This was previously done already when we entered the signal states through a timeout, and was simply missing here. 3. A new helper function mount_enter_dead_or_mounted() is added that places the mount unit in either MOUNT_DEAD or MOUNT_MOUNTED, depending on what the kernel thinks about the mount's state. This function is called at various places now, wherever we finished an operation, and want to make sure our own state reflects again what the kernel thinks. Previously we had very similar code in a number of places and in other places didn't recheck the kernel state. Let's do that with the same logic and function at all relevant places now. 4. Rework mount_stop(): never forget about running control processes. Instead: when we have a start (i.e. a /bin/mount) process running, and are asked to stop, then enter the kill states for it, so that it gets cleaned up. This fixes #6048. Moreover, when we have a reload process running convert the possible states into the relevant unmounting states, so that we can properly execute the requested operation. Fixes #6048
* Drop busname unit typeZbigniew Jędrzejewski-Szmek2017-07-231-15/+0
| | | | | | | Since busname units are only useful with kdbus, they weren't actively used. This was dead code, only compile-tested. If busname units are ever added back, it'll be cleaner to start from scratch (possibly reverting parts of this patch).
* core: make NotifyAccess= and FileDescriptorStoreMax= available to transient ↵Lennart Poettering2017-06-261-0/+9
| | | | | | services This is helpful for debugging/testing #5606.
* tree-wide: drop NULL sentinel from strjoinZbigniew Jędrzejewski-Szmek2016-10-231-2/+2
| | | | | | | | | | | | | This makes strjoin and strjoina more similar and avoids the useless final argument. spatch -I . -I ./src -I ./src/basic -I ./src/basic -I ./src/shared -I ./src/shared -I ./src/network -I ./src/locale -I ./src/login -I ./src/journal -I ./src/journal -I ./src/timedate -I ./src/timesync -I ./src/nspawn -I ./src/resolve -I ./src/resolve -I ./src/systemd -I ./src/core -I ./src/core -I ./src/libudev -I ./src/udev -I ./src/udev/net -I ./src/udev -I ./src/libsystemd/sd-bus -I ./src/libsystemd/sd-event -I ./src/libsystemd/sd-login -I ./src/libsystemd/sd-netlink -I ./src/libsystemd/sd-network -I ./src/libsystemd/sd-hwdb -I ./src/libsystemd/sd-device -I ./src/libsystemd/sd-id128 -I ./src/libsystemd-network --sp-file coccinelle/strjoin.cocci --in-place $(git ls-files src/*.c) git grep -e '\bstrjoin\b.*NULL' -l|xargs sed -i -r 's/strjoin\((.*), NULL\)/strjoin(\1)/' This might have missed a few cases (spatch has a really hard time dealing with _cleanup_ macros), but that's no big issue, they can always be fixed later.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* basic: don't append suffixes to unit name glob expressionsLennart Poettering2016-01-271-11/+34
| | | | | | | When the user specifies "foo*" as unit name glob expression, we shouldn't turn this into "foo*.service". Hence: only append a suffix if the specified string isn't a glob expression. Fixes: #2397
* basic: re-sort includesThomas Hindoe Paaboel Andersen2015-12-011-1/+1
| | | | | My previous patch to only include what we use accidentially placed the added inlcudes in non-sorted order.
* basic: include only what we useThomas Hindoe Paaboel Andersen2015-11-301-2/+4
| | | | | This is a cleaned up result of running iwyu but without forward declarations on src/basic.
* core: remove support for RequiresOverridable= and RequisiteOverridable=Lennart Poettering2015-11-121-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | As discussed at systemd.conf 2015 and on also raised on the ML: http://lists.freedesktop.org/archives/systemd-devel/2015-November/034880.html This removes the two XyzOverridable= unit dependencies, that were basically never used, and do not enhance user experience in any way. Most folks looking for the functionality this provides probably opt for the "ignore-dependencies" job mode, and that's probably a good idea. Hence, let's simplify systemd's dependency engine and remove these two dependency types (and their inverses). The unit file parser and the dbus property parser will now redirect the settings/properties to result in an equivalent non-overridable dependency. In the case of the unit file parser we generate a warning, to inform the user. The dbus properties for this unit type stay available on the unit objects, but they are now hidden from usual introspection and will always return the empty list when queried. This should provide enough compatibility for the few unit files that actually ever made use of this.
* Remove snapshot unit typeZbigniew Jędrzejewski-Szmek2015-11-101-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Snapshots were never useful or used for anything. Many systemd developers that I spoke to at systemd.conf2015, didn't even know they existed, so it is fairly safe to assume that this type can be deleted without harm. The fundamental problem with snapshots is that the state of the system is dynamic, devices come and go, users log in and out, timers fire... and restoring all units to some state from the past would "undo" those changes, which isn't really possible. Tested by creating a snapshot, running the new binary, and checking that the transition did not cause errors, and the snapshot is gone, and snapshots cannot be created anymore. New systemctl says: Unknown operation snapshot. Old systemctl says: Failed to create snapshot: Support for snapshots has been removed. IgnoreOnSnaphost settings are warned about and ignored: Support for option IgnoreOnSnapshot= has been removed and it is ignored http://lists.freedesktop.org/archives/systemd-devel/2015-November/034872.html
* doc: correct punctuation and improve typography in documentationJan Engelhardt2015-11-061-1/+1
|
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: move string table stuff into its own string-table.[ch]Lennart Poettering2015-10-271-2/+3
|
* util-lib: split out hex/dec/oct encoding/decoding into its own fileLennart Poettering2015-10-271-0/+1
|
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-3/+4
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* Move all unit states to basic/ and extend systemctl --state=helpZbigniew Jędrzejewski-Szmek2015-09-281-0/+153
|
* Move UnitActiveState to basic/Zbigniew Jędrzejewski-Szmek2015-09-281-0/+11
| | | | Preparation to allow systemctl to query the list of unit states.
* core: add unit_dbus_interface_from_type() to unit-name.hLennart Poettering2015-08-281-1/+37
| | | | | | | | | Let's add a way to get the type-specific D-Bus interface of a unit from either its type or name to src/basic/unit-name.[ch]. That way we can share it with the client side, where it is useful in tools like cgls or machinectl. Also ports over machinectl to make use of this.
* unit-name: fix memory leakDaniel Mack2015-07-301-1/+3
| | | | | Fix a memory leak introduced by 2fc09a9c. 's' is used twice in this function, and if free_and_strdup() fails, the pointer is left untouched.
* tree-wide: use free_and_strdup()Daniel Mack2015-07-301-5/+4
| | | | | Use free_and_strdup() where appropriate and replace equivalent, open-coded versions.
* build-sys: split internal basic/ library from shared/Kay Sievers2015-06-111-0/+834
basic/ can be used by everything cannot use anything outside of basic/ libsystemd/ can use basic/ cannot use shared/ shared/ can use libsystemd/