summaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)Author
2014-03-16Use strlen even for constant stringsJosh Triplett
GCC optimizes strlen("string constant") to a constant, even with -O0. Thus, replace patterns like sizeof("string constant")-1 with strlen("string constant") where possible, for clarity. In particular, for expressions intended to add up the lengths of components going into a string, this often makes it clearer that the expression counts the trailing '\0' exactly once, by putting the +1 for the '\0' at the end of the expression, rather than hidden in a sizeof in the middle of the expression.
2014-03-14Do not return -1 (EINVAL) on allocation errorZbigniew Jędrzejewski-Szmek
2014-03-14machine-id-setup: use path_kill_slashes and modernizationsZbigniew Jędrzejewski-Szmek
2014-03-14machine-id: add --root option to operate on an alternate fs treeGreg KH
This makes it possible to initialize the /etc/machine-id file on an arbitrary filesystem hierarchy. This helps systems that wish to run this at image creation time in a subdirectory, or from initramfs before pivot-root is called. [tomegun: converted to using _cleanup_free_ macros]
2014-03-12socket.c: make use of union sockaddr_unionDaniel Buch
2014-03-12manager: use system state enum where appropriateLennart Poettering
2014-03-12core: introduce system state enumLennart Poettering
The system state knows the states starting → running/degraded/maintenance → stopping, where: starting = system startup running = normal operation degraded = at least one unit is currently in failed state maintenance = rescue/emergency mode is active or queued stopping = system shutdown
2014-03-11core: support globbing matches in DeviceAllow= when checking for device groupsLennart Poettering
2014-03-11dbus: suppress duplicate and misleading messagesLennart Poettering
When we try to send a signal on a connection we didn't hae the time to process the Disconnected message yet, don't generate multiple warning messages, but only a single debug message. https://bugs.freedesktop.org/show_bug.cgi?id=75874
2014-03-08fix off by one error in array index assertionDave Reisner
Since the index is already post-incremented when the array is appended to, this assertion can be wrongly reached when the array is at capacity (with the NULL terminator). The bug is reproducible on shutdown with the following settings in /etc/systemd/system.conf: LogTarget=journal-or-kmsg LogColor=yes LogLocation=yes Reported by Thermi on IRC.
2014-03-07Make tables for DEFINE_STRING_TABLE_LOOKUP consistentDaniel Mack
Bring some arrays that are used for DEFINE_STRING_TABLE_LOOKUP() in the same order than the enums they reference. Also, pass the corresponding _MAX value to the array initalizer where appropriate.
2014-03-07sd-bus: add support for policy upload on activator connectionsDaniel Mack
Activator connections may upload policy when registering to the bus. This patch contains code to translate between BusNamePolicy objects and the kdbus specific items.
2014-03-07busname: add parser for bus name policiesDaniel Mack
There are three directives to specify bus name polices in .busname files: * AllowUser [username] [access] * AllowGroup [groupname] [access] * AllowWorld [access] Where [access] is one of * 'see': The user/group/world is allowed to see a name on the bus * 'talk': The user/group/world is allowed to talk to a name * 'own': The user/group/world is allowed to own a name There is no user added yet in this commit.
2014-03-07busname: don't drop 'service' from the result stringLennart Poettering
2014-03-07manager: flush memory stream before using the bufferDaniel Mack
When the manager receives a SIGUSR2 signal, it opens a memory stream with open_memstream(), uses the returned file handle for logging, and dumps the logged content with log_dump(). However, the char* buffer is only safe to use after the file handle has been flushed with fflush, as the man pages states: When the stream is closed (fclose(3)) or flushed (fflush(3)), the locations pointed to by ptr and sizeloc are updated to contain, respectively, a pointer to the buffer and the current size of the buffer. These values remain valid only as long as the caller performs no further output on the stream. If further output is performed, then the stream must again be flushed before trying to access these variables. Without that call, dump remains NULL and the daemon crashes in log_dump().
2014-03-07core/busname: add lookup string for BUSNAME_FAILURE_SERVICE_FAILED_PERMANENTDaniel Mack
When a busname unit enters BUSNAME_FAILURE_SERVICE_FAILED_PERMANENT, the serialization will not be able to look up the result as string via busname_result_to_string(). This leads to an assertion trap during daemon-reexec.
2014-03-07gpt-auto-generator: automatically find the root disk of the systemLennart Poettering
When run in an initrd and no root= argument is set (or is set to root=gpt-auto) we will automatically look for the root partition on the same disk the EFI ESP is located on. Since we look for swap, /home and /srv on the disk the root partition is located on, we hence have a fully discoverable chain: Firmware discovers the EFI ESP partition → the initrd discovers the root partition → the host OS discovers swap, /home, and /srv. Note that this requires an EFI boot loader that sets the LoaderDevicePartUUID EFI variable, such as Gummiboot.
2014-03-07fstab-generator: merge /proc/cmdline parsing loops into oneLennart Poettering
2014-03-06util: move more intellegince into parse_proc_cmdline()Lennart Poettering
Already split variable assignments before invoking the callback. And drop "rd." settings if we are not in an initrd.
2014-03-06core: include partition label in .device description fieldsLennart Poettering
2014-03-06core: correctly unregister PIDs from PID hashtablesLennart Poettering
2014-03-06util: add timeout to generator executionLennart Poettering
2014-03-05core: don't override NoNewPriviliges= from SystemCallFilter= if it is ↵Lennart Poettering
already explicitly set
2014-03-05core: make the LimitXYZ= properties settable for transient service unitsLennart Poettering
2014-03-05missing: if RLIMIT_RTTIME is not defined by the libc, then we need a new ↵Lennart Poettering
define for the max number of rlimits, too
2014-03-05core: when passing resource limit values to client, map RLIM_INFINITY into ↵Lennart Poettering
portable value (uint64_t) -1
2014-03-04Do not print invalid UTF-8 in error messagesZbigniew Jędrzejewski-Szmek
Inexplicably, 550a40ec ('core: do not print invalid utf-8 in error messages') only fixed two paths. Convert all of them now.
2014-03-04Introduce strv_consume which takes ownershipZbigniew Jędrzejewski-Szmek
This mirrors set_consume and makes the common use a bit nicer.
2014-03-03core: fix assert when trying to serialize non-initialized bus peer tracker ↵Lennart Poettering
object
2014-03-03core: add missing show-status.[ch]Lennart Poettering
2014-03-03conf-parser: config_parse_path_strv() is not generic, so let's move it into ↵Lennart Poettering
load-fragment.c The parse code actually checked for specific lvalue names, which is really wrong for supposedly generic parsers...
2014-03-03core: move config_parse_set_status() into load-fragment.cLennart Poettering
Let's keep specific config parsers close to where they are needed. Only the really generic ones should be defined in conf-parser.[ch].
2014-03-03core: move ShowStatus type into the coreLennart Poettering
Let's make the scope of the show-status stuff a bit smaller, and make it private to the core, rather than shared API in shared/.
2014-03-03conf-parse: rename config_parse_level() to config_parse_log_level()Lennart Poettering
"level" is a bit too generic, let's clarify what kind of level we are referring to here.
2014-03-03core: introduce new RuntimeDirectory= and RuntimeDirectoryMode= unit settingsLennart Poettering
As discussed on the ML these are useful to manage runtime directories below /run for services.
2014-03-03execute: no need to include seccomp.h from execute.hLennart Poettering
2014-03-03execute: free directory path if we fail to remove it because we cannot ↵Lennart Poettering
allocate a thread
2014-03-03bus: add sd_bus_track object for tracking peers, and port core over to itLennart Poettering
This is primarily useful for services that need to track clients which reference certain objects they maintain, or which explicitly want to subscribe to certain events. Something like this is done in a large number of services, and not trivial to do. Hence, let's unify this at one place. This also ports over PID 1 to use this to ensure that subscriptions to job and manager events are correctly tracked. As a side-effect this makes sure we properly serialize and restore the track list across daemon reexec/reload, which didn't work correctly before. This also simplifies how we distribute messages to broadcast to the direct busses: we only track subscriptions for the API bus and implicitly assume that all direct busses are subscribed. This should be a pretty OK simplification since clients connected via direct bus connections are shortlived anyway.
2014-02-26mount: don't fire PropertiesChanged signals for mounts that are stoppedLennart Poettering
2014-02-26mount: don't send out PropertiesChanged message if actually nothing got changedLennart Poettering
2014-02-26mount: minor modernizationLennart Poettering
2014-02-26exec: imply NoNewPriviliges= only when seccomp filters are used in user modeLennart Poettering
2014-02-26core: add new RestrictAddressFamilies= switchLennart Poettering
This new unit settings allows restricting which address families are available to processes. This is an effective way to minimize the attack surface of services, by turning off entire network stacks for them. This is based on seccomp, and does not work on x86-32, since seccomp cannot filter socketcall() syscalls on that platform.
2014-02-26seccomp: we should control NO_NEW_PRIVS on our own, not let seccomp do this ↵Lennart Poettering
for us
2014-02-24Remove dead lines in various placesZbigniew Jędrzejewski-Szmek
As pointed-out by clang -Wunreachable-code. No behaviour changes.
2014-02-25core: expose architecture as a bus property, so that we can easily query it ↵Lennart Poettering
remotely
2014-02-24core: add global settings for enabling CPUAccounting=, MemoryAccounting=, ↵Lennart Poettering
BlockIOAccounting= for all units at once
2014-02-24smack: set loaded_policy in smack_setup()Łukasz Stelmach
With loaded_policy set to true mount_setup() relabels /dev properly.
2014-02-23dbus-timer: fix bus_timer_vtable to have the correct timesDjalal Harouni
next_elapse_monotonic() should map to the "NextElapseUSecMonotonic" property and next_elapse_realtime() to "NextElapseUSecRealtime" one. This makes "systemctl list-timers" compute and show the correct times. https://bugs.freedesktop.org/show_bug.cgi?id=75272
2014-02-24cgroup: certain cgroup attributes are not available in the root cgroup, ↵Lennart Poettering
hence don't bother