summaryrefslogtreecommitdiff
path: root/src/core/main.c
AgeCommit message (Collapse)Author
2013-07-26rework systemd's own process environment handling/passingKay Sievers
Stop importing non-sensical kernel-exported variables. All parameters in the kernel command line are exported to the initial environment of PID1, but suppressed if they are recognized by kernel built-in code. The EFI booted kernel will add further kernel-internal things which do not belong into userspace. The passed original environ data of the process is not touched and preserved across re-execution, to allow external reading of /proc/self/environ for process properties like container*=.
2013-07-23remove left-over initrd time stamp handlingKay Sievers
2013-07-17remove RD_TIMESTAMP importHarald Hoyer
If you want timing information from the initramfs, use systemd in the initramfs.
2013-07-11core: rearrange if blocks a bitLennart Poettering
2013-07-10core: uninstall cgroup agent only if we are running outside of a containerLennart Poettering
Since the cgroupfs is currently not virtualized for containers we shouldn't reset the hosts agent from the container.
2013-07-10core: send out "Reloading" signal before and after doing a full ↵Lennart Poettering
reload/reexec of PID 1 Since we'll unload all units/job during a reload, and then readd them it is really useful for clients to be aware of this phase hence sent a signal out before and after. This signal is called "Reloading" (despite the fact that it is also sent out during reexecution, which we consider a special case in this context) and has one boolean parameter which is true for the signal sent before the reload, and false for the signal after the reload. The UnitRemoved/JobRremoved and UnitNew/JobNew due to the reloading are guranteed to be between the pair of Reloading messages.
2013-07-10core: serialize/deserialize bus subscribersLennart Poettering
2013-07-05suppress status message output at shutdown when 'quiet' is givenKay Sievers
2013-07-04disable the cgroups release agent when shutting downKay Sievers
During shutdown, when we try to clean up all remaining processes, the kernel will fork new agents every time a cgroup runs empty. These new processes cause delays in the final SIGTERM, SIGKILL logic. Apart from that, this should also avoid that the kernel-forked binaries cause unpredictably timed access to the filesystem which we might need to unmount.
2013-07-02man: improve grammar and word formatting in numerous man pagesJason St. John
Use proper grammar, word usage, adjective hyphenation, commas, capitalization, spelling, etc. To improve readability, some run-on sentences or sentence fragments were revised. [zj: remove the space from 'file name', 'host name', and 'time zone'.]
2013-06-28main: fix loading of default targetLennart Poettering
2013-06-28core: add transient unitsLennart Poettering
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.
2013-06-27core: general cgroup reworkLennart Poettering
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=).
2013-06-27core: don't do runaway fork()s if we hit a segfault from our segfault handlerLennart Poettering
2013-06-20manager: add DefaultEnvironment optionUmut Tezduyar
This complements existing functionality of setting variables through 'systemctl set-environment', the kernel command line, and through normal environment variables for systemd in session mode.
2013-06-06manager: Do not handle SIGKILL since we can notChengwei Yang
This is a minor fix because it's not a major issue, this fix just avoid to get EINVAL error from sigaction(2). There are two signals can not handled at user space, SIGKILL and SIGSTOP even we're PID 1, trying to handle these two signals will get EINVAL error. There are two kinds of systemd instance, running as system manager or user session manager, apparently, the latter is a general user space process which can not handle SIGKILL. The special pid 1 also can not do that refer to kernel/signal.c:do_sigaction(). However, pid 1 is unkillable because the kernel did attach SIGNAL_UNKILLABLE to it at system boot up, refer to init/main.c:start_kernel() --> rest_init() --> kernel_thread() --> kernel_init() --> init_post() current->signal->flags |= SIGNAL_UNKILLABLE
2013-05-30core: read "debug" from kernel commandline and set log levelLukas Nykryn
2013-05-29systemd: record efi timestamps after /sys is mountedZachary Cook
This partially reverts commit c3a170f3, which moved efi_get_boot_timestamps too early in main(), before /sys is assured to be mounted Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64371 [tomegun: in particular /sys/firmware/efi/efivars needs to be mounted, which is not a problem if a systemd-initramfs containing the correct module is being used. But not everyone uses an initramfs...]
2013-05-06systemd-sleep: add support for freeze and standbyZbigniew Jędrzejewski-Szmek
A new config file /etc/systemd/sleep.conf is added. It is parsed by systemd-sleep and logind. The strings written to /sys/power/disk and /sys/power/state can be configured. This allows people to use different modes of suspend on systems with broken or special hardware. Configuration is shared between systemd-sleep and logind to enable logind to answer the question "can the system be put to sleep" as correctly as possible without actually invoking the action. If the user configured systemd-sleep to only use 'freeze', but current kernel does not support it, logind will properly report that the system cannot be put to sleep. https://bugs.freedesktop.org/show_bug.cgi?id=57793 https://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=7e73c5ae6e7991a6c01f6d096ff8afaef4458c36 http://lists.freedesktop.org/archives/systemd-devel/2013-February/009238.html SYSTEM_CONFIG_FILE and USER_CONFIG_FILE defines were removed since they were used in only a few places and with the addition of /etc/systemd/sleep.conf it becomes easier to just append the name of each file to the dir name.
2013-04-25systemd: record the timestamps as early as possibleHarald Hoyer
The time for systemd initialization and selinux policy loading is accounted to the initrd or the kernel, which is wrong. Instead of: Startup finished in 5.559s (firmware) + 36ms (loader) + 665ms (kernel) + 975ms (initrd) + 1.410s (userspace) = 8.647s the more correct output is: Startup finished in 5.559s (firmware) + 36ms (loader) + 665ms (kernel) + 475ms (initrd) + 1.910s (userspace) = 8.647s
2013-04-25conf-parser: restrict .include usageLennart Poettering
Disallow recursive .include, and make it unavailable in anything but unit files.
2013-04-24Small cleanupZbigniew Jędrzejewski-Szmek
2013-04-22core: there's no point to complain so loudly about non-isolatable boot targetsLennart Poettering
2013-04-18move _cleanup_ attribute in front of the typeHarald Hoyer
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-18Move bus_error to dbus-common and remove bus_error_message_or_strerrorSimon Peeters
bus_error and bus_error_message_or_strerror dit almost exactly the same, so use only one of them and place it in dbus-common.
2013-04-17core/main: use _cleanup_Zbigniew Jędrzejewski-Szmek
2013-04-17Report about syntax errors with metadataZbigniew Jędrzejewski-Szmek
The information about the unit for which files are being parsed is passed all the way down. This way messages land in the journal with proper UNIT=... or USER_UNIT=... attribution. 'systemctl status' and 'journalctl -u' not displaying those messages has been a source of confusion for users, since the journal entry for a misspelt setting was often logged quite a bit earlier than the failure to start a unit. Based-on-a-patch-by: Oleksii Shevchuk <alxchk@gmail.com>
2013-04-17core/main: generate 4 parsing functions from a macroZbigniew Jędrzejewski-Szmek
2013-04-08Do not serialize environment, when switching rootHarald Hoyer
When switching root, i.e. LANG can be set to the locale of the initramfs or "C", if it was unset. When systemd deserializes LANG in the real root this would overwrite the setting previously gathered by locale_set(). To reproduce, boot with an initramfs without locale.conf or change /etc/locale.conf to a different language than the initramfs and check a daemon started by systemd: $ tr "$\000" '\n' </proc/$(pidof sshd)/environ | grep LANG LANG=C To prevent that, serialization of environment variables is skipped, when serializing for switching root. https://bugzilla.redhat.com/show_bug.cgi?id=949525
2013-04-05Use _cleanup_ when reading config filesZbigniew Jędrzejewski-Szmek
2013-04-05Use initalization instead of explicit zeroingZbigniew Jędrzejewski-Szmek
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.
2013-04-04util: make time formatting a bit smarterLennart Poettering
Instead of outputting "5h 55s 50ms 3us" we'll now output "5h 55.050003s". Also, while outputting the accuracy is configurable. Basically we now try use "dot notation" for all time values > 1min. For >= 1s we use 's' as unit, otherwise for >= 1ms we use 'ms' as unit, and finally 'us'. This should give reasonably values in most cases.
2013-04-03util: rename parse_usec() to parse_sec() sinds the default unit is secondsLennart Poettering
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.
2013-03-31Partially revert e62d8c394474Zbigniew Jędrzejewski-Szmek
The ~80 chars per line part wasn't well received.
2013-03-31ModernizationZbigniew Jędrzejewski-Szmek
Use _cleanup_ and wrap lines to ~80 chars and such.
2013-03-22main: minor simplificationLennart Poettering
2013-03-22main: use strv_find() where we canLennart Poettering
2013-03-22main: don't mount cgroup controller unless PID == 1Lennart Poettering
This completes c1dae1b3c9729fb8ab749dd4e2dad07e0fad7ed8 in a way.
2013-03-14main: don't mount /sys, /dev and friends when we run with PID != 1Lennart Poettering
Back from old times when we developed systemd on non-systemd hosts we still mounted the missing directories such as the cgroup stuff even when running with a PID != 1. There's no point for that anymore, so let's just do that if we are actually PID 1, and never otherwise. https://bugs.freedesktop.org/show_bug.cgi?id=62354
2013-03-07core: if we cannot JOB_ISOLATE the default target JOB_REPLACE it insteadsystemd/v198Lennart Poettering
In order to maintain compatibility with older initrds which do not have AllowIsolate=yes set for their target units, fallback to JOB_REPLACE if JOB_ISOLATE doesn't work, but complain about it.
2013-03-07core: mount and initialize SmackNathaniel Chen
SMACK is the Simple Mandatory Access Control Kernel, a minimal approach to Access Control implemented as a kernel LSM. The kernel exposes the smackfs filesystem API through which access rules can be loaded. At boot time, we want to load the access rules as early as possible to ensure all early boot steps are checked by Smack. This patch mounts smackfs at the new location at /sys/fs/smackfs for kernels 3.8 and above. The /smack mountpoint is not supported. After mounting smackfs, rules are loaded from the usual location. For more information about Smack see: http://www.kernel.org/doc/Documentation/security/Smack.txt
2013-03-07core: move mount_setup_early() to main.cNathaniel Chen
move mount_setup_early() call to main.c, before security module setup, so there are no more repeat calls.
2013-03-07core: don't complain about systemd.journald.xxx kernel command line ↵Lennart Poettering
arguments in PID 1 https://bugzilla.redhat.com/show_bug.cgi?id=880025
2013-03-06main: ISOLATE rather than REPLACE default.targetTom Gundersen
This allows switch-root to work correctly if a unit is active both before and after the switch-root, but its dependencies change. Before the patch, any dependencies added to active units by switch-root will not be pulled, in particular filesystems configured in /etc/fstab would not be activated if local-fs.target was active in the initrd. It is not clear to me if there is a bug in the REPLACE handling, or if it is working as expected and that we really want to use ISOLATE instead as this patch does.
2013-02-14honor SELinux labels, when creating and writing config filesHarald Hoyer
Also split out some fileio functions to fileio.c and provide a SELinux aware pendant in fileio-label.c see https://bugzilla.redhat.com/show_bug.cgi?id=881577
2013-02-11core: don't accept invalid environment assignments from the kernel cmdlineLennart Poettering
2013-01-04build-sys: drop all distribution specfic checksLennart Poettering
Yay, we now have a completely generic systemd. No distribution specific checks anymore!
2012-12-22socket: support socket activation of containersLennart Poettering
2012-11-20build-sys: make loadable module support optionalTom Gundersen
kmod is unecessary if loadable module support is disabled in the kernel, so make the dependency optional.
2012-10-27hwclock: do not seal the kernel's time-warp call from inside the initrdKay Sievers