summaryrefslogtreecommitdiff
path: root/src/core/main.c
AgeCommit message (Collapse)Author
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
2012-10-16core: Refuse to run a user instance when the system hasn't been booted with ↵Thomas Bächler
systemd. Running as a user instance won't work at all if systemd isn't running as system manager, so refuse to start in that case.
2012-09-24main: don't try to mout cpuset with cpu+cpuacct anymoreLennart Poettering
Turns out cpuset needs explicit initialization before we could make use of it. Thus mounting cpuset with cpu/cpuacct would make it impossible to just create a group in "cpu" and start it.
2012-09-18core: move ManagerRunningAs to sharedZbigniew Jędrzejewski-Szmek
Note: I did s/MANAGER/SYSTEMD/ everywhere, even though it makes the patch quite verbose. Nevertheless, keeping MANAGER prefix in some places, and SYSTEMD prefix in others would just lead to confusion down the road. Better to rip off the band-aid now.
2012-09-17main: when transitioning from initrd to the main system log to kmsgLennart Poettering
When the new PID is invoked the journal socket from the initrd might still be around. Due to the default log target being journal we'd log to that initially when the new main systemd initializes even if the kernel command line included a directive to redirect systemd's logging elsewhere. With this fix we initially always log to kmsg now, if we are PID1, and only after parsing the kernel cmdline try to open the journal if that's desired. (The effective benefit of this is that SELinux performance data is now logged again to kmsg like it used to be.)
2012-09-17hwclock: always set the kernel's timezoneKay Sievers
Properly tell the kernel at bootup, and any later time zone changes, the actual system time zone. Things like the kernel's FAT filesystem driver needs the actual time zone to calculate the proper local time to use for the on-disk time stamps. https://bugzilla.redhat.com/show_bug.cgi?id=802198
2012-09-17main: bump up RLIMIT_NOFILE for systemd itselfLennart Poettering
For setups with many listening sockets the default kernel resource limit of 1024 fds is not enough. Bump this up to 64K to avoid any limitations in this regard. We are careful to pass on the kernel default to daemons however, since normally resource limits are a good to enforce, especially since select() can't handle fds > 1023.
2012-09-10selinux: close stdin/stdout/stderr before loading selinux policyLennart Poettering
Let's make sure libselinux doesn't spew to stderr
2012-09-07main: fix syntax of net_prio cgroup controllerLennart Poettering
2012-09-03main: jointly mount more controllersLennart Poettering
After talking to the cgroup kernel folks at LPC we came to the conclusion that it is probably a good idea to mount all CPU related resp. all network related cgroup controllers together, both because they are good defaults for admins and because this might prepare for eventual kernel cleanups where the ability to mount them separately is removed.
2012-08-23core: free word later in parse_proc_cmdlineLukas Nykryn
2012-08-21main: fix PR_SET_CHILD_SUBREAPER warning versionLennart Poettering
2012-08-21core: fix error checking for PR_SET_CHILD_SUBREAPERLennart Poettering
2012-08-06main: fix typoLennart Poettering
2012-08-06continue work with error messages, log_oom()Shawn Landden
Adds messages for formally silent errors: new "Failed on cmdline argument %s: %s". Removes some specific error messages for -ENOMEM in mount-setup.c. A few specific ones have been left in other binaries.
2012-07-25main: set PR_SET_CHILD_REAPER for MANAGER_USERAuke Kok
Become the reaper for all children part of the user session. Tested with several forking services.