summaryrefslogtreecommitdiff
path: root/src/core/main.c
AgeCommit message (Collapse)Author
2014-06-27main: uid_to_name() might fail due to OOM, protect against thatLennart Poettering
2014-06-26core: use correct format string for UIDsMichał Bartoszkiewicz
2014-06-20core: clean-up signal reset logic when reexecLennart Poettering
There's no need to save the old sigmask, if we are going to die. Let's simplify this. Also, reset all the signal handlers, so that we don't leave SIG_IGN set for some of them across reexec.
2014-06-19main: don't show help text anymore when we detect an unknown kernel cmdline ↵Lennart Poettering
value starting with "systemd." As generators and other components started to maintain their own kernel command line options this help text needed more and more exceptions and wasn't complete anyway. Fixing that would leak more information about specific generators into PID 1, which we should avoid. Given that kernel cmdline handling traditionally doesn't generate errors or show help texts, let's just remove the logic for it for systemd too.
2014-06-19main: honour rd.systemd.unit= only in the initrd, not the hostLennart Poettering
2014-06-17core: populate unit file set with preset data if we boot with empty /etcLennart Poettering
2014-06-17machine-id-setup: allow passing NULL as function argument, for simplicityLennart Poettering
2014-06-17kmod: conditionalize kmod setup on CAP_SYS_MODULE, not whether we run in a ↵Lennart Poettering
container It's generally preferrable to conditionalize on the actual ability to do something then the context we run in.
2014-06-17log: don't downgrade log level in non-PID 1 if "quiet" is passed on kernel ↵Lennart Poettering
cmdline "debug" should apply to all tools, but "quiet" only to PID1.
2014-06-16Reset signal-mask on re-exec to init=..Ruediger Oertel
Process 1 (aka init) needs to be started with an empty signal mask. That includes the process 1 that's started after the initrd is finished. When the initrd is using systemd (as it does with dracut based initrds) then it is systemd that calls the real init. Normally this is systemd again, except when the user uses for instance "init=/bin/bash" on the kernel command line.
2014-06-13core: don't complain at early boot if /etc/mtab is not the right symlinkLennart Poettering
When we boot up with an empty /etc it's ok if the symlink doesn't exist. We will create it later with tmpfiles.
2014-06-13os-release: define /usr/lib/os-release as fallback for /etc/os-releaseLennart Poettering
The file should have been in /usr/lib/ in the first place, since it describes the OS container in /usr (and not the configuration in /etc), hence, let's support os-release files in /usr/lib as fallback if no version in /etc exists, following the usual override logic. A prior commit already enabled tmpfiles to create /etc/os-release as a symlink to /usr/lib/os-release should it be missing, thus providing nice compatibility with applications only checking in /etc. While it's probably a good idea if all apps check both locations via a fallback logic, it is only necessary in the early boot process, as long as the /etc/os-release symlink has not been restored, in case we boot with an empty /etc.
2014-05-28virt: rework container detection logicLennart Poettering
Instead of accessing /proc/1/environ directly, trying to read the $container variable from it, let's make PID 1 save the contents of that variable to /run/systemd/container. This allows us to detect containers without the need for CAP_SYS_PTRACE, which allows us to drop it from a number of daemons and from the file capabilities of systemd-detect-virt. Also, don't consider chroot a container technology anymore. After all, we don't consider file system namespaces container technology anymore, and hence chroot() should be considered a container even less.
2014-05-24shared: rename hwclock.[ch] to clock-util.[ch]Kay Sievers
2014-05-22cgroups: simplify CPUQuota= logicLennart Poettering
Only accept cpu quota values in percentages, get rid of period definition. It's not clear whether the CFS period controllable per-cgroup even has a future in the kernel, hence let's simplify all this, hardcode the period to 100ms and only accept percentage based quota values.
2014-05-05core: require cgroups filesystem to be availableKay Sievers
We should no longer pretend that we can run in any sensible way without the kernel supporting us with cgroups functionality.
2014-04-25core: expose CFS CPU time quota as high-level unit propertiesLennart Poettering
2014-04-06reduce the amount of messages logged to /dev/kmsg when "debug" is specifiedKay Sievers
2014-03-24core: add a setting to globally control the default for timer unit accuracyLennart Poettering
2014-03-18util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering
safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
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-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-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-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-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-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-03execute: no need to include seccomp.h from execute.hLennart Poettering
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-21hostnamectl: should the sanitized arch, not the native uname() oneLennart Poettering
2014-02-17main: make gcc shut upLennart Poettering
2014-02-17core: fixate show_status earlier, so that we actually print the welcome messageLennart Poettering
Previously, we'd fixed show_state only after printing the welcome message which had the effect that the welcome message was almost always suppressed.
2014-02-17main: don't set no_new_privs when using SystemCallArchitectures= system-wideLennart Poettering
After all, we want to allow userspace to get new privs...
2014-02-17Pass log config from systemd to systemd-shutdownZbigniew Jędrzejewski-Szmek
If PID 1 debug logging is enabled, it is nice to keep those settings when switching to systemd-shutdown binary, independently of whether this was done through /proc/cmdline options, or through runtime manipulations.
2014-02-17Some modernizationsZbigniew Jędrzejewski-Szmek
2014-02-17Extract looping over /proc/cmdline into a shared functionZbigniew Jędrzejewski-Szmek
In cryptsetup-generator automatic cleanup had to be replaced with manual cleanup, and the code gets a bit longer. But existing code had the issue that it returned negative values from main(), which was wrong, so should be reworked anyway.
2014-02-13seccomp: fix build again if libseccomp is missingLennart Poettering
2014-02-13core: add a system-wide SystemCallArchitectures= settingLennart Poettering
This is useful to prohibit execution of non-native processes on systems, for example 32bit binaries on 64bit systems, this lowering the attack service on incorrect syscall and ioctl 32→64bit mappings.
2014-01-27manager: add systemd.show_status=auto modeZbigniew Jędrzejewski-Szmek
When set to auto, status will shown when the first ephemeral message is shown (a job has been running for five seconds). Then until the boot or shutdown ends, status messages will be shown. No indication about the switch is done: I think it should be clear for the user that first the cylon eye and the ephemeral messages appear, and afterwards messages are displayed. The initial arming of the event source was still wrong, but now should really be fixed.
2014-01-08Improve messages about user mode a bitZbigniew Jędrzejewski-Szmek
2014-01-05Remove unused variablesZbigniew Jędrzejewski-Szmek
2014-01-05strv: multiple cleanupsSimon Peeters
- turn strv_merge into strv_extend_strv. appending strv b to the end of strv a instead of creating a new strv - strv_append: remove in favor of strv_extend and strv_push. - strv_remove: write slightly more elegant - strv_remove_prefix: remove unused function - strv_overlap: use strv_contains - strv_printf: STRV_FOREACH handles NULL correctly
2014-01-02Use format patterns for usec_t, pid_t, nsec_t, usec_tZbigniew Jędrzejewski-Szmek
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.
2013-12-23log: als turn on debug logging in non-PID1 if /proc/cmdline contains "debug"Lennart Poettering
2013-12-19do not run kmod-setup in a containerKay Sievers
2013-12-18core: in a container log to /dev/console if "debug" is specifiedLennart Poettering
2013-12-18log: don't reopen /dev/console each time we call log_open()Lennart Poettering
Instead, force reopen it only if we really really have to.
2013-12-17_noreturn_ --> noreturn for C11 compatShawn Landden
also define noreturn w/o <stdnoreturn.h>
2013-11-30core: allocate a kdbus bus for each systemd instance, if we canLennart Poettering
2013-11-26tree-wide usage of %m specifier instead of strerror(errno)Daniel Buch
Also for log_error() except where a specific error is specified e.g. errno ? strerror(errno) : "Some user specified message"