Commit Graph

293 Commits

Author SHA1 Message Date
Lennart Poettering b4bdfefac3 preset: don't look for preset files in /lib unless /usr is split off 2012-06-21 23:22:53 +02:00
Lennart Poettering 089842938d journal: expose and make use of cutoff times of journal
This helps explaining when the log output of "systemctl status" is
incomplete because the logs got rotated since the service was started.
2012-06-17 00:03:12 +02:00
Michal Schmidt 48899192a7 unit-name: introduce unit_dbus_path_from_name()
Use the same function in core and in systemctl.
get_unit_path() in systemctl becomes unnecessary.
2012-06-13 18:42:02 +02:00
Kay Sievers 4b7126538c unit-name: never create a unit name with a leading '.'
Supposed to prevent creating unit files like:
  ├── dev-sda1.device.wants
  │   └── .dot.mount -> /run/systemd/generator/.dot.mount
  ├── .dot.mount
from:
  # cat /etc/fstab
  /dev/sda1    /.dot           vfat ro           1 3

which we later skip reading because of the leading '.'.
2012-06-04 14:57:24 +02:00
Lennart Poettering 48ac500bb6 missing: define MS_STRICTATIME if not defined already 2012-06-01 21:25:29 +02:00
Lennart Poettering 213ba152fd journal: allow setting of a cutoff log level for disk storage, syslog, kmsg, console forwarding 2012-06-01 17:27:16 +02:00
Marc-Antoine Perennou 952d817a41 main: Silence gcc warning 2012-05-31 18:04:41 +02:00
Kay Sievers 0f9963a8b8 Revert "label: fix systemd-udev labeling of /run directory."
This reverts commit 9b5af248f0.

Udev now explicitely labels only files/directories in /dev. The selinux
array API is not released and will not work on other distros at this moment.
2012-05-31 13:34:41 +02:00
Kay Sievers c66e7f0499 mkdir: provide all functions with and without selinux label application 2012-05-31 13:17:26 +02:00
Kay Sievers d2e54fae5c mkdir: append _label to all mkdir() calls that explicitly set the selinux context 2012-05-31 12:40:20 +02:00
Kay Sievers 051d68786b util: don't require libcap when building libsystemd-shared
src/shared/util.c includes <sys/capability.h> but doesn't use anything
defined there.  Since <sys/capability.h> is part of libcap, not libc,
don't require it.

Allows systemd-without-udevd to require fewer external libraries.
2012-05-31 11:58:06 +02:00
Lennart Poettering d88a251b12 util: introduce a proper nsec_t and make use of it where appropriate 2012-05-31 04:27:03 +02:00
Daniel J Walsh 9b5af248f0 label: fix systemd-udev labeling of /run directory.
systemd-udev is currently incorrectly labeling /run/udev/* content because it is
using selinux prefix labeling of /dev.  This patch will allow systemd-udev to
use prefix labeling of /dev and /run.
2012-05-31 01:43:27 +02:00
Lennart Poettering 107a2db901 selinux: downgrade database load time message to LOG_DEBUG 2012-05-31 01:10:53 +02:00
Lennart Poettering ba1261bc02 build-sys: fix built with --disable-logind 2012-05-30 22:25:01 +02:00
Lennart Poettering 069cfc85f8 logind: optionally handle power, sleep and lid switch events
This takes handling of chassis power and sleep keys as well as the lid
switch over from acpid.

This logic is enabled by default for power and sleep keys, but not for
the lid switch.

If a graphical session is in the foreground no action is taken under the
assumption that the graphical session does this.
2012-05-30 15:01:51 +02:00
Lennart Poettering 939b8f14dc capabilities: when dropping capabilities system-wide also drop them from usermode helpers
This hooks things up with /proc/sys/kernel/usermodehelper/bset and
/proc/sys/kernel/usermodehelper/inheritable.
2012-05-29 23:35:17 +02:00
Lennart Poettering ec8927ca59 main: add configuration option to alter capability bounding set for PID 1
This also ensures that caps dropped from the bounding set are also
dropped from the inheritable set, to be extra-secure. Usually that should
change very little though as the inheritable set is empty for all our uses
anyway.
2012-05-24 04:00:56 +02:00
Lennart Poettering 07719a21b6 manager: rework generator logic
Previously generated units were always placed at the end of the search
path. With this change there will be three unit dirs instead of one, to
place generated entries at the beginning, in the middle and at the end
of the search path:

beginning: for units that need to override all configuration, regardless
of user or vendor. Example use: system-update-generator uses this to
temporarily redirect default.target.

middle: for units that need to override vendor configuration, but not
vendor configuration. Example use: /etc/fstab should override vendor
supplied configuration (think /tmp), but should not override native user
configuration.

end: does not override anything but is available as well. Possible usage
might be to convert D-Bus bus service files to native units but allowing
vendor supplied native units to win.
2012-05-23 03:43:29 +02:00
Lennart Poettering a690306153 log: make sure generators never log into the journal to avoid activation deadlocks
This makes all generators log to kmsg by default.
2012-05-22 22:00:37 +02:00
Lennart Poettering 7925c22a78 util: make sure to fstatat() at most once in rm_rf_children() 2012-05-22 16:14:34 +02:00
Lennart Poettering 8f33b5b8b3 util: rework in_initrd() logic
Checking the device major/minor is not a good idea. Let's replace this
with an explicit flag file, which we model after /etc/os-release and
call /etc/initrd-release.
2012-05-21 20:00:58 +02:00
Harald Hoyer 597f43c784 util: rm_rf_children() add root_dev parameter
if root_dev is set, remove subdirectories only, if the device is the
same as the root_dev. This prevents to remove files across device
boundaries.
2012-05-21 18:52:49 +02:00
Harald Hoyer 9be346c94e util.c: add in_initrd()
in_initrd() checks, if the stat() for the device for "/" is 1, which it
is for the initramfs.
2012-05-21 18:47:39 +02:00
Harald Hoyer f67cc036ba main: corrected do_switch_root()
do_switch_root now mount moves "/dev", "/proc", "/sys", "/run" and
removes the old root recursively.
2012-05-21 18:45:10 +02:00
Frederic Crozat 4d768ced49 util: fix typo in newdup 2012-05-21 18:18:49 +02:00
Lennart Poettering 344de60901 hostname-setup: also consider (ńone) an unset hostname 2012-05-21 17:19:58 +02:00
Lennart Poettering 78d54bd42b unit: introduce RequiredBy= setting in [Install], to complement WantedBy= 2012-05-21 15:27:26 +02:00
Lennart Poettering 49dbfa7b2b units: introduce new Documentation= field and make use of it everywhere
This should help making the boot process a bit easier to explore and
understand for the administrator. The simple idea is that "systemctl
status" now shows a link to documentation alongside the other status and
decriptionary information of a service.

This patch adds the necessary fields to all our shipped units if we have
proper documentation for them.
2012-05-21 15:14:51 +02:00
Lennart Poettering 03ad1136ba tmpfiles: if we are supposed to write a string to a file, it's OK if we can't write the trailing newline 2012-05-15 14:35:51 +02:00
Michal Schmidt ba49b4a1a2 install: fix inverted meaning of '--force' in systemctl enable 2012-05-15 08:13:29 +02:00
Andreas Schwab 990478a0ef missing: Fix broken syscall(__NR_fanotify_mark... on ppc32
The same situation as on o32 mips.
2012-05-14 22:57:07 +02:00
Michal Schmidt 9ab7a8d2a3 unit: print the color status marks on the left
The alignment of the "[  OK  ]" and "[FAILED]" status marks to the right
side of the terminal makes it difficult to link them with the messages
on the left if your console is wide.

I considered the options:
 1. Align them to the 80th column regardless of the console width.
    Disadvantage - either:
    - truncating messages needlessly, not using available space; or
    - If the message is long, write the mark over it. => ugly
 2. Write them to the 80th column for short messages,
    and further to the right for longer ones.
    Disadvantage:
    - jagged look
 3. Write the marks on the left, before the message.
    Disadvantage:
    - Breaks tradition from RHL.
    Advantages:
    + slightly simpler code
    + Will annoy holy-traditionalists.

I chose option 3.
BTW, Debian now uses similar marks on the left with its makefile-style
boot.

Special values of the "status" argument to status_vprintf are:
  NULL - no status mark, no message indentation
  ""   - no status mark, message indented as if the mark was there
2012-05-14 14:29:53 +02:00
Michal Schmidt 5f23d5b149 job: change red [ABORT] status to yellow [DEPEND]
The red "[ABORT]" for a dependency failure is too scary.
It suggests a crash. And it suggests a problem with the unit itself.
Change it to a yellow "[DEPEND]" message. The color communicates the
level of seriousness better.
2012-05-14 14:29:53 +02:00
Lennart Poettering d4d046e3fd util: a few updates for rm_rf() 2012-05-09 01:25:52 +02:00
Lennart Poettering 14753f3419 path-util: there is no function path_parent() 2012-05-08 23:37:25 +02:00
Lennart Poettering d889a2069a logind: implement suspend/hibernate calls with inhibition logic 2012-05-08 19:02:25 +02:00
Lennart Poettering 6edd7d0a09 sleep: implement suspend/hibernate as first class targets 2012-05-08 13:54:23 +02:00
Kay Sievers 9eb977db5b util: split-out path-util.[ch] 2012-05-08 02:33:10 +02:00
Kay Sievers bbc98d3256 util: split-out hwclock.[ch] 2012-05-08 01:57:17 +02:00
Kay Sievers 2c21044f05 util: split-out conf-file.[ch] 2012-05-07 19:01:24 +02:00
Kay Sievers 0a1a17aa2d conf_files_list(): split out conf_files_list_strv() 2012-05-07 13:20:29 +02:00
Kay Sievers cd9556cc84 conf_files_list(): files-add() - do not canonicalize file names
File names in /etc, /run, /usr/lib are sorted/overridden by basename.
Sorting things like "/dev/null" with the basename "null" in the hash
of config files breaks the ordering and the overriding logic.
2012-05-07 13:15:25 +02:00
Lennart Poettering eecd1362f7 logind: implement delay inhibitor locks in addition to block inhibitor locks
This is useful to allow applications to synchronously save data before
the system is suspended or shut down.
2012-05-05 00:36:08 +02:00
Lennart Poettering 37099707e2 cgroup: fix alloca() misuse in cg_shorten_controllers() 2012-05-03 23:23:38 +02:00
Lennart Poettering 6e476bc9d1 dbus: handle invalid enum values better 2012-05-03 23:06:19 +02:00
Lennart Poettering e677bf7ef6 hwclock: add taint flag for non-local hwclock 2012-05-03 16:00:49 +02:00
Lucas De Marchi c4326aa4af util: introduce container_of() macro
This macro comes from kernel and it's useful for unwrapping structs
inside another one. The generated code is actually the same to the one
where this logic is used in udev, but using this macro is much cleaner
and less error prone.
2012-04-29 19:14:05 +02:00
Lennart Poettering ab94af9201 util: unify getenv() logic for other PID 2012-04-22 15:00:42 +02:00
Lennart Poettering 0f0dbc46cc nspawn: add -b switch to automatically look for an init binary 2012-04-22 14:11:32 +02:00
Lennart Poettering acda6a054f default to v102 everywhere, instead of vt100, to synchronize with agetty 2012-04-22 02:45:39 +02:00
Lennart Poettering d1122ad5e3 login: assing /dev/console logins to seat0 2012-04-22 02:41:18 +02:00
Lennart Poettering 3d9a412243 util: fix tty_is_vc_resolve() in a container where /sys/class/tty/console/active is misleading 2012-04-22 01:59:11 +02:00
Lennart Poettering d29b05a461 log: include syslog identifier in default log properties, to avoid comm truncation 2012-04-22 01:01:54 +02:00
Lennart Poettering 678d485a55 log: fix LOG_TARGET_JOURNAL_OR_KMSG 2012-04-20 12:40:02 +02:00
Sven Anders 771faa9ae6 fix typo in src/shared/install.c 2012-04-19 12:03:28 +02:00
Kay Sievers 5ba2dc259f udev: unify /dev static symlink setup 2012-04-17 22:31:38 +02:00
Kay Sievers 018ef268b1 silence a bunch of gcc warnings 2012-04-17 18:42:09 +02:00
Kay Sievers e9a5ef7cdd selinux: unify systemd and udev code 2012-04-17 16:05:28 +02:00
Kay Sievers 75e37ac5b1 mkdir: do not use alloca() in a loop 2012-04-17 16:05:28 +02:00
Kay Sievers 9e13dbae50 udev: replace util_create_path() with mkdir_parents() 2012-04-17 01:09:39 +02:00
Lennart Poettering b59e246565 logind: remove redundant entries from logind's default controller lists too 2012-04-16 19:15:00 +02:00
Lennart Poettering b69d29ce04 systemctl: show main and control PID explicitly in cgroup-show
In some cases the main/control PID of a service can be outside of the
services cgroups (for example, if logind readjusts the processes'
cgroup). In order to clarify this for the user show the main/control PID
in the cgroup tree nonetheless, but mark them specially.
2012-04-16 18:59:40 +02:00
Lennart Poettering 888c710235 util: introduce memdup() 2012-04-16 18:59:08 +02:00
Lennart Poettering c3175a7f40 cgls: don't show empty cgroups by default 2012-04-16 18:59:08 +02:00
Lennart Poettering f8e2fb7b14 logind: add shutdown/suspend/idle inhibition framework 2012-04-16 18:59:08 +02:00
Lennart Poettering 3474ae3c7e cgroup: if a controller is not available don't try to create cgroups in its hierarchy 2012-04-16 18:59:07 +02:00
Lennart Poettering 8aec53fb90 polkit: spawn agent in --fallback mode 2012-04-13 21:52:42 +02:00
Lennart Poettering c757a65b6a watchdog: make watchdog dbus properties writable 2012-04-13 21:37:59 +02:00
Lennart Poettering d4e7373bbb dbus: automatically send out changed events for properties written to 2012-04-13 21:37:59 +02:00
Lennart Poettering 7ea07dcdda fix a couple of things found with the llvm static analyzer 2012-04-13 13:58:50 +02:00
Lennart Poettering c0a0872d5c build-sys: move src/linux/ to src/shared/linux 2012-04-12 18:27:35 +02:00
Lennart Poettering 08e1fb68d7 build-sys: move *-setup out of shared to avoid selinux being pulled in 2012-04-12 18:19:34 +02:00
Kay Sievers 3bdf9c1d0a move remainig shared stuff to shared/ 2012-04-12 15:11:39 +02:00
Lennart Poettering b6e661357c main: we want all setup functions to be in files called xxx-setup.[ch] 2012-04-12 14:29:29 +02:00
Lennart Poettering 4d89613917 hostname-setup: move to core/ 2012-04-12 14:23:17 +02:00
Lennart Poettering 643a14a527 build-sys: move a few things into more appropriate places 2012-04-12 13:35:56 +02:00
Lennart Poettering fff7b732b2 build-sys: add stub makefiles to make emacs easier to use 2012-04-12 13:35:56 +02:00
Kay Sievers 78a825f216 rename machine-id-main.c tomacht the binary and move main.c to core/ 2012-04-12 13:12:06 +02:00
Lennart Poettering 68faf98ca0 execute: when we can't get the requested rlimit, get the next closest 2012-04-12 12:58:19 +02:00
Kay Sievers f33d3ec1d7 move more common files to shared/ and add them to shared.la 2012-04-12 02:39:37 +02:00
Lennart Poettering 5430f7f2bc relicense to LGPLv2.1 (with exceptions)
We finally got the OK from all contributors with non-trivial commits to
relicense systemd from GPL2+ to LGPL2.1+.

Some udev bits continue to be GPL2+ for now, but we are looking into
relicensing them too, to allow free copy/paste of all code within
systemd.

The bits that used to be MIT continue to be MIT.

The big benefit of the relicensing is that closed source code may now
link against libsystemd-login.so and friends.
2012-04-12 00:24:39 +02:00
Lennart Poettering 9bdc770ccd polkit: when spawning off agent, wait until the agent is fully initialized 2012-04-11 22:37:48 +02:00
Lennart Poettering 6bb92a169e polkit: temporarily spawn of a polkit agent in terminals for possibly authenticated operations 2012-04-11 20:39:03 +02:00
Kay Sievers 79c077224b put acl.la in 'if HAVE_ACL' and rename acl.[ch] to acl-util.[ch] 2012-04-11 16:47:09 +02:00
Lennart Poettering 71ecc858fa main: drop container/initrd env vars from inherited set
Leave the env vars used in the container/initrd logic set for PID1, but
don't inherit them to any children.
2012-04-11 13:20:34 +02:00
Kay Sievers cc527a4734 split selinux label operations out of cgroup-util, socket-util
This prevents linking of selinux and libdl for another 15 binaries.
2012-04-11 12:49:00 +02:00
Kay Sievers 49e942b2bc rename basic.la to shared.la and put selinux deps in shared-selinx.la
Only 34 of 74 tools need libselinux linked, and libselinux is a pain
with its unconditional library constructor.
2012-04-10 22:43:05 +02:00
Kay Sievers 771f19c06a move list.h, macro.h, ioprio.h to shared/ 2012-04-10 19:47:00 +02:00
Kay Sievers 9f36aa6846 move pager.[ch] to shared/ 2012-04-10 19:32:48 +02:00
Kay Sievers 77d47be64f move cgroup-util.[ch] to shared/ 2012-04-10 18:46:51 +02:00
Kay Sievers 78b2e3a632 util: move ACL code into internal library 2012-04-10 14:59:45 +02:00
Kay Sievers d7832d2c6e util: move all to shared/ and split external dependencies in separate internal libraries
Before:
  $ ldd /lib/systemd/systemd-timestamp
  linux-vdso.so.1 =>  (0x00007fffb05ff000)
  libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f90aac57000)
  libcap.so.2 => /lib64/libcap.so.2 (0x00007f90aaa53000)
  librt.so.1 => /lib64/librt.so.1 (0x00007f90aa84a000)
  libc.so.6 => /lib64/libc.so.6 (0x00007f90aa494000)
  /lib64/ld-linux-x86-64.so.2 (0x00007f90aae90000)
  libdl.so.2 => /lib64/libdl.so.2 (0x00007f90aa290000)
  libattr.so.1 => /lib64/libattr.so.1 (0x00007f90aa08a000)
  libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f90a9e6e000)

After:
  $ ldd systemd-timestamp
  linux-vdso.so.1 =>  (0x00007fff3cbff000)
  libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f5eaa1c3000)
  librt.so.1 => /lib64/librt.so.1 (0x00007f5ea9fbb000)
  libc.so.6 => /lib64/libc.so.6 (0x00007f5ea9c04000)
  /lib64/ld-linux-x86-64.so.2 (0x00007f5eaa3fc000)
  libdl.so.2 => /lib64/libdl.so.2 (0x00007f5ea9a00000)
  libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f5ea97e4000)
2012-04-10 14:13:38 +02:00