1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 16:59:03 +03:00
Commit Graph

45 Commits

Author SHA1 Message Date
Lennart Poettering
cd43ca73e1 path: convert failure field to enum 2012-02-03 05:06:04 +01:00
Michal Schmidt
595ed347a8 unit: use safe downcasts, remove pointless casts
Always use the macros for downcasting.
Remove a few obviously pointless casts.
2012-01-16 13:34:42 +01:00
Michal Schmidt
1124fe6f01 unit: use the UNIT() macro consistently
The UNIT() macro upcasts from specific unit types to the base Unit.
Use it everywhere, rather than accessing the 'meta' member directly.
2012-01-16 13:34:42 +01:00
Michal Schmidt
ac155bb885 unit: remove union Unit
Now that objects of all unit types are allocated the exact amount of
memory they need, the Unit union has lost its purpose. Remove it.

"Unit" is a more natural name for the base unit class than "Meta", so
rename Meta to Unit.

Access to members of the base class gets simplified.
2012-01-16 13:34:42 +01:00
Michal Schmidt
7d17cfbc46 unit: reduce heap usage for unit objects
The storage of the unit objects on the heap is currently not very
efficient. For every unit object we allocate a chunk of memory as large
as the biggest unit type, although there are significant differences in
the units' real requirements.
pahole shows the following sizes of structs:
488  Target
496  Snapshot
512  Device
528  Path
560  Timer
576  Automount
1080 Socket
1160 Swap
1168 Service
1280 Mount

Usually there aren't many targets or snapshots in the system, but Device
is one of the most common unit types and for every one we waste
1280 - 512 = 768 bytes.

Fix it by allocating only the right amount for the given unit type.
On my machine (x86_64, with 39 LVM volumes) this decreases systemd's
USS (unique set size) by more than 300 KB.
2012-01-16 13:34:42 +01:00
Lennart Poettering
57020a3abf unit: properly update references to units which are merged
When we merge units that some kind of object points to, those pointers
might become invalidated, and needs to be updated. Introduce a UnitRef
struct which links up all the unit references, to ensure corrected
references.

At the same time, drop configured_sockets in the Service object, and
replace it by proper UNIT_TRIGGERS resp. UNIT_TRIGGERED_BY dependencies,
which allow us to simplify a lot of code.
2012-01-06 23:08:54 +01:00
Michal Schmidt
714d943f72 path: add missing pieces for PathModified
PATH_MODIFIED worked internally for PID files detection, but was unusable
in units.
2011-12-08 18:45:38 +01:00
Michal Schmidt
e92238567b path: add PathModified (= PathChanged + IN_MODIFY) 2011-12-03 13:58:21 +01:00
Michal Schmidt
4b562198c7 path: refactor PathSpec usage
path_*() functions operate on "Path *p" and they do not touch PathSpec
internals directly.

pathspec_*() functions operate on "PathSpec *s". The PathSpec class will
be useful outside of path.c.
2011-12-03 13:43:58 +01:00
Michal Schmidt
768147d13d path: use %m instead of strerror(errno)
and strerror(-errno) was just wrong.
2011-12-03 02:08:52 +01:00
Lennart Poettering
8ea913b2ea coverity: fix a couple of bugs found by coverity 2011-09-23 01:45:34 +02:00
Lennart Poettering
f975e971ac load-fragment: speed up parsing by using a perfect hash table with configuration settings built by gperf 2011-08-01 00:43:05 +02:00
Lennart Poettering
8092a428d4 path,unit: support globbing in conditions and path units 2011-07-07 02:07:39 +02:00
Lennart Poettering
ab5c3e3ff1 english: s/_per_/_by_/ 2011-06-21 19:29:44 +02:00
Lennart Poettering
ac3f50caa5 path: simplify recheck logic 2011-04-28 03:22:05 +02:00
Lennart Poettering
0e456f9781 path: optionally, create watched directories in .path units 2011-04-10 01:30:14 +02:00
Lennart Poettering
0595f9a1c1 path: after installing inotify watches, recheck file again to fix race 2011-03-04 01:50:38 +01:00
Lennart Poettering
3fc546f93d path: don't use IN_ATTRIB on parent dirs when watching a file, since those cannot be removed without emptying the dir first anyway and we need IN_ATTRIB only to detect the link count dropping to 0 2011-03-04 00:22:00 +01:00
Lennart Poettering
e2f3b44cfc service: when reloading a service fails don't fail the entire service but just the reload job 2011-01-20 13:17:22 +01:00
Michal Schmidt
67575eef76 path: fix watching the root directory
If you have a path unit with:
  DirectoryNotEmpty=/foo
and "/foo" does not exist, creating it later escapes the attention of systemd.

When adding watches for parent directories, systemd never adds one for the root
directory. It attempts to add a watch for an empty string instead, which fails.

If the path is "/", we must not trim the slash.
2010-12-01 16:39:58 +01:00
Lennart Poettering
4313fc2ceb path: don't mention too many inotify msgs 2010-11-16 03:27:00 +01:00
Lennart Poettering
62347bc24a path: properly free PathSpec structs 2010-11-15 22:13:26 +01:00
Lennart Poettering
36af55d997 unit: introduce ConditionDirectoryNotEmpty= 2010-11-15 22:13:25 +01:00
Lennart Poettering
672028dc4e path: avoid immediate restarting of units triggered by paths if nothing actually changed on disk 2010-11-15 00:49:21 +01:00
Lennart Poettering
782195a3c3 path: always look for IN_ATTRIB since deletion is signalled that way 2010-11-15 00:47:29 +01:00
Lennart Poettering
2a77d31df9 units: order units by default before appropriate targets in case they are pulled indirectly 2010-10-29 16:28:29 +02:00
Lennart Poettering
ead8e4788e unit: get rid of gnoreDependencyFailure= instead treat ConflictedBy= as weaker counterpart of Conflicts=, similar to Wants= vs. Requires= 2010-10-29 16:28:27 +02:00
Lennart Poettering
f601daa701 inotify: properly handle multiple inotify events per read() 2010-10-13 02:34:00 +02:00
Lennart Poettering
00dc5d769a unit: introduce 'banned' load state for units symlinked to /dev/null 2010-10-08 02:31:36 +02:00
Matthew Miller
fdf20a3160 manager: add missing second part of s/maintenance/failed/ 2010-08-31 00:23:34 +02:00
Lennart Poettering
c4e2ceae94 dbus: follow standardized fdo PropertiesChanged signal spec 2010-08-20 02:31:54 +02:00
Lennart Poettering
d6c9574fb5 emacs: make sure nobody accidently adds tabs to our sources 2010-08-14 19:59:25 +02:00
Lennart Poettering
e364ad0628 clang: fix numerous little issues found with clang-analyzer 2010-08-11 22:04:25 +02:00
Lennart Poettering
69dd2852bb manager: when two pending jobs conflict, keep the one that "conflicts", remove the one that is "conflicted"
This gives the writer of units control which unit is kept and which is
stopped when two units conflict.
2010-08-09 22:32:30 +02:00
Lennart Poettering
5632e3743d systemctl: introduce reset-maintenance command 2010-07-19 04:08:07 +02:00
Lennart Poettering
6c155fe3d0 path,timer: order units after sysinit by default 2010-07-16 18:57:21 +02:00
Lennart Poettering
ba3e67a785 socket: when the socket is supposed to stop, don't accept any connections anymore 2010-07-13 00:27:27 +02:00
Lennart Poettering
398ef8ba02 dbus: make errors reported via D-Bus more useful 2010-07-08 02:43:18 +02:00
Lennart Poettering
a40eb73224 unit: add DefaultDependencies= setting
In order to simplify writing of unit files introduce default
dependencies that are added to all units unless explictly disabled in a
unit. This option can be switched off for select units that are involved
in early boot-up ot late system shutdown,

This should simplify service files for most normal daemons, but breaks
existing service files for software involved in early boot (notably
udev), which need to be updated for a DefaultDependencies=no setting)
2010-07-03 19:48:33 +02:00
Lennart Poettering
2c966c038d unit: simplify things a little by introducing API to add two dependencies in one step 2010-07-03 19:46:38 +02:00
Lennart Poettering
032ff4afc9 unit: shorten active state enums to make systemctl output nicer 2010-07-01 03:34:15 +02:00
Lennart Poettering
6124958c7b unit: add new abstracted maintenance state for units 2010-07-01 00:31:53 +02:00
Lennart Poettering
4cd1fbcc06 unit: get rid of various unnecessary casts 2010-06-19 16:55:49 +02:00
Lennart Poettering
18c78fb1af typo: the correct spelling is maintenance not maintainance 2010-06-16 14:01:55 +02:00
Lennart Poettering
01f78473b1 path: add .path unit type for monitoring files 2010-05-24 05:25:33 +02:00