summaryrefslogtreecommitdiffstats
path: root/src/core/mount.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* sd-event: rework API to support CLOCK_REALTIME_ALARM and ↵Lennart Poettering2014-03-241-1/+6
| | | | CLOCK_BOOTTIME_ALARM, too
* core: rework context initialization/destruction logicLennart Poettering2014-03-191-20/+12
| | | | | | | | Let's automatically initialize the kill, exec and cgroup contexts of the various unit types when the object is constructed, instead of invididually in type-specific code. Also, when PrivateDevices= is set, set DevicePolicy= to closed.
* fstab-generator: merge /proc/cmdline parsing loops into oneLennart Poettering2014-03-071-14/+0
|
* core: introduce new RuntimeDirectory= and RuntimeDirectoryMode= unit settingsLennart Poettering2014-03-031-0/+3
| | | | | As discussed on the ML these are useful to manage runtime directories below /run for services.
* mount: don't fire PropertiesChanged signals for mounts that are stoppedLennart Poettering2014-02-261-3/+6
|
* mount: don't send out PropertiesChanged message if actually nothing got changedLennart Poettering2014-02-261-3/+12
|
* mount: minor modernizationLennart Poettering2014-02-261-3/+4
|
* core: add global settings for enabling CPUAccounting=, MemoryAccounting=, ↵Lennart Poettering2014-02-241-1/+3
| | | | BlockIOAccounting= for all units at once
* api: in constructor function calls, always put the returned object pointer ↵Lennart Poettering2014-02-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | first (or second) Previously the returned object of constructor functions where sometimes returned as last, sometimes as first and sometimes as second parameter. Let's clean this up a bit. Here are the new rules: 1. The object the new object is derived from is put first, if there is any 2. The object we are creating will be returned in the next arguments 3. This is followed by any additional arguments Rationale: For functions that operate on an object we always put that object first. Constructors should probably not be too different in this regard. Also, if the additional parameters might want to use varargs which suggests to put them last. Note that this new scheme only applies to constructor functions, not to all other functions. We do give a lot of freedom for those. Note that this commit only changes the order of the new functions we added, for old ones we accept the wrong order and leave it like that.
* core: make sure to always go through both SIGTERM and SIGKILL states of unitsLennart Poettering2014-01-291-1/+7
| | | | | | Given that we now have KillMode=mixed where SIGTERM might kill a smaller set than SIGKILL we need to make sure to always go explicitly throught the SIGKILL state to get the right end result.
* core: add function to tell when job will time outZbigniew Jędrzejewski-Szmek2014-01-271-0/+16
| | | | | | Things will continue when either the job timeout or the unit timeout is reached. Add functionality to access that info.
* mount: don't creat local-fs.target links for mount units when runnin in user ↵Lennart Poettering2014-01-071-23/+22
| | | | mode
* Use format patterns for usec_t, pid_t, nsec_t, usec_tZbigniew Jędrzejewski-Szmek2014-01-031-3/+3
| | | | | | | | It is nicer to predefine patterns using configure time check instead of using casts everywhere. Since we do not need to use any flags, include "%" in the format instead of excluding it like PRI* macros.
* sd-daemon: introduce sd_watchdog_enabled() for parsing $WATCHDOG_USECLennart Poettering2013-12-221-0/+1
| | | | | | | | Also, introduce a new environment variable named $WATCHDOG_PID which cotnains the PID of the process that is supposed to send the keep-alive events. This is similar how $LISTEN_FDS and $LISTEN_PID work together, and protects against confusing processes further down the process tree due to inherited environment.
* core: no need to list properties for PropertiesChanged messages anymoreLennart Poettering2013-12-221-1/+0
| | | | Since the vtable includes this information anyway, let's just use that
* bus: add .busname unit type to implement kdbus-style bus activationLennart Poettering2013-12-021-21/+15
|
* service: add the ability for units to join other unit's PrivateNetwork= and ↵Lennart Poettering2013-11-271-20/+11
| | | | PrivateTmp= namespaces
* core: set some event source priorities to enforce dispatching orderLennart Poettering2013-11-251-0/+7
|
* swap: split state machine state ACTIVATING into twoLennart Poettering2013-11-251-34/+27
| | | | | We expect the event on /proc/swaps before we expect the SIGCHILD, reflect this in the state machine.
* core: convert PID 1 to libsystemd-busLennart Poettering2013-11-201-64/+77
| | | | | | | | | | | | | | | | | | | | | | This patch converts PID 1 to libsystemd-bus and thus drops the dependency on libdbus. The only remaining code using libdbus is a test case that validates our bus marshalling against libdbus' marshalling, and this dependency can be turned off. This patch also adds a couple of things to libsystem-bus, that are necessary to make the port work: - Synthesizing of "Disconnected" messages when bus connections are severed. - Support for attaching multiple vtables for the same interface on the same path. This patch also fixes the SetDefaultTarget() and GetDefaultTarget() bus calls which used an inappropriate signature. As a side effect we will now generate PropertiesChanged messages which carry property contents, rather than just invalidation information.
* Configurable Timeouts/Restarts default valuesOleksii Shevchuk2013-11-051-1/+1
| | | | | | | https://bugs.freedesktop.org/show_bug.cgi?id=71132 Patch adds DefaultTimeoutStartSec, DefaultTimeoutStopSec, DefaultRestartSec configuration options to manager configuration file.
* mount/service: drop FsckPassNo supportTom Gundersen2013-10-191-31/+1
| | | | | | | | We now treat passno as boleans in the generators, and don't need this any more. fsck itself is able to sequentialize checks on the same local media, so in the common case the ordering is redundant. It is still possible to force an order by using .d fragments, in case that is desired.
* core: do not add "what" to RequiresMountsFor for network mountsZbigniew Jędrzejewski-Szmek2013-10-051-67/+70
| | | | | | | | | For cifs mount like //server/share, we would get RequiresMountsFor=/server/share, which probably isn't harmful, but quite confusing. Unfortunately a bunch of static functions had to be moved up, but patch is really one line.
* mount: check for NULL before reading pm->whatDave Reisner2013-10-051-1/+1
| | | | | | | Since a57f7e2c828b85, a mount unit with garbage in it would cause systemd to crash on loading it. ref: https://bugs.freedesktop.org/show_bug.cgi?id=70148
* systemd: order remote mounts from mountinfo before remote-fs.targetZbigniew Jędrzejewski-Szmek2013-10-041-1/+4
| | | | | | | | Usually the network is stopped before filesystems are umounted. Ordering network filesystems before remote-fs.target means that their unmounting will be performed earlier, and can terminate sucessfully. https://bugs.freedesktop.org/show_bug.cgi?id=70002
* core: rework how we match mount units against each otherLennart Poettering2013-09-261-189/+66
| | | | | | | | | | | | | | | | | | | | | | | Previously to automatically create dependencies between mount units we matched every mount unit agains all others resulting in O(n^2) complexity. On setups with large amounts of mount units this might make things slow. This change replaces the matching code to use a hashtable that is keyed by a path prefix, and points to a set of units that require that path to be around. When a new mount unit is installed it is hence sufficient to simply look up this set of units via its own file system paths to know which units to order after itself. This patch also changes all unit types to only create automatic mount dependencies via the RequiresMountsFor= logic, and this is exposed to the outside to make things more transparent. With this change we still have some O(n) complexities in place when handling mounts, but that's currently unavoidable due to kernel APIs, and still substantially better than O(n^2) as before. https://bugs.freedesktop.org/show_bug.cgi?id=69740
* cgroup: if we do a cgroup operation then do something on all supported ↵Lennart Poettering2013-09-251-1/+1
| | | | | | | | | | | | | controllers Previously we did operations like attach, trim or migrate only on the controllers that were enabled for a specific unit. With this changes we will now do them for all supproted controllers, and fall back to all possible prefix paths if the specified paths do not exist. This fixes issues if a controller is being disabled for a unit where it was previously enabled, and makes sure that all processes stay as "far down" the tree as groups exist.
* mount: filesystems mounted in the initrd should not conflict with ↵Tom Gundersen2013-09-111-5/+21
| | | | | | | | | | | umount.target in the real root These mounts should be kept around and unmounted in the shutdown ramfs. Currently, we will still attempt to umount these in the final kill spree, but we should consider avoiding that too. Also, the should_umount function should be generalised and put into util.c or something like that, but we are still discussing precisely how.
* mount: move device links handling from generatorTom Gundersen2013-09-111-1/+11
| | | | | | | This makes mount units work like swap units: when the backing device appears the mount unit will be started. v2: the device should want the mount unconditionally, not only for DefaultDependencies=yes
* mount: also exclude /usr from unmount at shutdownLennart Poettering2013-07-181-1/+2
|
* core/mount.c:mount_dump(): don't segfault, if mount is not mounted anymoreHarald Hoyer2013-07-041-3/+3
| | | | | | | Don't segfault, if m->from_proc_self_mountinfo and m->from_fragment is false. https://bugzilla.redhat.com/show_bug.cgi?id=957783#c9
* core: add transient unitsLennart Poettering2013-06-281-1/+1
| | | | | | | | | | | | | | | | | | Transient units can be created via the bus API. They are configured via the method call parameters rather than on-disk files. They are subject to normal GC. Transient units currently may only be created for services (however, we will extend this), and currently only ExecStart= and the cgroup parameters can be configured (also to be extended). Transient units require a unique name, that previously had no configuration file on disk. A tool systemd-run is added that makes use of this functionality to run arbitrary command lines as transient services: $ systemd-run /bin/ping www.heise.de Will cause systemd to create a new transient service and run ping in it.
* dbus: hookup runtime property changes for mouns, services, sockets, swaps tooLennart Poettering2013-06-271-0/+2
|
* core: general cgroup reworkLennart Poettering2013-06-271-21/+23
| | | | | | | | | | | | | | | | Replace the very generic cgroup hookup with a much simpler one. With this change only the high-level cgroup settings remain, the ability to set arbitrary cgroup attributes is removed, so is support for adding units to arbitrary cgroup controllers or setting arbitrary paths for them (especially paths that are different for the various controllers). This also introduces a new -.slice root slice, that is the parent of system.slice and friends. This enables easy admin configuration of root-level cgrouo properties. This replaces DeviceDeny= by DevicePolicy=, and implicitly adds in /dev/null, /dev/zero and friends if DeviceAllow= is used (unless this is turned off by DevicePolicy=).
* core: add new .slice unit type for partitioning systemsLennart Poettering2013-06-171-0/+4
| | | | | | | | | | | | 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.
* mount: when learning about the root mount from mountinfo, don't add ↵Lennart Poettering2013-06-171-3/+5
| | | | | | conflicting dep for umount.target That way systemd won't try to umount it at shutdown.
* Add __attribute__((const, pure, format)) in various placesZbigniew Jędrzejewski-Szmek2013-05-031-5/+5
| | | | | | | | I'm assuming that it's fine if a _const_ or _pure_ function calls assert. It is assumed that the assert won't trigger, and even if it does, it can only trigger on the first call with a given set of parameters, and we don't care if the compiler moves the order of calls.
* Use initalization instead of explicit zeroingZbigniew Jędrzejewski-Szmek2013-04-061-9/+6
| | | | | | | | | | | | | | | | | | | | | | | Before, we would initialize many fields twice: first by filling the structure with zeros, and then a second time with the real values. We can let the compiler do the job for us, avoiding one copy. A downside of this patch is that text gets slightly bigger. This is because all zero() calls are effectively inlined: $ size build/.libs/systemd text data bss dec hex filename before 897737 107300 2560 1007597 f5fed build/.libs/systemd after 897873 107300 2560 1007733 f6075 build/.libs/systemd … actually less than 1‰. A few asserts that the parameter is not null had to be removed. I don't think this changes much, because first, it is quite unlikely for the assert to fail, and second, an immediate SEGV is almost as good as an assert.
* util: rename parse_usec() to parse_sec() sinds the default unit is secondsLennart Poettering2013-04-031-1/+1
| | | | | | | | Internally we store all time values in usec_t, however parse_usec() actually was used mostly to parse values in seconds (unless explicit units were specified to define a different unit). Hence, be clear about this and name the function about what we pass into it, not what we get out of it.
* ModernizationZbigniew Jędrzejewski-Szmek2013-03-311-2/+4
| | | | Use _cleanup_ and wrap lines to ~80 chars and such.
* unit: replace remote-fs-setup.target by network-online.targetLennart Poettering2013-03-291-6/+6
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=787314
* units: automatically order all mount units after network.targetLennart Poettering2013-03-271-1/+9
| | | | | | | | | | | | Previously it was necessary to pull in remote-fs-pre.target to order the mount units against network.target since the ordering was done transitively via remote-fs-pre.target. As network implementations shouldn't need to know about the specific use-case of network mounts we instead now simply order network.target against all mounts too. This should make it unnecessary for network managing services to import remote-fs-pre.target explicitly, as network.target will now suffice.
* units: introduce remote-fs-setup.target to pull in dependencies from remote ↵Lennart Poettering2013-03-251-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | mounts This introduces remote-fs-setup.target independently of remote-fs-pre.target. The former is only for pulling things in, the latter only for ordering. The new semantics: remote-fs-setup.target: is pulled in automatically by all remote mounts. Shall be used to pull in other units that want to run when at least one remote mount is set up. Is not ordered against the actual mount units, in order to allow activation of its dependencies even 'a posteriori', i.e. when a mount is established outside of systemd and is only picked up by it. remote-fs-pre.target: needs to be pulled in automatically by the implementing service, is otherwise not part of the initial transaction. This is ordered before all remote mount units. A service that wants to be pulled in and run before all remote mounts should hence have: a) WantedBy=remote-fs-setup.target -- so that it is pulled in b) Wants=remote-fs-pre.target + Before=remote-fs-pre.target -- so that it is ordered before the mount point, normally.
* core: reuse the same /tmp, /var/tmp and inaccessible dirMichal Sekletar2013-03-161-1/+20
| | | | | | | | All Execs within the service, will get mounted the same /tmp and /var/tmp directories, if service is configured with PrivateTmp=yes. Temporary directories are cleaned up by service itself in addition to systemd-tmpfiles. Directory which is mounted as inaccessible is created at runtime in /run/systemd.
* core: keep mountinfo .mounts until late shutdownUmut Tezduyar2013-03-161-0/+8
| | | | | | | | | | | | | | .mount units coming from /proc/self/mountinfo file are unmounted after local-fs.target is reached during shutdown. Problem: .mount units popping up in mountinfo file are added to systemd without any dependency. For that reason, they are the first one to be unmounted during shutdown. Whichever program mounted the file system deserves a chance to also unmount it. This patch ensures that /proc/self/mountinfo units will be unmounted after local-fs.target during shutdown (if they haven't been unmounted already)
* core: single unit_kill implementation for all unit typesMichal Schmidt2013-03-131-47/+1
| | | | | | | There are very few differences in the implementations of the kill method in the unit types that have one. Let's unify them. This does not yet unify unit_kill() with unit_kill_context().
* core: fix getting information about mount unitMichal Sekletar2013-03-121-1/+2
| | | | | We should not try to get information about mount unit from fragment if the unit was created because of /proc/self/mountinfo event.
* fstab,mount: detect rbind as bind mountFrederic Crozat2013-03-011-0/+6
| | | | | | Correctly detect rbind mount option as bind mount. Fixes https://bugzilla.novell.com/show_bug.cgi?id=804575.
* core: do not overwrite existing units sourceUmut Tezduyar2013-02-141-5/+7
| | | | | Only set source for freshly created .mounts coming from mountinfo file.
* core: unify kill code of mount, service, socket, swap unitsLennart Poettering2013-01-261-46/+14
|