summaryrefslogtreecommitdiffstats
path: root/src/test/test-cgroup-util.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-2/+3
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-1/+1
| | | | | | | | | | | | | | 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.
* tests: Skip test-cgroup-util test_mask_supported() when not running under ↵Martin Pitt2015-09-071-1/+1
| | | | | | | | systemd Commit 5f4c5fef6 introduced this new test case, but this does not work in build chroots where cgroupfs is not mounted. So skip the test if systemd is not running.
* cgroup: always read the supported controllers from the root cgroup of the ↵Lennart Poettering2015-09-041-0/+12
| | | | | | | local container Otherwise we might end up thinking that we support more controllers than actually enabled for the container we are running in.
* shared: Drop 'name=' prefix from SYSTEMD_CGROUP_CONTROLLER define.Dimitri John Ledkov2015-06-021-10/+10
| | | | | | | | | | | In cgtop,mount-setup,nspawn the name= prefix is hard-coded in the mount options, and the define is not used. Everywhere else, we explicitly white-list allow 'name=' prefix to be used with all controllers, and strip it out to 'normalise' the controller name. That work is mostly inflicted on us due to 'name=' prefix in the define. Dropping this prefix makes everything more sane overall.
* cgroup-util: be more strict when processing slice unit namesLennart Poettering2015-05-061-1/+1
|
* core: catch some special cases in cg_slice_to_path()Lennart Poettering2015-04-301-1/+6
|
* sd-bus,sd-login: add api for querying the slice within the the user systemd ↵Lennart Poettering2015-04-301-0/+25
| | | | | | | instance of a process units are organized in slice trees, not only for the system instance, but also for user systemd instances, expose this properly.
* core: rework cgroup path parse logicLennart Poettering2015-04-301-0/+18
| | | | | | | Various cleanups, be stricter when parsing unit paths. Most importantly: return the root slice "-.slice" when asked for slice of paths that contain no slice component.
* sd-bus: properly handle creds that are known but undefined for a processLennart Poettering2015-04-291-13/+13
| | | | | | | | | | | | | | | A number of fields do not apply to all processes, including: there a processes without a controlling tty, without parent process, without service, user services or session. To distuingish these cases from the case where we simply don't have the data, always return ENXIO for them, while returning ENODATA for the case where we really lack the information. Also update the credentials dumping code to show this properly. Fields that are known but do not apply are now shown as "n/a". Note that this also changes some of the calls in process-util.c and cgroup-util.c to return ENXIO for these cases.
* shared: add process-util.[ch]Ronny Chevalier2015-04-101-0/+1
|
* shared: add formats-util.hRonny Chevalier2015-04-101-0/+1
|
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-1/+0
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* cg_path_get_user_unit(): Did not correctly parse user-unit templates.Luke Shumaker2015-02-041-0/+1
| | | | | | | It ran either skip_session() or skip_user_manager(), then ran skip_slices() iff skip_session() ran. It needs to run skip_slices() in either case. Included is a test case demonstrating why.
* treewide: introduce UID_INVALID (and friends) as macro for (uid_t) -1Lennart Poettering2014-11-281-1/+1
|
* cgroup-util: shorten cg_path_get_sessionZbigniew Jędrzejewski-Szmek2014-08-301-1/+2
|
* Remove unnecessary casts in printfsZbigniew Jędrzejewski-Szmek2014-05-151-3/+3
| | | | No functional change expected :)
* test: fix "make check"Lennart Poettering2014-02-121-16/+0
| | | | | | | Let's remove the tests for cg_path_get_machine_name(), since they no longer operate solely on the cgroup path, but actually look up data in /run. Since we have a test for cg_pid_get_machine_name() this shouldn't be too much of a loss.
* bus: properly shift cgroup data returned from kdbus by the container's root ↵Lennart Poettering2013-12-241-0/+16
| | | | before parsing
* Fix extraction of _SYSTEMD_USER_UNITZbigniew Jędrzejewski-Szmek2013-12-231-3/+16
| | | | | Units from user services underneath user@.service would not be detected properly.
* journald: cache cgroup root path, instead of querying it on every incoming ↵Lennart Poettering2013-12-111-4/+3
| | | | log message
* test: cgroup-util - do not fail if cpu controller is not availableKay Sievers2013-12-081-1/+2
|
* test: Make testing work on systems without or old systemdHolger Hans Peter Freyther2013-08-221-2/+3
| | | | | | | | | | | | | | * Introduce a macro to conditionally execute tests. This avoids skipping the entire test if some parts require systemd * Skip the journal tests when no /etc/machine-id is present * Change test-catalog to load the catalog from the source directory of systemd. * /proc/PID/comm got introduced in v2.6.33 but travis is still using v2.6.32. * Enable make check and make distcheck on the travis build * Use -D"CATALOG_DIR=STR($(abs_top_srcdir)/catalog)" as a STRINGIY would result in the path '/home/ich/source/linux' to be expanded to '/home/ich/source/1' as linux is defined to 1.
* cgroup: simplify how instantiated units are mapped to cgroupsLennart Poettering2013-07-111-9/+14
| | | | | | | | | Previously for an instantiated unit foo@bar.service we created a cgroup foo@.service/foo@bar.service, in order to place all instances of the same template inside the same subtree. As we now implicitly add all instantiated units into one per-template slice we don't need this complexity anymore, and instance units can map directly to the cgroups of their full name.
* libsystemd-logind: fix detection of session/user/machine of a PIDLennart Poettering2013-07-021-16/+16
|
* login: add an api to determine the slice a PID is located in to libsystemd-loginLennart Poettering2013-06-211-3/+5
|
* logind: add infrastructure to keep track of machines, and move to slicesLennart Poettering2013-06-201-25/+64
| | | | | | | | | | | | | | | | | | | | - This changes all logind cgroup objects to use slice objects rather than fixed croup locations. - logind can now collect minimal information about running VMs/containers. As fixed cgroup locations can no longer be used we need an entity that keeps track of machine cgroups in whatever slice they might be located. Since logind already keeps track of users, sessions and seats this is a trivial addition. - nspawn will now register with logind and pass various bits of metadata along. A new option "--slice=" has been added to place the container in a specific slice. - loginctl gained commands to list, introspect and terminate machines. - user.slice and machine.slice will now be pulled in by logind.service, since only logind.service requires this slice.
* core: add new .slice unit type for partitioning systemsLennart Poettering2013-06-171-0/+20
| | | | | | | | | | | | In order to prepare for the kernel cgroup rework, let's introduce a new unit type to systemd, the "slice". Slices can be arranged in a tree and are useful to partition resources freely and hierarchally by the user. Each service unit can now be assigned to one of these slices, and later on login users and machines may too. Slices translate pretty directly to the cgroup hierarchy, and the various objects can be assigned to any of the slices in the tree.
* cgroup: when escaping a cgroup object name, also escape names that start ↵Lennart Poettering2013-05-031-0/+4
| | | | with a dot
* cgls: add --machine/-MZbigniew Jędrzejewski-Szmek2013-05-011-1/+1
| | | | | cg_get_machine_path is modified to include the escaped machine name + ".nspawn" if the machine argument is nonnull.
* cgroup: always validate cgroup controller namesLennart Poettering2013-04-251-0/+14
| | | | Let's better be safe than sorry.
* cgroup: make sure all our cgroup objects have a suffix and are properly escapedLennart Poettering2013-04-231-7/+33
| | | | | | | | | | | | | | Session objects will now get the .session suffix, user objects the .user suffix, nspawn containers the .nspawn suffix. This also changes the user cgroups to be named after the numeric UID rather than the username, since this allows us the parse these paths standalone without requiring access to the cgroup file system. This also changes the mapping of instanced units to cgroups. Instead of mapping foo@bar.service to the cgroup path /user/foo@.service/bar we will now map it to /user/foo@.service/foo@bar.service, in order to ensure that all our objects are properly suffixed in the tree.
* nspawn: suffix the nspawn cgroups with ".nspawn"Lennart Poettering2013-04-231-0/+40
| | | | | | | | | | | As discussed with Dan Berrange it's a good idea to suffix all objects in the cgroup tree with ".something", so that when the system is partitioned using a resource management tool we can drop objects of different types into the same partition directory without generate namespace conflicts. We'l add this to the Pax Control Group document as soon as write access to the fdo wiki is restored.
* nspawn: introduce the new /machine/ tree in the cgroup tree and move ↵Lennart Poettering2013-04-161-10/+30
| | | | | | | | | | | | | | containers there Containers will now carry a label (normally derived from the root directory name, but configurable by the user), and the container's root cgroup is /machine/<label>. This label is called "machine name", and can cover both containers and VMs (as soon as libvirt also makes use of /machine/). libsystemd-login can be used to query the machine name from a process. This patch also includes numerous clean-ups for the cgroup code.
* bus: handle env vars safelyLennart Poettering2013-04-151-12/+64
| | | | | Make sure that our library is safe for usage in SUID programs when it comes to env var handling
* core/cgroup-util: simplify functions and add testsZbigniew Jędrzejewski-Szmek2013-01-181-0/+27